This depends. How this is implemented in normal Round Robin, where there is no priority then we should preempt to P2. But this has priority to it, which we do preempt, but to whatever process happens to have the next highest priority (to keep things simple).
Let's assume that it is implemented in this way:
- Processes are only preempted via the time slice of the Round Robin
- Priority will simply be based on the order the processes are executed in RR (to avoid starvation problems)
This may be different than what your book has, for example it may increase the priority of processes based on how long they have been in the queue, then preempt to the current highest (in which may be the same process). But the way I defined above it more focus on the Round Robin fair sharing. In this case P1
is preempted and we move to P2
, the same way normal RR works.
But lets move into a better example say we have P1 (priority = high)
, P2 (priority = low)
, and P3 (priority = med)
. And then enter the queue in the order of: P1, P2, P3. Then from how I defined Priority RR will do this:
P1 -> [high] Notice the priority simply changes the ordering
P3 -> [med] But each still has the same time slice.
P2 -> [low]
P1
P3
P2
Each with a N
time slice. Surely yes it does not seem Priority is playing a big factor here, RR is more focus on. But as the number of process in the ready queue are large (and perhaps the time slice is large), then it will play a bit of a bigger factor.
P1
,P2
,P3
has the same arrival time and their priority is as :P3>P2>P1
. The round robin scheduling order is asP3 -> P2 -> P1 -> P3 -> P2 ->....
I am convinced that this is the logical sequence but my teacher disregards this and claims that the priority will have no effect on round robin scheduling and the order will be asP1->P2->P3->P1...
– Apostatize