Operating systems miscellaneous
- An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):
The average waiting time (in milliseconds) of the processes is _________.
-
View Hint View Answer Discuss in Forum
The Gantt chart for SRTF scheduling algorithm is :
Average waiting time = 15 + 0 + 3 + 4 = 22 = 5.5 4 4 Correct Option: A
The Gantt chart for SRTF scheduling algorithm is :
Average waiting time = 15 + 0 + 3 + 4 = 22 = 5.5 4 4
- Three processes A, B and C each execute a loop of 100 iterations. In each iteration of the loop, a process performs a single computation that requires tC CPU milliseconds and then initiates a single I/O operation that lasts for tio milliseconds. It is assumed that the computer where the processes execute has sufficient number of I/O devices and the OS of the computer assigns different I/O devices to each process. Also, the scheduling overhead of the OS is negligible. The processes have the following characteristics :
Process id tc tio A 100 ms 500 ms B 350 ms 500 ms C 200 ms 500 ms
The processes A, B, and C are started at times 0, 5 and 10 milliseconds respectively, in a pure time sharing system (round robin scheduling) that uses a time slice of 50 milliseconds. The time in milliseconds at which process C would complete its first I/O operation is ___________.
-
View Hint View Answer Discuss in Forum
The Gantt chart for Round robin algorithm for the first iteration execution for each of the 3 processes is as follows :
After finishing tc CPU ms at time 500ms, C goes for I/O operation, that needs 500ms more, so the time at which process C would complete its first I/O operations is 500 + 500 = 1000 msCorrect Option: C
The Gantt chart for Round robin algorithm for the first iteration execution for each of the 3 processes is as follows :
After finishing tc CPU ms at time 500ms, C goes for I/O operation, that needs 500ms more, so the time at which process C would complete its first I/O operations is 500 + 500 = 1000 ms
- Consider the following set of processes that need to be scheduled on a single CPU. All the times are given in milliseconds.
Using the shortest remaining time first scheduling algorithm, the average process turnaround time (in msec) is ____________________.
-
View Hint View Answer Discuss in Forum
As we know, in the shortest remaining time first algorithm, at a given time t, process p is scheduled if its remaining execution time is minimum among all processes. (Note that this algo is applicable only when all processes declare their execution time in advance before they begin).
Now the Gantt chart for the given processes is as follows:
The first column of the table indicates the running time. Each entry in the table indicates the remaining execution time of that process at that time. Here a ‘–’ indicates that a process has not arrived and a ‘zero’ indicates that the process has finished. The last column indicates the process selected for execution that has shortest remaining execution time; these are marked with red circles. Using the Gantt chart, the arrival time, termination time and turnaroud time of different processes is as follows :Process Arrival Time Termination Time Turnaround Time (m sec) A 0 8 8 B 3 5 2 C 5 12 7 D 7 21 14 E 10 15 5
Total turnaround item of all processes = 36 m sec.Average turnaround time = 36 = 7.2 m sec. 5 Correct Option: A
As we know, in the shortest remaining time first algorithm, at a given time t, process p is scheduled if its remaining execution time is minimum among all processes. (Note that this algo is applicable only when all processes declare their execution time in advance before they begin).
Now the Gantt chart for the given processes is as follows:
The first column of the table indicates the running time. Each entry in the table indicates the remaining execution time of that process at that time. Here a ‘–’ indicates that a process has not arrived and a ‘zero’ indicates that the process has finished. The last column indicates the process selected for execution that has shortest remaining execution time; these are marked with red circles. Using the Gantt chart, the arrival time, termination time and turnaroud time of different processes is as follows :Process Arrival Time Termination Time Turnaround Time (m sec) A 0 8 8 B 3 5 2 C 5 12 7 D 7 21 14 E 10 15 5
Total turnaround item of all processes = 36 m sec.Average turnaround time = 36 = 7.2 m sec. 5
- Suppose a disk has 201 cylinders, numbered from 0 to 200. At some time the disk arm is at cylinder 100, and there is a queue of disk access requests for cylinders 30, 85, 90, 100, 105, 110, 135 and 145. If Shortest-Seek Time First (SSTF) is being used for scheduling the disk access, the request for cylinder 90 is serviced after servicing ____________ number of requests.
-
View Hint View Answer Discuss in Forum
Remember that in SSTF algo the request with shortest seek fine from “current Head Position” is serviced first. We prepare the following table:
Initially Head is of 100, so it services Request for 100 itself. Then 105 is serviced because it is nearest to 100. Now as head is at 105, Request for ‘110’ is serviced as it is nearer than 90. Finally as head is on 110, out of two nearest requests viz. 90 & 135, ‘90’ is serviced since it is nearer than “135”. 80, ‘90’ is serviced after servicing 3 Requests.Correct Option: C
Remember that in SSTF algo the request with shortest seek fine from “current Head Position” is serviced first. We prepare the following table:
Initially Head is of 100, so it services Request for 100 itself. Then 105 is serviced because it is nearest to 100. Now as head is at 105, Request for ‘110’ is serviced as it is nearer than 90. Finally as head is on 110, out of two nearest requests viz. 90 & 135, ‘90’ is serviced since it is nearer than “135”. 80, ‘90’ is serviced after servicing 3 Requests.
- For the processes listed in the following table, which of the following scheduling schemes will give the lowest average turnaround time?
-
View Hint View Answer Discuss in Forum
Correct Option: C