Subjects operating systems

Process Scheduling

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Search Solutions

Process Scheduling


1. Task 1: Five batch jobs with running times and priorities: Jobs A-E with times: A=11, B=6, C=2, D=4, E=8 minutes. Priorities: A=3, B=5, C=2, D=1, E=4 (5 is highest). 2. (a) Round-robin (multi-programmed, equal time slices): Each job alternates until done. Using times 11, 6, 2, 4, 8: Total time = sum = 11+6+2+4+8 = 31 minutes. Each job gets CPU every cycle; turnaround is total elapsed time when each job ends. Calculate finish times stepwise: - C (2) finishes after 6 cycles (its remaining 2 done in 2 slots). - Then D (4) finishes after 14 cycles. - Then B (6) after 21 cycles. - Then E (8) after 29 cycles. - Then A (11) after 31 cycles. Turnaround times (finish time since arrival=0): A=31, B=21, C=6, D=14, E=29 Mean turnaround time = (31+21+6+14+29)/5 = 101/5 = 20.2 3. (b) Priority scheduling (non-preemptive, highest priority first): Priorities ranked: B(5), E(4), A(3), C(2), D(1). Order: B(6), E(8), A(11), C(2), D(4) Turnaround times as completion minus arrival zero: B=6, E=6+8=14, A=14+11=25, C=25+2=27, D=27+4=31 Mean turnaround = (6+14+25+27+31)/5 = 103/5 = 20.6 4. (c) First-come, first-served (order 11,6,2,4,8): Running cumulative sums: A=11, B=11+6=17, C=17+2=19, D=19+4=23, E=23+8=31 Mean turnaround = (11+17+19+23+31)/5 = 101/5 = 20.2 5. (d) Shortest job first: Jobs sorted by time: C(2), D(4), B(6), E(8), A(11) Turnaround times: C=2, D=2+4=6, B=6+6=12, E=12+8=20, A=20+11=31 Mean turnaround = (2+6+12+20+31)/5 = 71/5 = 14.2 --- 6. Task 2: Processes with arrival time, CPU time, and priority: P3(0,7,1), P2(2,8,3), P1(3,6,2), P4(5,3,2). 7. Non-preemptive priority scheduling (lowest priority value runs first), when CPU is free and process arrives. 8. Stepwise scheduling: - At time 0, only P3 arrived, runs from 0 to 7. - At 7, P1(3), P2(2), P4(2) arrived. Priority order lowest first: P1=2, P4=2, P2=3. Since P1 and P4 tie, pick earliest arrival: P1 (arrived 3) before P4 (5). - P1 runs 7 to 13 (7+6). - Then P4 runs 13 to 16. - Finally P2 runs 16 to 24. 9. Calculate waiting time (start time - arrival time) and turnaround time (finish - arrival): P3: waiting = 0-0=0, turnaround = 7-0=7 P1: waiting = 7-3=4, turnaround = 13-3=10 P4: waiting = 13-5=8, turnaround=16-5=11 P2: waiting=16-2=14, turnaround=24-2=22 10. Average waiting time = (0+4+8+14)/4=26/4=6.5 Average turnaround = (7+10+11+22)/4=50/4=12.5