- A process is a program in execution. A process is more than the program code, which is sometimes known as the text section.
- It also includes the current activity, as represented by the value of the program counter and the contents of the processor's registers.
Figure 3.1:
(a) Multiprogramming of four programs. (b) Conceptual model of four independent, sequential processes. (c) Only one program is active at once.
|
- In Fig. 3.1a we see a computer multiprogramming four programs in memory.
- In Fig. 3.1b we see four processes, each with its own flow of control (i.e., its own logical program counter), and each one running independently of the other ones. Of course, there is only one physical program counter, so when each process runs, its logical program counter is loaded into the real program counter. When it is finished for the time being, the physical program counter is saved in the process'logical program counter in memory.
- In Fig. 3.1c we see that viewed over a long enough time interval, all the processes have made progress, but at any given instant only one process is actually running.
- A process generally also includes
- a data section, which contains global variables,
- the process stack, which contains temporary data (such as function parameters, return addresses, and local variables),
- a heap, which is memory that is dynamically allocated during process run time.
- The structure of a process in memory is shown in Fig. 3.2.
Figure 3.2:
Process in memory.
|
- A program becomes a process when an executable file is loaded into memory.
- Although two processes may be associated with the same program, they are nevertheless considered two separate execution sequences.
- For instance, several users may be running different copies of the mail program,
- or the same user may invoke many copies of the web browser program.
- Each of these is a separate process; and although the text sections are equivalent, the data, heap, and stack sections vary.
Cem Ozdogan
2011-02-14