In this section we look at how the operating system manages the various programs or tasks that need to be run.
A process or task is a portion of a program in some stage of execution. A program can consist of several tasks, each working on their own or as a unit (perhaps periodically communicating with each other).
Each process that runs in an operating system is assigned a process control block that holds information about the process, such as a unique process ID (a number used to identify the process), the saved state of the process, the process priority and where it is located in memory.
The process priority is used to determine how often the process receives processor time. The operating system may run all processes with the same priority, or it may run some processes more often that others. Processes that have been waiting a long time for execution by the processor may have their priority increased so that they will be more likely to be executed in the future.
A process in a computer system may be in one of a number of different possible states, such as
ready - if it can run when the processor becomes freeWhen a running process is interrupted by the processor after completing its allotted time, its state is saved in its process control block, its process state changed to ready and its priority adjusted.
running - it currently has the processor
blocked - it cannot run when the processor becomes free
When a running process accesses an input or output device, or for some reason cannot continue, it is interrupted by the processor, the process state and associated data is saved in the associated process control block. The process state is changed to blocked and the priority adjusted.
When the scheduler decides the next task to run, it changes the process state of the selected process to running and loads the saved data associated with that process back into the processor.
Typically, an operating system will provide a number of program function calls that can be used to control processes. These are similar to those shown below,
block()
wakeup()
suspend()
sleep()
change_priority()
No comments:
Post a Comment
This is Good Computer Information Blog.they will give
best information about computer.