Describe any three RTOS scheduling methods and compare.

Mumbai University > Electronics Engineering > Sem 6 > Embedded System and RTOS

1 Answer

a. First come first served (FCFS)/ FIFO scheduling:

As the name indicates this algorithm allocates CPU time to tasks based on the order in which they enter the ready queue. The first enter process is serviced first. The major drawback of FCFS is that it favors monopoly of a process. A process which does not contain any I/O operation executes till its completion. I/O bound processes have to wait until the completion of CPU bound processes.

b. Last-come first served (LCFS)/LIFO scheduling:

Processes are allocated CPU based on the order in which they enter the CPU. The last entered process is serviced first. LCFS is also not optimal as it also possesses the same drawback as that of FCFS algorithm.

c. Shortest Job First (SJF) Scheduling:

The ready queue is sorted by the CPU every time a process relinquishes (i.e. it terminates or enters wait state for an I/O resource) to pick a process which has least estimated run time. The major drawback is that processes with higher execution time may not get a chance to execute if more and more processes with least execution time enter the ready queue. This is known as starvation.

d. Priority based scheduling:

The priority is assigned to each task based on criteria’s like the shortest job first or the priority can be indicated at time of creation of the task using a number ranging from 0. Priority based non-preemptive scheduling also suffers from starvation which can be tackled using priority based preemptive scheduling.

Scheduling policy Scheduling criteria Implementation Problems faced
FCFS First task in the queue is served first Easy If the highest priority task is last in queue, it will have to wait for a long time.
LCFS Last task in the queue is served first Easy If the highest priority task is first in queue it will have to wait.
SJF Shortest time duration task is executed first Difficult If the highest priority task has a longer time duration, it will have to wait.
Priority based scheduling Scheduling based on the priorities of task Difficult If the task has a shorter duration but lowest priority it will always have to wait.
Please log in to add an answer.