Question

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

  1. What will happen when parent and child in both infinite loop and having only print instruction (no sleep method)
  2. What is the general rule?
Était-ce utile?

La solution

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.

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top