Lists of Long Descriptive type Questions that may be asked in Written Exams.
- (1) Explain Shortest Job First (SJF) scheduling algorithms with illustration.
Question-1 Explain Shortest Job First (SJF) scheduling algorithms with illustration.
The process, that requires shortest time to complete execution, is served first.
Non preemptive: Once a process is selected, it runs until either it is blocked for an I/O or some event, or it is terminated.
This strategy can be implemented by using sorted FIFO queue. All processes in a queue are sorted in ascending order based on their required CPU bursts. When CPU becomes free, a process from the first position in a queue is selected to run.
Consider the following set of four processes. Their arrival time and time required to complete the execution are given in following table. Consider all time values in milliseconds.
|Process||Arrival Time (T0)||Time required for completion (∆T)(CPU Burst Time)|
Initially only process P0 is present and it is allowed to run. But, when P0 completes, all other processes are present. So, process with shortest CPU burst P2 is selected and allowed to run till it completes. Whenever more than one process is available, such type of decision is taken. This procedure us repeated till all process complete their execution
|Process||Arrival Time(T0)||CPU Burst Time(∆T)||Finish Time(T1)||Turnaround Time(TAT=T1-T0)||Waiting Time (WT=TAT-∆T)|
Average Turnaround Time: (10+21+9+11)/4 = 51/4 = 12.75 ms.
Average Waiting Time: (0+15+7+7) / 4 = 29 / 4 = 7.25 ms.
- Less waiting time.
- Good response for short processes.
- It is difficult to estimate time required to complete execution.
- Starvation is possible for long process. Long process may wait forever.
You may be interested in:
Operating System Short Descriptive Questions and Answers
Operating System Multiple Choice Questions Answers (MCQs)
Windows Operating System Online Tests
Linux Operating System Online Tests