Reputation: 5349
I am confused about the process switching between two processes. When a new process is created using fork, what are the general rules applicable for switching between processes. Is it only when one processes goes to idle state? I have few doubts
Upvotes: 0
Views: 289
Reputation: 51
When the quantum expires context switch occurs
When theresource.
When there is a system call triggered ==> not sure. re is an interrupt switching occurs
when another process/thread with higher priority comes in ready state, context switch triggered.
When your thread goes to blocked state by virtue of i/o or awaiting any other thread whcih share's the locked
Upvotes: 0
Reputation: 400079
Most preemptive schedulers will, highly simplified, allocate a certain maximum time to each process.
When that time expires (for instance 10 ms), it will re-schedule so that other processes get some CPU.
If the timer doesn't expire before the process hits some other wait condition (such as doing I/O), it will re-schedule then, instead.
Upvotes: 2