From - Wed Oct 29 11:10:23 1997 Path: news.mitre.org!blanket.mitre.org!agate!newsgate.duke.edu!nntprelay.mathworks.com!howland.erols.net!usc!newshub.cts.com!newsfeed.cts.com!cmkrnl!jeh From: jeh@cmkrnl.com (Jamie Hanrahan) Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode Subject: Re: NT scheduler Message-ID: <1997Oct29.073645.8281@cmkrnl> Date: 29 Oct 97 07:36:45 PST References: <636qmn$94i$1@mantra.genesyslab.com> <01bce461$b2cdbe80$026464c0@micronp90> Organization: Kernel Mode Systems, San Diego, CA Lines: 34 In article <01bce461$b2cdbe80$026464c0@micronp90>, "Chuck McCorvey" writes: > WinNT (and Win95) preemptively schedule threads. A processor always runs > the thread that has the highest current priority and threads of equal > priority are scheduled on a round robin basis in time slice increments. Correct so far. > > Note however that the scheduler detects and handles priority inversion and > so a low priority thread holding a resource which is blocking a higher > priority thread is scheduled to run as if it has that higher thread > priority. Ennnhh, not really. Actually detecting priority inversion situations is a non-trivial problem and NT wastes no time on it. Instead, NT simply gives a temporary boost (to priority 15) to threads that have been Ready to run for 4 seconds or more. Thsi special boost lasts for just two quantums (four clock ticks) and then decays back to the previous level in one jump (instead of one level at a time like ordinary boosts). The point here is that it doesn't matter if the thread is really holding a resource that's blocking anything else or not - NT simply tries to make sure that all threads at priority 15 and below get a little bit of time now and then, regardless of priority. Also, since the boost is to 15 (14 prior to NT 4 SP3), this will not interfere with threads in the so-called real-time priority range (16 and above). --- Jamie Hanrahan, Kernel Mode Systems, San Diego CA Internet: jeh@cmkrnl.com (JH645) CompuServe: 74140,2055 drivers, internals, networks, applications, and training for VMS and Windows NT NT driver FAQ, links, and other information: http://www.cmkrnl.com/ If you post a reply in news, please don't e-mail it too.