9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] preemptive scheduling?
@ 2004-12-16 19:32 Tim Newsham
  2004-12-16 19:38 ` Russ Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Newsham @ 2004-12-16 19:32 UTC (permalink / raw)
  To: 9fans

Hi,
    I'm reading through the scheduler and I dont quite understand
how preemption works.  The timerintr function will periodically
(once per HZ) call hzclock() which will call hzsched(), but as
far as I can tell, hzsched() wont actually perform a context switch.
Any other interrupt will cause preempted() to be called which may
cause a context switch.  What happens if the only interrupts
coming in are timer interrupts, and there are several runable
processes that aren't making any system calls?  How do they get
preempted?

Tim N.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] preemptive scheduling?
  2004-12-16 19:32 [9fans] preemptive scheduling? Tim Newsham
@ 2004-12-16 19:38 ` Russ Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2004-12-16 19:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hzsched sets up->delaysched if a sched should happen soon.
/sys/src/9/pc/trap.c:/^trap will check up->delaysched and call
sched on its way out of the interrupt handler and call sched
rather than go back to the running process.

As it was in the beginning, so it is now.

Russ



On Thu, 16 Dec 2004 09:32:13 -1000 (HST), Tim Newsham <newsham@lava.net> wrote:
> Hi,
>     I'm reading through the scheduler and I dont quite understand
> how preemption works.  The timerintr function will periodically
> (once per HZ) call hzclock() which will call hzsched(), but as
> far as I can tell, hzsched() wont actually perform a context switch.
> Any other interrupt will cause preempted() to be called which may
> cause a context switch.  What happens if the only interrupts
> coming in are timer interrupts, and there are several runable
> processes that aren't making any system calls?  How do they get
> preempted?
> 
> Tim N.
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-16 19:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-16 19:32 [9fans] preemptive scheduling? Tim Newsham
2004-12-16 19:38 ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).