0
$\begingroup$

I'm reading Operating System Concepts by Silberschatz and in chapter 5, there is this text:
1.

CPU-scheduling decisions may take place under the following four circumstances:

  1. When a process switches from the running state to the waiting state (for example, as the result of an I/O request or an invocation of wait() for the termination of a child process)
  2. When a process switches from the running state to the ready state (for example, when an interrupt occurs)
  3. When a process switches from the waiting state to the ready state (for example, at completion of I/O)
  4. When a process terminates

For situations 1 and 4, there is no choice in terms of scheduling. A new process (if one exists in the ready queue) must be selected for execution. There is a choice, however, for situations 2 and 3.

What does the author mean by choice? Does he mean that in situations 2 and 3, a new process might not be selected for execution when a process switches from the running to the ready state or from waiting to the ready state? Does that mean the CPU becomes idle? Is it preemptive scheduling?

2.

When scheduling takes place only under circumstances 1 and 4, we say that the scheduling scheme is nonpreemptive or cooperative. Otherwise, it is preemptive. [...]Windows 95 introduced preemptivescheduling, and all subsequent versions of Windows operating systems have used preemptive scheduling. The Mac OS X operating system for the Macintosh also uses preemptive scheduling; previous versions of the Macintosh operating system relied on cooperative scheduling.

Does it mean that both newer versions of Windows and Mac OS X do not support situations 1 and 4 above as they are preemptive?

$\endgroup$
2
  • $\begingroup$ do you know about process state transitions and process scheduling? $\endgroup$
    – Rinkesh P
    Commented Nov 21, 2022 at 16:45
  • $\begingroup$ I know about process state transitions but not about process scheduling in depth. $\endgroup$
    – saknemelmo
    Commented Nov 22, 2022 at 2:56

3 Answers 3

1
$\begingroup$

This post answers major part of your question.

Does that mean the CPU becomes idle?

It can, but the chances are extremely slim. The goal of scheduling is to maximise cpu utilization, in modern operating systems, the cpu is almost never "idle"(different from idle). However for arguments sake, the cpu can be considered to be idle when all processes are waiting or there is no process to run.

Does it mean that both newer versions of Windows and Mac OS X do not support situations 1 and 4 above as they are preemptive?

No. The situations merely describe whether the scheduling decision is taken preemptively or non-preemptively. They are not dictating the behavior of the process or scheduling algorithm. In any system all the situations can arise and they all need to be handled by respective schedulers.

$\endgroup$
1
$\begingroup$

Q1. Choice means that there are several candidate processes that could be wakened. So some arbitration rule must exist.

Q2. No, situations 1 and 4 do arise all the time and it is obviously out of question not to "support" them.

Non-preemptive schemes are poor because they let processes monopolize the processor. They are not used anymore.

Interestingly, preemptive OSes existed long before microcomputers, on mainframes and minicomputers, but their adoption by the former took many years.

$\endgroup$
0
$\begingroup$

In condition 1 : CPU can execute only either the child() or wait() which ever is invoked . For 2 and 3 , during an interrupt generally CPU can either serve the interrupt while keeping the current process on postponed ( or wait ) or can continue with current process and later serve the interrupt. in 4 , CPU has no option other than to pick a new process, as the current one is done.

(couldn't comment , less points)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.