Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!novavax!hcx1!steve From: steve@SSD.CSD.HARRIS.COM (Steve Brosky) Newsgroups: comp.realtime Subject: Re: real-time multicomputer systems Message-ID: <4330@hcx1.UUCP> Date: 30 May 90 16:20:32 GMT References: <4329@hcx1.UUCP> Sender: news@hcx1.UUCP Organization: Harris Computer Systems, Fort Lauderdale, FL Lines: 48 >>* fast context switch times -- 40-60 microseconds >This is obviously crucial to real-time response, and seems much faster >than conventional Unix context switching time. How did you get Unix to >context switch so quickly? A lot of effort was put into optimizing context switches. Sorry I can't tell you about some of the more subtle tricks we've used. However I should explain what is meant by this ambiguous term "context switch time". The 40-60 microseconds is the time to: - save the state (registers) of the old process (note that this machine has an enhanced floating point unit so this also includes 8 extra floating point registers) - select the new process - restore the state (VM, registers) of the new process - invalidate the caches This context switch time does not include the time used to decide that a context switch is required. For example, in the case where a process expires its quantum (determined in a clock interrupt routine), the processing time consumed by the clock interrupt is not included in the quoted context switch time. Certain people are more interested in the time it takes to transition from process A to process B when process A takes some action that causes process B to run. There are a number of different primitives available for this on our system that take the form of a system call. The "real-time" primitives take from 170-200 microseconds for this to happen. This time is measured from immediately before process A makes the "wake-up" system call (actually the call to the library interface to the syscall) to immediately after process B returns from the "blocking" system call. This is actual wall time from the last useful instruction in user process A to the first useful instruction in user process B. The 40-60 microsecond context switch is part of this time. Depending on the synchronization method used, these times vary considerably. Signals, for example, are far less efficient than the mechanisms alluded to above. There are other cases where the times are better and approach 100 microseconds for a transition from last user mode instruction to first user mode instruction. Steve Brosky sabrosky@ssd.csd.harris.com Harris Computer Systems Division 2101 W Cypress Creek Rd Fort Lauderdale, Fla 333122