#A process is a dynamic execution process of a program on a data set.
The process generally consists of three parts: program, data set, and process control block. (Recommended learning: PHP programming from entry to proficiency)
The program we write is used to describe what functions the process wants to complete and how to complete it; the data set is the execution process of the program The resources needed in the process; the process control block is used to record the external characteristics of the process and describe the execution change process of the process. The system can use it to control and manage the process. It is the only sign that the system perceives the existence of the process.
We can also understand that a process is a running activity of a program with certain independent functions on a certain data collection. A process is an independent unit for resource allocation and scheduling in the system.
You can also think of a process as an entity composed of a set of elements. The two basic elements of a process are program code (which may be shared by other processes executing the same program) and the data set associated with the code. Assume that the processor starts executing this program code, and we call this execution entity a process.
When a process is executing, at any given time, the process can be uniquely characterized by the following elements.
1.标识符:跟这个进程相关的唯一标识符,用来区别其他进程。 2、状态:如果进程正在执行,那么进程处于运行态。 3、优先级:相对于其他进程的优先级 4、内存指针:包括程序代码和进程相关数据的指针,还有和其他进程共享内存块的指针。 5、上下文数据:进程执行时处理器的寄存器中的数据。 6、I/O 状态信息:包括显示的I/O操作。分配给进程的I/O设备(例如磁带驱动器)和被进程使用的文件列表等。 7、记账信息:可能包括处理器时间综合、使用的是时钟数总和、时间限制、记账号等。
Why is the process designed?
It is very difficult to design a system software that can coordinate various different activities. There are many jobs running at any time, and each job includes many steps that require execution in sequence, so it is not possible to analyze sequence combinations of time.
In the absence of a system-level method for coordinating and cooperating across all activities, programmers can only adopt their own ad hoc methods based on their understanding of the environment controlled by the operating system. However, this method is very fragile, especially to small errors in programming, because these errors only appear when rare time series occurrences occur.
Diagnosis can be difficult because of the need to distinguish these errors from application software errors and hardware errors. Detecting errors in a timely manner is also difficult to determine the cause because it is difficult to identify the precise scenario in which the error occurred.
Generally speaking, the 4 main reasons for this type of error are as follows:
1. Incorrect synchronization
2. Failed mutual exclusion.
3. Uncertain program operation
4. Deadlock
Solving these problems requires a system-level method to monitor the execution of different programs in the processor. The concept of process provides the basis for this.
So the process can be seen as consisting of three parts:
A program that can be executed
Related data required by the program
Execution context of the program
The above is the detailed content of What is the concept of process in PHP. For more information, please follow other related articles on the PHP Chinese website!