Consider three processes, all arriving at time zero, with total execution time of , and units, respectively. Each process spends the first of execution time doing I/O, the next of time doing computation, and the last of time doing I/O again. The operating system uses a shortest remaining compute time first scheduling algorithm and schedules a new process either when the running process gets blocked on I/O or when the running process finishes its compute burst. Assume that all I/O operations can be overlapped as much as possible. For what percentage of time does the CPU remain idle?
View worked solution
Answer: B
First, we break down the execution phases for each process based on their total execution times:
- (10 units):
- First I/O: units
- CPU computation: units
- Second I/O: unit
- (20 units):
- First I/O: units
- CPU computation: units
- Second I/O: units
- (30 units):
- First I/O: units
- CPU computation: units
- Second I/O: units
Now, we trace the scheduling timeline using the Shortest Remaining Compute Time First (SRCTF) algorithm:
- to : All three processes are performing their first I/O. The CPU remains idle (2 units).
- At : completes its first I/O and starts its CPU computation (remaining compute = 7).
- At : completes its first I/O (remaining compute = 14). Since has a shorter remaining compute time (), continues.
- At : completes its first I/O (remaining compute = 21). continues.
- At : finishes its CPU computation and starts its second I/O (finishes at ). is scheduled next as its remaining compute time (14) is less than 's (21).
- At : finishes its CPU computation and starts its second I/O (finishes at ). is scheduled.
- At : finishes its CPU computation and starts its second I/O.
- to : performs its second I/O. The CPU remains idle (3 units).
- At : All processes have completely finished.
Calculations:
- Total time of the system = units
- Total CPU idle time = units
- Percentage of CPU idle time =
Free practice · Your answers on this page are not saved.
