Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding multilevel feedback queue scheduling

I'm trying to understand multilevel feedback queue scheduling and I came across the following example from William Stallings Operating Systems Internal and Principles Design (7th ed).

I got this process:

enter image description here

And the result in the book is this: enter image description here

I believe I'm doing the first steps wright but when I get to process E CPU time my next process is B not D as in the book example.

I can't understand if there are n RQ and after each time a process get's CPU time it is demoted to a lower priority time RQ or if, for example, process A is in RQ1 and there are no process at the çower RQ, the process is promoted to that ready queue (this is how I am doing).

Can someone explain me the process how, at the above example, after E is processed, D gets CPU time and them E (and not B) is served?

like image 784
Favolas Avatar asked Feb 15 '26 07:02

Favolas


1 Answers

The multilevel feedback algortihm selects always the first job of the lowest queue (i.e., the queue with the highest priority) that is not empty.

When job E leaves RQ1 (time 9), job D is in queue RT2 but job B in RT3. Thus, B is executed. Please consider the modified figure, where the red numbers give the queue in which the job is executed. run queues

As you can see, job B has already left RT2 at time 9 (more preceisly, it leaves RT2 at time 6), whereas job D has just entered.

like image 60
Matthias Avatar answered Feb 16 '26 21:02

Matthias