849 views
0 votes
0 votes

Suppose one process is running, and another high priority process arrives and lets assume CPU uses preemptive priority scheduling, how does short term scheduler come to know that a high priority process has arrived and it has to preempt the running process and schedule the new process since scheduler itself is a process, how does it run and everything gets managed??

please someone give a clear explanation. Thanx

5 Answers

Best answer
1 votes
1 votes
Well, you cannot use a process to invoke the scheduler process because who would invoke that process, right?

A timer is used to send an interrupt, now its corresponding interrupt handler runs in kernel mode and dispatches the scheduler.

It works just like Round Robin algorithm where the timer interrupts currently running process and the scheduler dispatches the next process from the Ready queue. In our case, the scheduler itself is dispatched by the interrupt handler.
selected by
0 votes
0 votes

i don't remember much but in Os reference book by Andrew Tenunbum i have read somewhere that this is called priority inversion problem in sleep and wait.. Let H be the process with higher priority and L be the process with lower priority scheduling rules are such that H runs whenever its in ready state. At certain moment with L in its critical region H become ready to run but H begins busy waiting L is never schedules while H is running so L never gets the chance to leave CS & H keeps looping forever... 

This is what i have read some where in that book and i have made a note over it but i also have doubts regarding to this expatiation yet... 

0 votes
0 votes
I have not read it any where but I will answer what I have understood. Do not know its right or wrong.
As you said short term scheduler is a process. How can it know if another process with high priority comes....

In round robin we give time quantum...to switch...
Here I assume, at every time unit, it has to check for highest priority process. That is it's job.
0 votes
0 votes
From what I know, the priority of each process is mentioned in its PCB(Process Control Block). Whenever the CPU completes execution of a process (or, TimeQuantum expires), the short term scheduler (STS) is invoked by the CPU. The STS then checks for the process with highest priority in the ready Q. The dispatcher then assigns CPU to the highest priority process. This is how the process works. Please correct me if I am mistaken.

Related questions

0 votes
0 votes
2 answers
2
tusharb asked Apr 6, 2022
576 views
Suppose we have priority-based processes. Which scheduler will replace a low priority process which is presently executing when a high priority process arrives in the rea...
1 votes
1 votes
1 answer
3
atulcse asked Nov 4, 2021
1,010 views
Does FCFS suffer from starvation?
0 votes
0 votes
3 answers
4
manisha11 asked May 7, 2019
1,272 views
In Multi-processing Operating Systems:(a) Maximum utilization of CPU can be achieved(b) Maximum throughput is achieved(c) Maximum security can be achieved(d) Not suitable...