페이지

2022년 4월 19일 화요일

1.5.1 Process Management

 A program can do nothing unless its instructions are executed by a CPU. A program in execution, as mentioned, is a process. A program such as a compiler is a process, and a word-processing program being run by  an individual user on a PC is a process. Similarly, a social media app on a mobile device is a process. For now, you can consider a process to be an instance of a program in execution, but later you will wee that the concept is more general. As described in Chapter 3, it is possible to provide system calls that allow processes to create subprocesses to execute concurrently.

A process needs certain resources-including CPU time, memory, files, and I/O devices-to accomplish its task. These resources are typically allocated to the process while it is running. In addition to the various physical and logical resources that a process obtains when it is created, various initlization data(input) may be passed along. For example, consider a process running a web browser whose function is to display the contents of a web page on a screen. The process will be given the URL, as an input and will execute the appropriate instructions and system calls to obtain and display the desired information on the screen. When the process terminates, the operaing system will reclaim any reusable resources.

We emphasize that a program by itself is not a process. A program is a passive entity, like the contents of a file stored on disk, whereas a process is an active entity. A single-threaded process has one program counter specifying the next instruction to execute.(Threads are coverd in Chapter 4). The execution of such a process must be sequential. The CPU executes one instuction of the process after another, until the process completes. Further, at any time, one instuction at most is executed on behalf of the process. Thus, although two process may be associated with the same program, they are nevertheless considered two separate execution sequences. A multithreaded process has multiple program counters, each pointing to the next instruction to execute for a given thread.

A process is the unit of work in a system. A system consists of a collection of processes, some of which are operating-system processes (those that execute system code) and the rest of which are user processes (those that execute user code). All these processes can potentially execute concurrently-by multiplexing on a single CPU core-or in paralled across multiple CPU cores.

The operaing system is responsible for the following activities in connection with process management:

- Creating an deleting both user and system processes

- Scheduling processes and threads on the CPUs

- Supending and resuming processes

-Providing mechanisms for process synchronization

- Providing mechanisms for process communication

We discuss process-management techniques in Chapter 3 through Chapter 7.


댓글 없음: