I have a technical question regarding the implementation of the scheduler in FreeRTOS. I am currently using the AVR Atmega32 port of FreeRTOS.
Consider that there are two tasks, A and B. Task A is currently having the CPU and running but task B is in ready state. Suddenly let us say, task A needs to read a byte from the serial port. But the data is not available right now so this task has to block. So now my question is:
Does the scheduler get to know that task A is getting blocked and then suspends task A or does the scheduler allows task A to have the CPU(even in blocked state) till its time slice is over. When its time slice is over, the scheduler will anyway give the CPU to task B which was already in ready state.
In other words, is the scheduler aware when a particular task is going to block for some input?
is the scheduler completely driven by the expiry of time slices (based on the tick ISR) which causes it to allocate the CPU to another ‘ready’ task.
Hope I made myself clear.
Thanks in advance,