From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71b19e01eae3a390 X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Context switching (was: delay until and GNAT) Date: 1999/05/10 Message-ID: <3736e102@eeyore.callnetuk.com>#1/1 X-Deja-AN: 476172724 References: <7gpukr$s82$1@nnrp1.dejanews.com> <7grkbb$cee$1@nnrp1.deja.com> <7grvka$lc5$1@nnrp1.deja.com> <7h1e10$drg$1@nnrp1.deja.com> X-Original-NNTP-Posting-Host: da129d133.dialup.callnetuk.com X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: newsabuse@remarq.com X-Trace: 926343362 02H499TBW8004D443C uk25.supernews.com Organization: RemarQ http://www.remarQ.com Newsgroups: comp.lang.ada Date: 1999-05-10T00:00:00+00:00 List-Id: I'd just to add a little note on context switching. [:1:] On some processors, a 'fast' context switch can be achieved in just a few CPU clock cycles (by simply switching register banks), which, on a modern 'RISC' processor, could equate to a mere few picoseconds. In practice, obviously, this is a facility likely to be used only in HRT embedded systems, or for fundamental system software only. [:2:] Many processor architectures today provide built-in support for (normal) context switching, so that the operating system will usually have very little to do with the speed of these context switches. Switches can generally be achieved within a few dozen memory clock cycles (typically out-of-cache), which will be, for most modern microcomputers, in the ballpark of 1 microsecond (+/-1oom). [:3:] Some operating systems (naming no names ;-) are amazingly slow at context switches, taking many thousands of instructions to achieve just one switch. If you can get access to a high-resolution system clock from within a compiled program, you can easily test the performance of a particular system. Try running under different loading conditions: 1 task; 10 tasks; 100 tasks; 1000 tasks. (You may find the 1000 trial goes kerplunk.) Come to think of it, I might write a little Ada program to do this and post it on comp.lang.ada for fun! ------------------------------------- Nick Roberts -------------------------------------