1. What is the best solution to external fragmentation problem?
a. Mutual Exclusion
b. Synchronization
c. Priority Queue
d. Paging
Answer:d. Paging
Paging is the solution to external fragmentation problem which is to permit the logical address space of a process to be non-contiguous, thus allowing a process to be allocating physical memory wherever the latter is available.
2.What is the average waiting time for the following processes with non preemptive SJF (Shortes Job First).
Process Arrival Time Burst Time
P1 0 8
P2 1 4
P3 2 9
P4 3 5
a. 6.5
b. 6.75
c. 7.5
d 7.75
Solution: d. 7.75
Gantt Chart for non-preemptive SJF
P1 | P2 | P3 | P4 |
0 8 12 17 26
Here the average waiting time is 0 + (8-1) + (17-2) + (12 - 3) = 31/4 = 7.75
3. What is the average waiting time for the following processes with preemptive SJF (Shortes Job First).
Process Arrival Time Burst Time
P1 0 8
P2 1 4
P3 2 9
P4 3 5
1. 6.5 2. 6.75 3. 7.5 4. 7.75
Solution: 1. 6.5
Gantt Chart for preemptive SJF
P1 | P2 | P4 | P1 | P3 |
0 1 5 10 17 26
The average waiting time for this example is ((10-1) + (1-1) + (17-2) + (5-3))/4 = 26/4 = 6.5
So, preemptive SJF is better than SJF.
4. Which of the following is the amount of time to execute a particular process ?
a. Throughput
b. Turnaround time
c. Waiting time
d Response time
Answer: b Turnaround time
Turnaround time – amount of time to execute a particular process.
5. Which of the following is the number of processes that complete their execution per time unit?
a. Throughput
b. Turnaround time
c. Waiting time
d. Response time
Answer: a. Throughput
Throughput – number of processes that complete their execution per time unit. Turnaround time – amount of time to execute a particular process. Waiting time – amount of time a process has been waiting in the ready queue. Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment).
6. Consider a system with 12 magnetic tape drivers (TD) and 3 processes (P0,P1 and P2). Suppose that, at time t0, process P0 is holding 5 TD, P1 is holding 2 TD and P2 is holding 2 TD and there are 3 free TDs.
Process Maximum Needs
P0 10
P1 4
P2 9
Provide the sequence which satisfies the safety condition (non-deadlock state).
a. P1, P0, P2
b. P2, P0, P1
c. P1, P2, P0
d. P2, P0, P1
Solution:a. P1, P0,P2
The sequence P1, P0, P2 satisfies the safety condition, since process P1 can immediately be allocated all its TDs and then return them (so 5 available TDs),then P0 can get all its TDs and return them (now 10 available TDs) and finally P2 could get all its TDs and return them.