Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!portal!cup.portal.com!bcase From: bcase@cup.portal.com (Brian bcase Case) Newsgroups: comp.arch Subject: Re: RISC v. CISC (was The NeXT problem) Message-ID: <10447@cup.portal.com> Date: 24 Oct 88 19:13:01 GMT Article-I.D.: cup.10447 References: <156@gloom.UUCP> <310@lynx.zyx.SE> <332@pvab.UUCP> Organization: The Portal System (TM) Lines: 40 >The more registers, the more to save at every context switch in a typical >OS (such as UNIX). Which will slow things down if you have many processes >running. >-- >Robert Claeson, ERBE DATA AB, P.O. Box 77, S-175 22 Jarfalla, Sweden What data do you have to substantiate this claim? This is another popular misconception, I think. I used to work at Pyramid Technology. They make a machine with 512 32-bit words of register windows (16, 16, 16 organization). When we were porting UNIX to the machine, we wondered what the register file save/restore on context switch was costing. Turns out that the average save spent 40 usec saving registers. The other 200 usec (this is a guess, I can't remember the total context switch time) were taken by the implementation of the context-switch *menchanism* inherent in UNIX. And this is on top of the fact that some of the critical loops, e.g., the one that decides what process is next to run, were hand coded. Pyramid's UNIX has (at least had) an incredibly fast resopnse. Customers noticed that this was so. Two things: if the memory system and save/restore mechanism are designed with some care, they can go fast, and, except for real-time systems, where save/restore is indeed a critical factor, context-switch time is dominated by everything but the register save/restore. At 200 context-switches per second (unusual max number on a machine like the 780), saving 128 registers on every switch takes, as a percentage of total available processor time,: ((200/sec)*(128 registers)*(2 cycles/register)/(25 Mega cycles/sec) which is 0.20 percent of the total available CPU time. I don't think this is significant. For some implmentations, it is more like 1 cycle per register saved. The other side of the equation is register restore: but on machines with register windows (or work-alikes), only a small number of registers, say 32, need to be restored (since any others will be faulted in). Thus, to total might be 0.30 percent. It is even less on machines with flat files of 32 registers, e.g. MIPS. By speeding up the machine on general code, the registers more than make up for this cost.