Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Given the scenario in the table, we will determine the behavior of the different
scheduling algorithms.
Scenario:
Job ID 1 2 3 4 5
Arrival time 0 1 2 3 4
Service time 10 1 2 1 5
Priority 7 10 5 5 9
FCFS: _________________________________________
| 1 |2 | 3 |4 | 5 |
|___________________|__|____|__|_________|
0 10 11 13 14 19
RR: ________________________________________________
| 1|2 |3 |4 |5 |1 |3 |5 |1 |5 |1 |5 |1 |5 | 1 |
|__|__|__|__|__|__|__|__|__|__|__|__|__|__|_____|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 19
SJF: _________________________________________
(non-pre) | 1 |2 |4 | 3 | 5 |
|___________________|__|__|____|_________|
0 10 11 12 14 19
SJF(pre-emp):
________________________________________
|1 |2 | 3 |4 | 5 | 1 |
|__|__|___|__|_________|________________|
0 1 2 4 5 10 19
_________________________________________
| 1 |2 | 5 | 3 |4 |
|___________________|__|__________|____|__|
0 10 11 16 18 19
b) Turnaround Time
FCFS: 10,10,11,11,15
RR : 19,1,5,1,10
NPSJF: 10,10,12,9,15
PSJF: 19,1,2,2,6
NPPS: 10,10,16,16,12
PPS : 16,1,16,16,5
c) Wait Time
FCFS : 0,9,9,10,10
RR : 9,0,3,0,5
NPSJF : 0,9,10,8,10
PSJF : 9,0,0,1,1
NPPS : 0,9,14,15,7
PPS : 6,0,14,15,0
3. Suppose not all the processes are always in the main memory and the ready
processes may be swapped in and out of the memory. Think of a 2-level
scheduling algorithm where the processes in level-1 are in memory and the
processes in Level-2 are in secondary storage.
4. Which is the optimal algorithm for the minimal average turnaround time? Why?
5. Consider five jobs, A through E, with run times of 2, 4, 1, 1, and 1
respectively. Their arrival times are 0, 0, 3,3, and 3. Is the SJF the
optimal algorithm?
6. How would you design a scheduling algorithm to guarantee that each user will
get 1/n-th time assuming there are n users in the system.