A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2003-04-15 08:46 AM

Registered: 2002-08-01
Posts: 191

Re: swich consumed time

what all do system between swich thread to another? How is it efective?

push registers to stack and load new registers , change memory adress and this is all? How much can be thread swuched in one second?


#2 2003-04-19 12:31 AM

From: Sol 3
Registered: 2002-06-12
Posts: 911

Re: swich consumed time

The basics most systems do are save the current registers and load the ones appropriate for the new / next thread...  since the code and stack pointers are held in registers that takes care of them also...  so at the very basic level, its very simple and fast...

Notice I said basic level... the reason is that there is a LOT more to that potentially needs handling when doing a thread switch...  loading and checking states for mutexes, signal vars, barriers and so forth...  loading or pointing to information (priority etc.) which will be used to determine how long the thread will run and who can interrupt it... and so on and so on...

I know I am being a bit vague with my answer but... the other fact of the matter is that except for generalities, the exact operations required vary from implementation to implementation...


"The only difference between me and a madman is that I'm not mad."

Salvador Dali (1904-1989)


Board footer

Powered by FluxBB