Operating System Fundamentals



Download 2.34 Mb.
View original pdf
Page23/66
Date06.03.2023
Size2.34 Mb.
#60834
1   ...   19   20   21   22   23   24   25   26   ...   66
OperatingSystemFundamentals
best answers from c, Lesson 2 C# Windows Forms
A Typical State Model
There are two additional states that most operating systems include in addition to the Ready, Running, and Blocked states. These two extra states are used for housekeeping, and only exist fora short amount of time during the creation and the removal of processes. When anew process is created there needs to be anew entry placed into the process table. Setting the process table entry actually takes a bit of time. If the new process was marked as Ready and the operating system was in the middle of initializing the other columns in the process table, and suddenly a reschedule operating occurred, how would the operating system know that it should not select this new process We control this by the introduction of a ‗New‘ state. This is simply a placeholder that is used by the operating system until the process is actually ready to start going. Similarly there is an ‗Exit‘ state that is used when a process is being cleaned up. This state is also temporary, and the operating system will mark the process first then remove it from the process table. Running dispatched interrupted
Ready
Blocked wait
Event complete
New
Exit terminate created

Figure 3.5
A typical state machine

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.

Download 2.34 Mb.

Share with your friends:
1   ...   19   20   21   22   23   24   25   26   ...   66




The database is protected by copyright ©ininet.org 2024
send message

    Main page