Operating System Fundamentals 32
Switch Prevention There maybe situations where a process is in the middle of doing something really important and it would like to ensure that no other process is allowed to run in the meantime. There are two mechanisms that are typically available disabling the scheduler and disabling interrupts. By disabling the scheduler the process is requesting to the operating system
that even if the timer fires, the process would like the operating system to skip the selection of anew process. In the case of disabling interrupts, the program is actually asking the CPU to ignore any interrupts that occur. Both of these techniques have the ability to seriously hinder the functionality of the computer. As such, most operating systems will refuse to comply with such requests unless the programs doing the request have enough privileges. However, some parts of the operating system itself are very vulnerable to interruption and the operating system itself is allowed to prevent switching and even interrupts if required. How privileges are enforced is a topic for later discussion. Process Creation The actual creation of anew process on a computer is very specific to the operating system itself and is often tied very closely to the hardware. We will attempt to describe the creation of processes in a high level view. Most operating systems utilize a process table to track all of the processes currently residing on the system. The creation of anew process will usually require anew entry to be created within the process table. During
the addition of the new entry, the table needs to be locked or switching needs to be prevented so that the full details can be added without interruption. Marking the state as New is only part of the problem. The table itself might have issues if the scheduler sees it partially updated. In addition to the process table entry, most operating systems keep information about the process in a separate space called the process information block (although this can be viewed as part of the process table. The space for this process information block needs to beset aside as part of the process creation step. Each process will be executing some code. Part of the process creation step will be to set aside
enough memory for the code, and then possibly load the code from the executable (some operating systems work a little differently as explained next.
Share with your friends: