首页 > 代码库 > PROCESS STATES
PROCESS STATES
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION
To understand the operation of the short-term scheduler, we
need to consider the concept of a process state. During the lifetime of a process,
its status will change a number of times. Its status at any point in time is referred to
as a state. The term state is used because it connotes that certain information exists
that defines the status at that point. At minimum, there are five defined states for a
process (Figure 8.7):
? New: A program is admitted by the high-level scheduler but is not yet ready
to execute. The OS will initialize the process, moving it to the ready state.
? Ready: The process is ready to execute and is awaiting access to the processor.
? Running: The process is being executed by the processor.
? Waiting: The process is suspended from execution waiting for some system
resource, such as I/O.
? Halted: The process has terminated and will be destroyed by the OS.
For each process in the system, the OS must maintain information indicat-
ing the state of the process and other information necessary for process execution.
For this purpose, each process is represented in the OS by a process control block
(Figure 8.8), which typically contains
? Identifier: Each current process has a unique identifier.
? State: The current state of the process (new, ready, and so on).
? Priority: Relative priority level.
? Program counter: The address of the next instruction in the program to be
executed.
? Memory pointers: The starting and ending locations of the process in memory.
? Context data: These are data that are present in registers in the processor
while the process is executing, and they will be discussed in Part Three. For
now, it is enough to say that these data represent the “context” of the process.
The context data plus the program counter are saved when the process leaves
the running state. They are retrieved by the processor when it resumes execu-
tion of the process.
? I/O status information: Includes outstanding I/O requests, I/O devices (e.g., tape
drives) assigned to this process, a list of files assigned to the process, and so on.
? Accounting information: May include the amount of processor time and clock
time used, time limits, account numbers, and so on.
When the scheduler accepts a new job or user request for execution, it creates
a blank process control block and places the associated process in the new state.
After the system has properly filled in the process control block, the process is
transferred to the ready state.
PROCESS STATES