Q1. Assume you have the following jobs to execute with one processor :
Answer : -
First Come First Serve (FCFS)
Waiting Time = Starting Time - Arivel Time
Turnaround Time = Waiting Time + Execution Time
Process | Processing Time | Waiting Time | Turnaround Time |
---|
P1 | 10 | 0 | (0 + 10) = 10 |
P2 | 09 | (0 + 10) = 10 | (10 + 9) = 19 |
P3 | 02 | (0 + 19) = 19 | (19 + 2) = 21 |
P4 | 03 | (0 + 21) = 21 | (21 + 3) = 24 |
P5 | 11 | (0 + 24) = 24 | (24 + 11) = 35 |
Average Waiting Time = (0 + 10 + 19 + 21 + 24) / 5 = 14.8
Average Turnaround Time = (10 + 19 + 21 + 24 + 35) / 5 = 21.8
Gantt Chart of FCFS
Execute Time | Running Process | Process Queue | Description |
---|
0 | | | All Processes are arrives at the same time and "P1" gets processed |
10 | | | "P1" gets completed, so "P2" gets processed |
19 | | | "P2" gets completed, so "P3" gets processed |
21 | | | "P3" gets completed, so "P4" gets processed |
24 | | - | "P4" gets completed, so "P5" gets processed |
35 | - | - | "P5" gets completed |
Shortest Job First (SJF)
Process | Processing Time | Waiting Time | Turnaround Time |
---|
P3 | 02 | 0 | (0 + 2) = 2 |
P4 | 03 | (0 + 2) = 2 | (2 + 3) = 5 |
P2 | 09 | (0 + 5) = 5 | (5 + 9) = 14 |
P1 | 10 | (0 + 14) = 14 | (14 + 10) = 24 |
P5 | 11 | (0 + 24) = 24 | (24 + 11) = 35 |
Average Waiting Time = (0 + 2 + 5 + 14 + 24) / 5 = 9
Average Turnaround Time = (2 + 5 + 14 + 24 + 35) / 5 = 16
Gantt Chart of SJF
Execute Time | Running Process | Process Queue | Description |
---|
0 | | | All Processes are arrives at the same time and "P3" gets processed |
2 | | | "P3" gets completed, so "P4" gets processed |
5 | | | "P4" gets completed, so "P2" gets processed |
14 | | | "P2" gets completed, so "P1" gets processed |
24 | | - | "P1" gets completed, so "P5" gets processed |
35 | - | - | "P5" gets completed |
Round Robin (RR)
Process | Processing Time | Waiting Time | Turnaround Time |
---|
P1 | 10 | 21 | (21 + 10) = 31 |
P2 | 09 | 23 | (23 + 9) = 32 |
P3 | 02 | 4 | (4 + 2) = 6 |
P4 | 03 | 12 | (12 + 3) = 15 |
P5 | 11 | 24 | (24 + 11) = 35 |
Average Waiting Time = (21 + 23 + 4 + 12 + 24) / 5 = 16.8
Average Turnaround Time = (31 + 32 + 6 + 15 + 35) / 5 = 23.8
Gantt Chart of RR
Execute Time | Running Process | Process Queue | Description |
---|
0 | | | All Processes are arrives at the same time and "P3" gets processed |
2 | | | Quantum time expires, so "P1" is forced out of CPU and "P2" gets processed |
4 | | | Quantum time expires, so "P2" is forced out of CPU and "P3" gets processed |
6 | | | "P3" gets completed, so "P4" gets processed |
8 | | | Quantum time expires, so "P4" is forced out of CPU and "P5" gets processed |
10 | | | Quantum time expires, so "P5" is forced out of CPU and "P1" gets processed |
12 | | | Quantum time expires, so "P1" is forced out of CPU and "P2" gets processed |
14 | | | Quantum time expires, so "P2" is forced out of CPU and "P4" gets processed |
15 | | | "P4" gets completed, so "P5" gets processed |
17 | | | Quantum time expires, so "P5" is forced out of CPU and "P1" gets processed |
19 | | | Quantum time expires, so "P1" is forced out of CPU and "P2" gets processed |
21 | | | Quantum time expires, so "P2" is forced out of CPU and "P5" gets processed |
23 | | | Quantum time expires, so "P5" is forced out of CPU and "P1" gets processed |
25 | | | Quantum time expires, so "P1" is forced out of CPU and "P2" gets processed |
27 | | | Quantum time expires, so "P2" is forced out of CPU and "P5" gets processed |
29 | | | Quantum time expires, so "P5" is forced out of CPU and "P1" gets processed |
31 | | | "P1" gets completed, so "P2" gets processed |
32 | | - | "P2" gets completed, so "P5" gets processed |
34 | | - | As there is no process in the queue, so "P5" gets processed |
35 | - | - | "P5" gets completed |
Shortest Remaining Time Next (SRTN)
Process | Processing Time | Waiting Time | Turnaround Time |
---|
P3 | 02 | 0 | (0 + 2) = 2 |
P4 | 03 | (0 + 2) = 2 | (2 + 3) = 5 |
P2 | 09 | (0 + 5) = 5 | (5 + 9) = 14 |
P1 | 10 | (0 + 14) = 14 | (14 + 10) = 24 |
P5 | 11 | (0 + 24) = 24 | (24 + 11) = 35 |
Average Waiting Time = (0 + 2 + 5 + 14 + 24) / 5 = 9
Average Turnaround Time = (2 + 5 + 14 + 24 + 35) / 5 = 16
Gantt Chart of SRTN
Execute Time | Running Process | Process Queue | Description |
---|
0 | | | All Processes are arrives at the same time and "P3" gets processed |
2 | | | "P3" gets completed, so "P4" gets processed |
5 | | | "P4" gets completed, so "P2" gets processed |
14 | | | "P2" gets completed, so "P1" gets processed |
24 | | - | "P1" gets completed, so "P5" gets processed |
35 | - | - | "P5" gets completed |
Answer : - Coming Soon
Answer : - Coming Soon
Answer : - Coming Soon
Answer : - File systems must be accessed in an efficient manner, especially with hard drives, which are the slowest part of a computer. As a computer deals with multiple processes over a period of time, a list of requests to access the disk builds up. For efficiency purposes, all requests (from all processes) are aggregated together. The technique that the operating system uses to determine which requests to satisfy first is called disk scheduling.
C-SCAN Disk Scheduling
In C-SCAN algorithm, the arm of the disk moves in a particular direction servicing requests until it reaches the last cylinder, then it jumps to the last cylinder of the opposite direction without servicing any request then it turns back and start moving in that direction servicing the remaining requests.
Example
Consider the following disk request sequence for a disk with 200 tracks
65, 48, 39, 08, 99, 164, 152, 38, 124
Answer : - Solve it Yourself
FCFS Disk Scheduling Example → Question 3
Answer : - MCS-041 Assignment 2018-19 → Question 5
Answer : - Coming Soon