University of Kashan
process | service(Burst) time |
---|---|
\(P_0\) | 3 |
\(P_1\) | 2 |
\(P_2\) | 1 |
\(P_3\) | 2 |
process | service time | arrival time |
---|---|---|
\(P_0\) | 3 | 0 |
\(P_1\) | 2 | 0 |
\(P_2\) | 1 | 3 |
\(P_3\) | 2 | 5 |
prs | st |
---|---|
\(P_0\) | 3 |
\(P_1\) | 2 |
\(P_2\) | 1 |
\(P_3\) | 2 |
pcs | st | at |
---|---|---|
\(P_0\) | 3 | 0 |
\(P_1\) | 2 | 0 |
\(P_2\) | 1 | 3 |
\(P_3\) | 2 | 5 |
process | service time | arrival time |
---|---|---|
\(P_0\) | 2 | 0 |
\(P_1\) | 1 | 0 |
\(P_2\) | 2 | 3 |
\(P_3\) | 1 | 4 |
P0 | P1 | P2 | P3 | |||||
0 | 2 | 3 | 5 | 6 |
process | service time | arrival time |
---|---|---|
\(P_0\) | 2 | 0 |
\(P_1\) | 1 | 0 |
\(P_2\) | 2 | 3 |
\(P_3\) | 1 | 4 |
P0 | P1 | P2 | P3 | |||||
0 | 2 | 3 | 5 | 6 |
process | service time | arrival time |
---|---|---|
\(P_0\) | 4 | 0 |
\(P_1\) | 6 | 0 |
\(P_2\) | 1 | 3 |
\(P_3\) | 3 | 4 |
P0 | P1 | P2 | P3 | |||||
0 | 4 | 10 | 11 | 14 |
Rearange
P0 | P2 | P3 | P1 | |||||
0 | 4 | 5 | 8 | 14 |
process | service time | arrival time |
---|---|---|
\(P_0\) | 6 | 0 |
\(P_1\) | 4 | 0 |
\(P_2\) | 1 | 3 |
\(P_3\) | 3 | 4 |
P1 | P2 | P3 | P0 | |||||
0 | 4 | 5 | 8 | 14 |
process | service time | arrival time |
---|---|---|
\(P_0\) | 4 | 0 |
\(P_1\) | 6 | 0 |
\(P_2\) | 1 | 1 |
\(P_3\) | 3 | 2 |
P0 | P1 | P2 | P3 | |||||
0 | 4 | 10 | 11 | 14 |
P0 | P2 | P0 | P3 | P1 | ||||||
0 | 1 | 2 | 5 | 8 | 14 |
process | service time | arrival time |
---|---|---|
\(p_0\) | 5 | 0 |
\(p_1\) | 3 | 1 |
\(p_2\) | 4 | 2 |
\(p_3\) | 2 | 6 |
t = 0 |
| queue : P1, P2, P3 | ||||||||||
t = 5 |
| queue : P2 P3 |
t = 8 |
| queue : P3 |
HRRN |
| ||||||||||||||||||
SJF |
|
Average Waiting Time
HRRN: \(\frac{0+(5-1)+(8-2)+(12-6)}{4}=\frac{16}{4}=4\)
SJF: \(\frac{0+(5-1)+(8-6)+(10-2)}{4}=\frac{14}{4}=\frac{7}{2}=3.5\)
process | service time | arrival time |
---|---|---|
\(p_0\) | 5 | 0 |
\(p_1\) | 3 | 1 |
\(p_2\) | 4 | 2 |
\(p_3\) | 2 | 6 |
time quantum or q = 2 , | Queue (Q): Empty | ||||||||||||||
t = 0 , Q: P0 |
| ||||||||||||||
t=2, Q: P1(3), P2(4), P0(3) |
| ||||||||||||||
t=4, Q:P2(4), P0(3), P1(1) |
|
t=6, Q: P0(3), P1(1), P3(2), P2(2)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | |||||
0 | 2 | 4 | 6 | 8 |
t=8, Q: P1(1), P3(2), P2(2), P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | ||||||
0 | 2 | 4 | 6 | 8 | 9 |
t=9, Q: P3(2), P2(2), P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(P_3\) | |||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 |
t=11, Q: P2(2), P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | ||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 |
t=13, Q: P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | \(p_0\) | |||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 | 14 |
process | service time | arrival time |
---|---|---|
\(p_0\) | 5 | 0 |
\(p_1\) | 3 | 1 |
\(p_2\) | 4 | 2 |
\(p_3\) | 2 | 6 |
t=11, Q: P2(2), P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | ||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 |
t=13, Q: P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | \(p_0\) | |||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 | 14 |
Average Waiting Time
\(\frac{[0+(6-2)+(13-8)]+[(2-1)+(8-4)]+[(4-2)+(11-6)]+[9-6]}{4}\)
= \(\frac{9+5+7+3}{4} = \frac{24}{4} = 6\)
nice [-20 , 19]
root@computer-name:~# nice --5 geany root@computer-name:~# ps -l root@computer-name:~# top user@computer-name:~# nice -n 8 geany
renice
user@computer-name:~# renice 10 -p 19862 user@computer-name:~# renice -n 15 -p 19862
process | service time | arrival time | Priority |
---|---|---|---|
P0 | 2 | 0 | 4 |
P1 | 3 | 1 | 3 |
P2 | 1 | 2 | 3 |
P3 | 2 | 5 | 1 |
t=0, Q: P0(2,4) |
| ||||||||||
t=2, Q: P1(3,3), P2(1,3) |
|
t=5, Q: P2(1,3), P3(2,1)
P0 | P1 | P3 | ||||
0 | 2 | 5 | 7 |
t=6, Q: P2(1,3)
P0 | P1 | P3 | P2 | |||||
0 | 2 | 5 | 7 | 8 |
process | service time | arrival time | Priority |
---|---|---|---|
P0 | 2 | 0 | 4 |
P1 | 3 | 1 | 3 |
P2 | 1 | 2 | 3 |
P3 | 2 | 5 | 1 |
t=0, Q: P0(2,4) |
| ||||||||||||||
t=1, Q: P1(3,3), P0(1,4) |
| ||||||||||||||
t=4, Q: P0(1,4), P2(1,3) |
|
t=5, Q: P0(1,4), P3(2,1) |
| ||||||||||||||||||||||
t=7, Q: P0(1,4) |
|
process | service time | arrival time | Priority |
---|---|---|---|
P0 | 2 | 0 | 4 |
P1 | 3 | 1 | 3 |
P2 | 1 | 2 | 2 |
P3 | 2 | 5 | 1 |
t=0, Q: P0(2) |
| ||||||||||||||
t=1, Q: P0(1,4), P1(3,3) |
| ||||||||||||||
t=2, Q: P0(1,4), P1(2,3), P2(1,2) |
|
t=3, Q: P0(1,4), P1(2,3) |
| ||||||||||||||||||||||
t=5, Q: P0(1,4), P3(2,1) |
|
t=7, Q: P0(1,4) |
|
process | service time | arrival time |
---|---|---|
\(p_0\) | 5 | 0 |
\(p_1\) | 3 | 1 |
\(p_2\) | 4 | 2 |
\(p_3\) | 2 | 6 |
t=11, Q: P2(2), P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | ||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 |
t=13, Q: P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | \(p_0\) | |||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 | 14 |
Average Waiting Time
\(\frac{(0+(6-2)+(13-8))+((2-1)+(8-4))+((4-2)+(11-6))+(9-6)}{4}\)
= \(\frac{9+5+7+3}{4} = \frac{24}{4} = 6\)
process | service time | arrival time |
---|---|---|
\(P_0\) | 5 | 0 |
\(P_1\) | 3 | 1 |
\(P_2\) | 4 | 2 |
\(P_3\) | 2 | 6 |
t=11, Q: P2(2), P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | ||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 |
t=13, Q: P0(1)
\(P_0\) | \(P_1\) | \(P_2\) | \(P_0\) | \(P_1\) | \(p_3\) | \(p_2\) | \(p_0\) | |||||||||
0 | 2 | 4 | 6 | 8 | 9 | 11 | 13 | 14 |
Average Waiting Time
\(\frac{(0+(6-2)+(13-8))+((2-1)+(8-4))+((4-2)+(11-6))+(9-6)}{4}\)
= \(\frac{9+5+7+3}{4} = \frac{24}{4} = 6\)
- CPU utilization : keep the CPU as busy as possible
- 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)
- Max CPU utilization
- Max throughput
- Min turnaround time
- Min waiting time
- Min response time
END