Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!turnkey!jackv From: jackv@turnkey.tcc.com (Jack F. Vogel) Newsgroups: comp.unix.internals Subject: Re: Nice Message-ID: <1991Jan31.180957.9167@turnkey.tcc.com> Date: 31 Jan 91 18:09:57 GMT References: <1991Jan22.184055.3641@demott.com> <2004@necisa.ho.necisa.oz.au> Reply-To: jackv@turnkey.TCC.COM (System Administrator) Organization: Turnkey Computer Consultants, Westchester, CA Lines: 36 In article <2004@necisa.ho.necisa.oz.au> boyd@necisa.ho.necisa.oz.au (Boyd Roberts) writes: >In article richard@locus.com (Richard M. Mathews) writes: >>... In many (most?) versions of Unix if an interrupt >>makes a process runnable at a higher priority than the running process, >>a context switch will be forced immediately. >No, UNIX does not have pre-emptive scheduling. When the above event occurs >the kernel context switches at the next user-mode trap, system call, sleep() >or the once-a-second context switch (time quantum expiry). I think you are nit-picking at Richard's choice of words here. When he said "immediately" it was in a loose sort of sense, not suggesting some sort of preemption at that instruction. But it is also not correct that a context switch will take as long as you suggest. What will happen is that the interrupt will cause the kernel to run in trap(), there it will do whatever serving needs to be done, lets say an event occured that another process was sleeping on, this will cause that process to be put back in the run queues, and runrun will be set true, then at the exit of trap there is a test of runrun and as it will be true a context switch will take place right then. No need for another system call, sleep(), or whatever. >.... A higher priority process being made runnable doesn't >_force_ the current process to give up the CPU, it gives it up when it >notices that it has to. Now you talk as though there is no such thing as "preemption" at all, the running process is "forced" to give up the CPU whenever an involuntary context switch takes place. Perhaps its just a semantic preference to say "it notices that it has to" :-}. Disclaimer: I don't speak for LCC. -- Jack F. Vogel jackv@locus.com AIX370 Technical Support - or - Locus Computing Corp. jackv@turnkey.TCC.COM