Processes and Threads (2013 1) 1x2
Processes and Threads (2013 1) 1x2
PUCP, 2013, vk
WS, OSIDP7E
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 2
WS, OSIDP7E
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 3
Consider a computer with 250 Mbytes of available memory (not used by the OS), a disk, a terminal, and a printer. Three programs, JOB1, JOB2, and JOB3, are submitted for execution at the same time, with the attributes listed in Table 2.1. We assume minimal processor requirements for JOB2 and JOB3 and continuous disk and printer use by JOB3. For a simple batch environment, these jobs will be executed in sequence. Thus, JOB1 completes in 5 minutes. JOB2 must wait until the 5 minutes are over and then completes 15 minutes after that. JOB3 begins after 20 minutes and completes at 30 minutes from the time it was initially submitted. The average resource utilization, throughput, and response times are shown in the uniprogramming column of Table 2.2. Device-by-device utilization is illustrated in Figure 2.6a. It is evident that there is gross underutilization for all resources when averaged over the required 30-minute time period.
WS, OSIDP7E
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 4
WS, OSIDP7E
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 5
WS, OSIDP7E
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 6
Now suppose that the jobs are run concurrently under a multiprogramming OS. Because there is little resource contention between the jobs, all three can run in nearly minimum time while coexisting with the others in the computer (assuming that JOB2 and JOB3 are allotted enough processor time to keep their input and output operations active). JOB1 will still require 5 minutes to complete, but at the end of that time, JOB2 will be one-third finished and JOB3 half finished. All three jobs will have finished within 15 minutes. The improvement is evident when examining the multiprogramming column of Table 2.2, obtained from the histogram shown in Figure 2.6b.
WS, OSIDP7E
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 7
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 8
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 9
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 10
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 11
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 12
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 13
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 14
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 15
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 16
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 17
M. Milenkovic, OSCD
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 18
Figure 2-1. (a) Multiprogramming of four programs. (b) Conceptual model of four independent sequential processes. (c) Only one program is active at once.
MOS3E
PUCP, 2013, vk INF239 Sistemas Operativos. Processes and Threads 19
Process Creation
There are four principal events that cause processes to be created: 1. System initialization. 2. Execution of a process creation system call by a running process. 3. A user request to create a new process. 4. Initiation of a batch job.
PUCP, 2013, vk
20
Process Termination
Sooner or later the new process will terminate, usually due to one of the following conditions: 1. Normal exit (voluntary). 2. Error exit (voluntary). 3. Fatal error (involuntary). 4. Killed by another process (involuntary).
PUCP, 2013, vk
21
Process States
Figure 2-2. A process can be in running, blocked, or ready state. Transitions between these states are as shown.
PUCP, 2013, vk
22
PUCP, 2013, vk
23
PUCP, 2013, vk
24
PUCP, 2013, vk
25
PUCP, 2013, vk
26
PUCP, 2013, vk
27
PUCP, 2013, vk
28
PUCP, 2013, vk
29
PUCP, 2013, vk
30
PUCP, 2013, vk
31
PUCP, 2013, vk
32