In my Operating Systems class I have an exercise to sketch out how a round-robin algorithm would apply to a specific scenario, which is the following:
Now the correction that I was provided with by the lecturer is the following:
But I do not understand how this is correct. After referring to the lecture that was given on this specific topic, I understood that Round-Robin maintains a queue with threads and each thread has a time quantum of tens of milliseconds of CPU time. When a thread has exhausted its time quantum CPU time it goes straight to the end of the queue. I also know that, threads that do not full use their time quantum CPU time, will be put in a separated queue, resulting in multilevel queue. After my understanding, this last part is ignored here. Here is the resolution of the exercise that I came up with:
The "-" stand for executing time, the "v^v^v" stands for blocking time, pretty much like in the correction picture. Note that my version, and the version of the correction match up until the 1st pink dashed line.
Finally, the question is: How come that after the 1st pink dashed line, A is assigned to the CPU? (in the correction version), instead of B, which is, after my understanding, the next process in the queue to be executed(See "Ready queue") in my version of the exercise.
Please note that there are priorities, but according to the definition of round-robin fashion, priorities are not considered for it(I know that in most OSs the plain vanilla round-robin is not applied, but please ignore that); priorities are there for other parts of the exercise which have nothing to do with this issue.