Operating System Fundamentals


Figure 3.4 A state machine with a blocked state



Download 2.34 Mb.
View original pdf
Page22/66
Date06.03.2023
Size2.34 Mb.
#60834
1   ...   18   19   20   21   22   23   24   25   ...   66
OperatingSystemFundamentals
best answers from c, Lesson 2 C# Windows Forms
Figure 3.4
A state machine with a blocked state
In this model, a process can never become blocked unless it is actually running. Once a process has been put into the blocked state, it must eventually be unblocked or released and put back into the Ready state before it can run again. How does the operating system manage these extra state changes As mentioned in the earlier sections of the book, the operating system is responsible for managing all system resources including IO devices. In the case of waiting for the user to press a key, the program actually issues a request to the operating system (through a function call) asking to wait fora key. In response, the operating system changes the state of the process to blocked and runs the scheduler algorithm to find anew process to run.

Operating System Fundamentals
31 How does the process get out of the blocked state Each IO device has its own mechanism that it uses to interact with the operating system. We will consider just the keyboard example here. During boot up, the operating system has probably attached a service routine to the keyboard interrupt. Each time that the user presses a key, it generates an interrupt which causes the operating system routine to generate a key event and the scheduler routine will be called. The scheduler will then look through all of the blocked processes waiting for key events and the state will be changed from blocked to ready. Whether this keyboard interrupt causes the currently running process to be moved from Running to Ready depends on the operating system itself. If you were to examine the states of processes on most computers, you will probably find that just about every process on the system is blocked most of the time. Having a lot of blocked processes is a good thing. This means that the CPU is not actually being used for any useful work. Normally when a CPU does works it consumes power, while if it is not doing work it can be put into a low power state. Tricks such as these are used in mobile devices such as phones in order to extend the life of the battery. A process that is actively using the CPU will consume more power, which is why batteries do not last as long when you are watching videos on your mobile phone than when you are simply on standby waiting for calls.

Download 2.34 Mb.

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




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

    Main page