Re: context switch time

Larry McVoy (lm@vger.rutgers.edu)
Wed, 15 Apr 1998 14:39:26 -0600


: Could someone knowledged enough please tell me approximately how many
: cycles takes a process context switch on a pentium in Linux?

It depends. If all you want is the 2 process flipping back and forth
number, it is ~5 usecs on a K6@233Mhz and ~9 usecs on P5@120Mhz.
The numbers go up dramatically as the size of the process goes up.
By orders of magnitude. Think about it: if all I am dong is context
switching then most of what I need is in the L2 cache tagged by context id
and I don't go to memory at all. So it becomes a pure CPU speed issue.
But if I'm touching data in each context, then I am throwing the other
guy's data out of the cache and he gets stalled when he sarts up again.

Unfortunately, the latter is far more common than the former.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu