I'm looking at a guide to help understand round robin sharing, and it says that process C, out of A through E, will finish at the end of the first 10 minutes...
A, B, C, D, E
run time:
10, 6, 2, 5, 8
Is the reason why C finishes at the end of the first 10 minutes because there's 5 jobs, so each gets an equal 1/5.
And .2 * 10 minutes happens to be 2, which is how long it takes C to run?
Can quantum time change once the process is initiated?
I'm curious about once it gets past process C.
It would be 1/4 * 8, and D is currently sitting on 3.
Take away two minutes, and it still has 1 burst time.
So no new processes finished by minute 18.
Would the new quantum time be 1/4 * 6, which is 1.5, or does it always stay at 2?
#include <iostream>
usingnamespace std;
int main ( ) {
int processes[] = { 10, 6, 2, 5, 8 };
int minute = 0;
bool done = false;
while ( !done ) {
done = true;
for ( int pid = 0 ; pid < 5 ; pid++ ) {
if ( processes[pid] != 0 ) {
done = false;
minute++;
cout << "Process " << char(pid+'A') << " ticks at minute " << minute << endl;
if ( --processes[pid] == 0 ) {
cout << "Process " << char(pid+'A') << " done at minute " << minute << endl;
}
}
}
}
}
Process A ticks at minute 1
Process B ticks at minute 2
Process C ticks at minute 3
Process D ticks at minute 4
Process E ticks at minute 5
Process A ticks at minute 6
Process B ticks at minute 7
Process C ticks at minute 8
Process C done at minute 8
Process D ticks at minute 9
Process E ticks at minute 10
Process A ticks at minute 11
Process B ticks at minute 12
Process D ticks at minute 13
Process E ticks at minute 14
Process A ticks at minute 15
Process B ticks at minute 16
Process D ticks at minute 17
Process E ticks at minute 18
Process A ticks at minute 19
Process B ticks at minute 20
Process D ticks at minute 21
Process D done at minute 21
Process E ticks at minute 22
Process A ticks at minute 23
Process B ticks at minute 24
Process B done at minute 24
Process E ticks at minute 25
Process A ticks at minute 26
Process E ticks at minute 27
Process A ticks at minute 28
Process E ticks at minute 29
Process E done at minute 29
Process A ticks at minute 30
Process A ticks at minute 31
Process A done at minute 31