[rescue] Happy New Year! RIP, Sun/Solaris...
Patrick Giagnocavo
patrick at zill.net
Wed Jan 5 13:04:10 CST 2011
On 1/5/2011 12:11 PM, Peter Corlett wrote:
> On Wed, Jan 05, 2011 at 11:29:36AM -0500, Patrick Giagnocavo wrote:
>> On 1/5/2011 11:06 AM, Peter Corlett wrote:
> [...]
>>> Context switches are extremely expensive operations and best avoided.
>>> Your shiny quad core box takes about the same time as a 6502 to do a
>>> context switch.
>> Source? or simple back of the envelope math showing it?
>
> It was an amusing fact I was told by a low-level hacker, although he was
> specifically referring to interrupt latency.
Certainly it is an interesting thing to read up on:
http://en.wikipedia.org/wiki/MOS_Technology_6502
http://blog.tsunanet.net/2010/11/how-long-does-it-take-to-make-context.html
> Up to a point, you can intuit it. An interrupt or system call involves
> stopping the world on the CPU, flushing the pipeline, storing state, and
> starting again. The Pentium 4 is really bad at this due to the very large
However (see second link) there are many syscalls that at least under
Linux, do not incur the full overhead. Further many OSes use interrupt
coalescing and other techniques to do more work per interrupt.
> There are also benchmarks of dubious reliabilty that you can find on Google.
> However, the general trend I was seeing is that that a no-op syscall
> typically takes a single-digit number of microseconds.
Seems it takes far less, as low as 58ns on the latest CPUs. By
contrast, memory latency on the 6502 was 250-450ns, so there is no way
it could have completed as quickly .
It appears that there is a lot of variability as to results however.
--Patrick
More information about the rescue
mailing list