2018329621184_边凯昂_homework2 Version 0 |
|
👤 Author: by 244766935qqcom 2020-09-27 04:46:02 |
1. What is the purpose of process?
The purpose of process is to make multiple programs execute concurrently to improve resource utilization and system throughput.
2. Describe their relation and difference for process and program.
5 relation and difference between process and program
(1) Dynamism: a process is an execution of a program. It is a dynamic concept. It is temporary and has a life cycle. It is generated by creation and cancelled after completing the task.
A program is an ordered sequence of instructions to complete a specific function. It is a static concept. Programs can be preserved as a software resource for a long time. Process is to take the program as its running entity. Without program, there will be no process.
(2) Concurrency: multiple process entities, stored in memory, can be executed at the same time in a period of time;
programs cannot be executed concurrently.
(3) Independence: a process is an independent unit of the system for resource allocation and scheduling;
but a program is not an independent unit of the system for resource allocation and scheduling.
(4) Asynchrony: processes move forward at independent, unpredictable speeds; or, processes run asynchronously. It is this feature that leads to the non reproduction of program execution. Therefore, measures must be taken to ensure the coordinated operation of various programs in OS.
(5) Structure feature: in order to describe and record the process of process change and make it run correctly, a process control block should be configured for each process.
In this way, from the structure, each process is composed of program segment, data segment and process control block.
3. Why the status of process is divided into five states, not other numbers, such as 4, 7?
5 states of process
• New. The process is being created.
• Running. Instructions are being executed.
• Waiting. The process is waiting for some event to occur (such as an I/O
• Ready. The process is waiting to be assigned to a processor.
• Terminated. The process has finished execution.
Only one process can be running on any processor at any instant. As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. Each process may be in one of the five states.
The number of the states of a process is 5, but not 4 or 7 is because here are only 5 different situations(activities) from the beginning of a process to the end of a process.