Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!dgp.toronto.edu!jonah From: jonah@dgp.toronto.edu (Jeff Lee) Newsgroups: comp.arch Subject: Re: Let's pretend Keywords: Intel, 586, windows Message-ID: <1990Dec18.115605.7411@jarvis.csri.toronto.edu> Date: 18 Dec 90 16:56:06 GMT References: <3042@crdos1.crd.ge.COM> <1990Dec18.082623.16648@kithrup.COM> <1990Dec18.141944.5041@athena.cs.uga.edu> Lines: 29 In article <1990Dec18.141944.5041@athena.cs.uga.edu> is@athena.cs.uga.edu ( Bob Stearns) writes: >While more registers sound like motherhood and apple pie, in the UNIX world >they can be a distinct losing proposition. The commonest service provided by >the kernel is a state switch between processes. The more registers, the longer >this state switch must necessarily take. [...] Sigh. We've been through this before: within reason, saving general purpose registers is typically not the most expensive part of a UNIX context switch. The cost of saving 8, 16, or 32 general purpose registers is often less than the cost of saving other process state information. However, the difference in code optimization with 8, 16, or 32 GP registers is often not insignificant. Thus, up to a point you win more through code optimization than you lose due to slower context switching. The tradeoff point depends on the expected rate of context switches. What *can* be annoying is having to save all registers in every exception handler. Having a separate set of GP registers for each processor mode could turn "traps" and "interrupts" into almost instantaneous co-routine switches. The tricky part might be flushing the pipeline correctly -- I don't know how easily this can be done. My caveat on this is that these additional registers should look just like the normal GP registers so that kernel code can be compiled with the same compiler as user code. Only the context save/restore code should need to access registers in another register bank. The PDP10 used to have different user/system register banks so it can be done. Does anyone have any DATA on how frequently system calls, exceptions, and interrupts (a) occur, and (b) result in context switches?