Context Switch OS : How much and How frequent Context Switching is recommended for OS?

726 Views Asked by At

I was asked to answer a question about the OS context switch and I cannot find the answer in my textbook.

How much and How frequent Context Switching is recommended for OS?

2

There are 2 best solutions below

0
Martin James On

There is no answer in yout textbook because no answer can be supplied given the scant info in your question. For preemptive multitaskers such as Windows or Linux, I guess an answer would be 'as frequently as required by the scheduling/dispatching algorithms and the interrupts that drive them'.

0
Timo On

Short and generic answer: As few as possible (since context switches are pure overhead, consuming CPU time, without getting any actual work done) and as many as necessary (to satisfy the user's/application's expectations regarding parallelism, responsiveness, latency, etc.)