in priority based round robin algorithm, when higher priority process (let's say P1) is arrived during lower priority process (P2) is processing, P2 must be preempted and P1 is processed instead. right?
then what if, after specific time quantum (ex. 10ms)
is P1 keep processed? (since P1 has a higher priority)
or P1 is preempted and scheduler dispatch P2 (because in round robin, after the time quantum, job must be switched)
i think the second thought is right, but book is confusing me. (operating system concepts international ver. exercise 5.8)
thanks a lot
Priority Based Scheduling Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems. Each process is assigned a priority. Process with highest priority is to be executed first and so on.
Round-robin algorithm is a pre-emptive algorithm as the scheduler forces the process out of the CPU once the time quota expires.
Examples of preemptive scheduling are Round Robin and Shortest Remaining Time First. Examples of non-preemptive scheduling are First Come First Serve and Shortest Job First.
You are right, Round Robin is the preemptive approach to FCFS, and FCFS is the non-preemptive approach to Round Robin. Other than that the algorithms have almost everything in common. Though I would still say that Round Robin is distinctly different from FCFS due to its preemptiveness.
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With