Thanks for all the responses guys!!! All the responses basically offer
the same definition of a context switch. here's a few replies (kinda
Ayoub, Nicky" <Nicky.Ayoub@avnet.com
"A context switch is the actual act of changing from one process to
It involves saving the state of the process at the CPU level ( with it's
register sets...) so that it can be restarted later EXACLTY where it
left off. Then restoring a the register values of the next ready to run
process. As a result the CPU starts executing that next process where it
had been interrupted.
This is a GREATLY simplified explanation but you should be able to find
a better explanation in and Operating Systems text. The Xinu book even
has a sample assembly language sequence to perform a context switch.
Most modern CPU's have support on board to perform this operation as
fast as possible."
Gary Franczyk <firstname.lastname@example.org>
"do a 'man context_switches'.... no... just kidding...
Context switches are used when your processor is multitasking. It is the
process of moving your CPU from working on one process to working on
another process. All of the data and variables are swapped out for the
new process's data and variables. The 'context' or environment that the
CPU is working in is changed to correlate with the new process.
Im not 100% sure about this but multi-threaded applications do not do
context switching in the same way as single threaded ones do. I think
in a multi threaded app, when you switch from one thread to another, you
dont have to do the cs, (they use the same memory) therefore, mt apps
I hope this helps and I hope I am right....
(if anything, Casper Dik will let you know how things work.)
If im wrong, im sure he will let everyone know."
David Thorburn-Gundlach <email@example.com>
A context switch is basically the CPU switching from one process to
another. Lots of context switches can mean that your machine is very
busy or that it is spending too much time thrashing -- switching in and
out -- to get any work done (a bad thing). The CPU can be switched
around in active memory, have different pages paged in from RAM (put
the active pages out in RAM and bring in some inactive pages), or have
pages swapped out to disk. If there aren't many switches, then your
machine is probably either idle or spending most of its time working on
the programs instead of the overhead (a good thing).
I can't think of a good text off the top of my head, but the Red Book
(formerly the Beige Book), The UNIX Systems Administration Handbook,
by Snyder, Nemeth, Seebass, and someone else, is a good general text."
Jason L. Harrell UNIX System Administrator John Steffen Associates St. Louis, MO 63146 firstname.lastname@example.org
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:12 CDT