on (2025-12-07 06:14:54) Comments : Step 1: Calculate SJF Switches The Shortest Job First (SJF) scheduling is non-preemptive in this context. Processes are run in the order of their arrival and shortest burst time when the CPU is free. The execution sequence is P1, P6, P7, P4, P5, P3, P2.The number of context switches is the number of times a new process is loaded for execution. This includes the initial load of the first process, P1.The total number of processes executed sequentially is 7.The number of switches is 7.The context switching overhead is calculated as Switches×Overhead per switch Overhead = 7*1 units = 7 units.
Step 2: Calculate SRTF Switches The Shortest Remaining Time First (SRTF) scheduling is preemptive. Processes are switched whenever a new process arrives with a shorter remaining burst time than the currently executing process. The sequence of CPU usage involves multiple preemptions and resumptions.The context switches occur at the following times: Initial load of P1 (time 0)P1 to P2 preemption (time 1)P2 to P4 preemption (time 3)P4 to P6 preemption (time 4)P6 finish, P4 resume (time 5)P4 finish, P7 start (time 7)P7 finish, P2 resume (time 9)P2 finish, P5 start (time 13)P5 finish, P3 start (time 17)P3 finish, P1 resume (time 22) The total number of context switches is 10.The context switching overhead is calculated as Switches×Overhead per switch Overhead = 10*1 units = 10 units.
Rakhi on (2021-09-08 06:17:57) Comments : What's the solution for this question
You must be logged in to post a comment.