Navigation

Thursday 29 May 2014

SRJN (Shortest Remaining Job Next) scheduling algorithm

The SRJN scheduling algorithm uses a fore knowledge of each task execution time and then executives the tasks in the order of their runtime with the short task first. The SRJN scheduling algorithm is fair in the sense that it reduces the time in which shorter tasks have to wait in the system and leaves longer tasks to wait longer in the system. Although the issue of the order in which the processes arrived is not considered in SRJN, it still tries to be fair by ensuring that all the processes are eventually completed. But in the case where a longer job waits for ever because a shorter job always arrives, SRJN can be considered unfair.

The following differences were identified between the SRJN and FCFS scheduling algorithm.
FCFS executes processes based on the order in which they arrive the processor, the process that requests the CPU first is allocated the CPU first while SRJN executes the processes in accordance with the task that has the shortest time to execute when compared with the other processes.
In SRJN, the duration time of all the tasks needs to be identified in advance while this is not required in FCFS.
The average waiting time is higher in FCFS than in SRJN because in FCFS, shorter tasks could be made to wait for longer time if they arrive the CPU late, thereby increasing the overall average wait time. In SRJN, the shortest tasks are completed before the longer ones, thereby reducing the average wait time.
SRJN is preemptive by releasing the CPU to the next shortest process while in the BLOCKED state while FCFS is non-preemptive.

The following are identified as differences between RR and SRJN
 SRJN only takes into account the task with the shortest time required to complete while RR takes into account the order in which the processes arrives while at the same time giving each process a time slice so that the current process do not have to be completed before the next one can run.
 RR uses a time slice for each process while SRJN does not.
 During CPU intensive processes, the current task must be completed before the next one can run in SRJN; but in RR all tasks are given equal time to run and moves to the nest process even though the current one may not be completed.
 In SRJN, there is a fore knowledge of the runtime of each of the processes which it uses to determine the next process to execute; there is no previous knowledge of the runtime in RR.
 When SRJN is undergoing an IO operation, it becomes more efficient than RR by considering the job that takes the shortest time to complete while RR does not consider.
 The average wait time of RR is higher than that of SRJN because RR tends to make all processes to spend an equal amount of time in the system at the expense of an increased average wait time.
 When undergoing only CPU intensive processes, SRJN becomes faster than RR because the context switch time introduced in RR increases the elapsed time.
 SRJN has the potential of starving longer tasks so that they do not get the chance to run if a job with a considerable shorter time is continuously added.

The following are identified as differences between SJF and SRJN
 The wait time for each of the processes in SRJN is generally shorter than that of SJN, consequently, a lower average wait time is experienced by SRJN.
 The total time for each of the processes in SRJN is shorter than that in SJN.
 SRJN is preemptive because it releases the CPU to the next shortest process while in the BLOCKED state but SJN is non-preemptive (the current process has to complete before the next one can take over).

RR (Round Robin) scheduling algorithm

In terms of the overall effect of the RR scheduling algorithm, it can be considered as a fair algorithm because all processes are allowed to run for a predefined and equal amount of time, which is repeated until they are completed with the shorter process completing faster than a longer one. When fairness is viewed in terms of jobs that arrive first should be completed first, RR scheduling algorithm tries to be fair by giving that process a share of the time first before proceeding to the next process.

The following are identified as differences between RR and FCFS (First Come First Served)
 In FCFS, tasks are performed and completed in accordance with how the process arrives the CPU while RR takes into account the order in which the processes arrives while at the same time giving each process a time slice so that the current process do not have to be completed before the next one can run.
 When FCFS is undergoing an IO operation, it becomes very inefficient as it does not release the CPU to another process (non-preemptive) while RR is a preemptive scheduling algorithm that frees the CPU to the next process when in the BLOCKED state.
 The average wait time of RR is higher than that of FCFS because RR tends to make all processes to spend an equal amount of time in the system at the expense of an increased average wait time.
 When undergoing only CPU intensive processes, FCFS becomes faster than RR because the context switch time introduced in RR increases the elapsed time.

The following are identified as differences between RR and SJF
 In SJF, tasks are performed and completed in accordance with the shortest time it takes to complete a particular process while RR takes into account the order in which the processes arrives while at the same time giving each process a time slice so that the current process do not have to be completed before the next one can run.
 In SJF, there is a fore knowledge of the runtime of each of the processes which it uses to determine the next process to execute; there is no previous knowledge of the runtime in RR.
 When SJF is undergoing an IO operation, it becomes very inefficient as it does not release the CPU to another process (non-preemptive) while RR is a preemptive scheduling algorithm that frees the CPU to the next process when in the BLOCKED state.
 The average wait time of RR is higher than that of SJF because RR tends to make all processes to spend an equal amount of time in the system at the expense of an increased average wait time.
 When undergoing only CPU intensive processes, SJF becomes faster than RR because the context switch time introduced in RR increases the elapsed time.
 SJF has the potential of starving longer tasks so that they do not get the chance to run if a job with a considerable shorter time is continuously added.

SJF (Shortest Job First) Scheduling Algorithm

The SJF scheduling algorithm uses a fore knowledge of each task execution time and then executives the tasks in the order of their runtime with the short task first. The SJF scheduling algorithm is fair in the sense that it reduces the time in which shorter tasks have to wait in the system and leaves longer tasks to wait longer in the system. Although the issue of the order in which the processes arrived is not considered in SJF, it still tries to be fair by ensuring that all the processes are eventually completed. But in the case where a job waits for ever because a shorter job gets called so often thereby preventing its execution even though it arrived first, SJF can be considered unfair.

The following differences were identified between the SJF and FCFS scheduling algorithm.
 FCFS executes processes based on the order in which they arrive the processor, the process that requests the CPU first is allocated the CPU first while SJF executes the processes based on the order of the time it takes to execute each process with the shortest task first.
 In SJF, the duration time of all the tasks needs to be identified in advance while this is not required in FCFS
 The average waiting time is higher in FCFS than in SJF because in FCFS, shorter tasks could be made to wait for longer time if they arrive the CPU late, thereby increasing the overall average wait time. In SJF, the shortest tasks are completed before the longer ones, thereby reducing the average wait time.

FCFS scheduling algorithm

The FCFS algorithm is non preemptive because the algorithm does not permit the release of CPU while the on-going process is in the BLOCKED state but releases the CPU until the current process was completed.

The FCFS scheduling algorithm is fair in that all tasks will definitely get executed and this would be done in the order at which they arrive. Although tasks that arrive early but have long execution time will be done and completed first which keeps those processes with short execution time on hold.
 
The first process is executed first, even though it might have the longest runtime, all other processes have to wait until the process was completed before the next one can start and then the next one. This does not appear very reasonable because those tasks with shorter time should have been allowed to be executed first so that their wait time in the processor would be reduced then the process with the longest execution test can be done last.