2
$\begingroup$

According to the book " Operating Systems Concepts " , 9th edition, page 207, we have the following statement :

Obviously, a nonpreemptive kernel is essentially free from race conditions on kernel data structures, as only one process is active in the kernel at a time.

My question is, According to the statement, If we have a non-preemptive kernel this means that we will always have one process active in the kernel, this is because the kernel is nonpreemptive ,and hence, the currently running kernel process will leave the CPU by its decision ( like for example after being blocked or terminated), but what if we have multiprocessor system, say with 2 processors, this means that we could have 2 kernel processors accessing the kernel although the kernel is a nonpreemptive one?

$\endgroup$
1
  • $\begingroup$ The kernel would still be non-preemptive but with possible race conditions. In fact, such systems don't exist. $\endgroup$
    – user16034
    Jul 29 at 20:32

1 Answer 1

2
$\begingroup$

By definition, a non-preemptive kernel runs one process at a time, and that process runs until it willingly yields control back to the kernel. Running a non-preemptive kernel on a multi-processor system implies that only one processor runs the kernel and processes, the other processor may be used for other purposes that do not involve the kernel. If one wanted both processors to use the kernel, then a preemptive multi-processor kernel must be used.

$\endgroup$
2
  • $\begingroup$ If I am not mistaken, MacOS is an example of this. There were dual-processor Macs, but the second CPU could only be used by applications explicitly claiming and using it. Photoshop was one such application. $\endgroup$ Jul 28 at 15:38
  • $\begingroup$ The current version of macOS is based on Mach, so it is preemptive. But be careful about the difference between non-preemptive kernels and systems where all system software is run on one CPU. Consider the current generation of games consoles: PS5 and XBox Series S/X. They both have 8 cores, but only 7 are available to games. However, the games can monopolise those 7 CPUs, since system services such as device drivers will not run on those. However, you can still "do" preemptive multitasking on those CPUs if you want. $\endgroup$
    – Pseudonym
    Jul 29 at 3:47

Your Answer

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

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