At ( t = 2ms ), P3 process has arrived.P2 has 4ms, so as P2 is shorter, P1 is preempted and P2 process starts executing. At this time, P1 (remaining time ) = 5 ms. It’s the only process so CPU starts executing it. The order in which the CPU processes the process are (Gantt Chart) – Let’s understand SJF Scheduling with the help of an example. ![]() Note – If 2 processes have same execution time, then jobs are based on First Come First Serve Basis. The current state of the process is saved by the context switch and the CPU is given to another process.This is the key difference between preemptive and preemptive version of SJF. After the current process finishes, then the new process gets in the queue. ![]()
0 Comments
Leave a Reply. |