views:

39

answers:

2

What exactly is happenning when Windows scheduling a thread. What computation resources are involved in process of scheduling itself.

More specific - how many CPU cycles can take rescheduling a runnable thread which just finished its timeslice/quantum for another timeslice/quantum (because there are no other threads for example).

+2  A: 

Might have changed since Win2000 but otherwise there's a free sample chapter from Inside Windows 2000 available on the MS Press site which might be helpful. Chapter 6: Processes, Threads, and Jobs

ho1
A: 

Ok. here is quote from Russinovich latest book: "At each of these junctions [e.g. end of slice], Windows must determine which thread should run next. When Windows selects a new thread to run, it performs a context switch to it. A context switch is the procedure of saving the volatile machine state associated with a running thread, loading another thread’s volatile state, and starting the new thread’s execution."

if anyone knows better it seems to me that there is context switch in the end of timeslice even if there are no other thread.... at least I couldnt find evidence on the contrary...

Bobb