3.2. 2 A Two-State Process Model(1/2) ·两状态进程模型 Process may be in one of two states Running:chen进程占用CPU Not- running进程不占CPU Dispatch Enter Not Exit Running R unning Pa ause (a) State transition diagram
3.2.2 A Two-State Process Model(1/2) • 两状态进程模型 • Process may be in one of two states • Running:chen进程占用CPU • Not-running:进程不占CPU *
3.2. 2 A Two-State Process Model(2/ 2) Not-Running Process in a Queue uele Enter Dispatch Exit Processor Pause (b) Queuing diagram
3.2.2 A Two-State Process Model(2/2) • Not-Running Process in a Queue 18
3.2 Process states .3.2.1 Trace of the process 3.2.2 A TWo-State Process model 3.2.3 The Creation and termination of Processes 3.2, 4A Five-State Model 3.2.5 Suspended process
19 3.2 Process States • 3.2.1 Trace of the Process • 3.2.2 A Two-State Process Model • 3.2.3 The Creation and Termination of Processes • 3.2.4 A Five-State Model • 3.2.5 Suspended Process
3.2.3 The creation and termination of Processes( 1/3) Process creation Table 3.1 reasons for process creation New batch iob The operating system is provided with a batch job control stream, usually on tape or disk. When the operating system is prepared to take on new work, it will read the next sequence of Job control commands Interactive logon A user at a terminal logs on to the system. Created by os to provide a service The operating system can create a process to perform a function on behalf of a user program, without the user having to wait(e. g, a process to control printing) Spawned by existing process For purposes of modularity or to exploit parallelism, a user program can dictate the creation of a number of processes
3.2.3 The Creation and Termination of Processes(1/3) • Process Creation *
3.2.3 The creation and termination of Processes( 2/3) Process termination Table 3.2 Reasons for process termination Normal completion The process executes an Os service call to indic ate that it has completed running. Time limit exceeded The process has run longer than the specified total time limit There are a number of possibilities for the type of time that is measured These include total elapsed time("wall clock time"). amount of time spent executing, and, in the case of an interactive process, the amount of time since the user last provided any input Memory unavailable The process requires more memory than the system can provide Bounds violation The process tries to access a memory location that it is not allowed to access Protection error The process attempts to use a resource such as a file that it is not allowed to use, or it tries to use it in an improper fashion, such as writing to a read-only file Arithmetic error The process tries a prohibited computation, such as division by zero, or tries to store numbers larger than the hardware can accommodate
3.2.3 The Creation and Termination of Processes(2/3) • Process Termination 21