0

There is not a lot of details available online for this question but was hoping that someone out there might have a clue. I know that its the job of the scheduler to determine (select) the next process to run but how does dispatcher find out ?

David J
  • 15
  • 4
  • When you say "load", do you mean "page in from disk and start" or "resume and let run for next quantum"? I think you are really asking, "how does the OS determine which thread to run on a core once the quantum of the current executing thread has expired?" Is that your actual question? – selbie Feb 02 '21 at 03:08
  • I was about to write up an answer, but there's an even better article here: https://www.microsoftpressstore.com/articles/article.aspx?p=2233328&seqNum=7 – selbie Feb 02 '21 at 03:17
  • @selbie yes exactly how does the dispatcher place a process in a runnable state apparently it does the context switching. The scheduler does the choosing but its the dispatcher that actually loads it's context onto the CPU. – David J Feb 02 '21 at 13:15
  • What you are giving the name "dispatcher" is more likely actually "interrupt routine postamble". During interrupt handling, the CPU saves the previous state aside so that it can restore it afterward. Performing a context switch is conceptually as simple as rewriting that storage, so that the interrupt exit hardware restores to a different state from the one that existed at entry. Of course the details get very complex and very specific to particular architectures and platforms. – Ben Voigt Feb 02 '21 at 22:09
  • The OS scheduler switches between *threads*, not processes. Context-switching is a pure thread-specific operation. Another component tinkers with the priority of a thread, bumping it up to make it more likely to get selected. Takes care of starvation, favoring threads whose I/O operation completed and giving the threads in the process that owns the foreground window more quanta. Probably what you're talking about. "Windows Internals" is a very good book. – Hans Passant Feb 02 '21 at 23:18

0 Answers0