The difference between process and program:
Process: The dynamic process of a program's execution process, and the state properties of the process are changed
Program: The ordered collection of instructions and data stored on disk is a file that can be seen visually
The static concept of program programs does not change in itself. Instruct who to execute, data who to visit? Cpu!
But the prerequisite is that the CPU can touch, the program execution process needs CPU, memory, and related resources.
Processes are dynamic and need to be executed before they are created, and the end of the run is reclaimed, including the process of creating, scheduling, executing, and disappearing.
The two are relations: No program process is meaningless, is the relationship between content and form.
The execution of a program that creates at least one process.
A process of content called Process Control card, PCB, it is a theoretical thing, different system implementation is not the same, Linux used task_struct to describe
Characteristics of the process:
Dynamic: The essence of the process is the process of a program in a multi-channel program system, the process is dynamic, dynamic extinction
Concurrency: Any process can be executed concurrently with other processes
Independence: The process is a basic unit that can operate independently, and it is also the independent unit of allocating resources and dispatching.
Asynchrony: Due to the mutual constraints between processes, the process has intermittent execution, that is, the process at their own independent, unpredictable speed forward.
Process Communication Reason:
Data transmission
Resource sharing
Notification events
Process Control
Process mutex: When multiple processes access a shared resource at the same time, only one process is allowed to access it until the end of the access and other processes are released.
Critical resources: At the same time, only one process is allowed to access resources, the process of access to the critical resources of the program code called Critical resources.
Process synchronization: A set of concurrent processes are executed in a certain order, a set of concurrent processes with a synchronous relationship is a cooperative process, and the signals sent to each other by the cooperative process are called messages or events.
Deadlock: A deadlock in which multiple processes compete for a resource and cannot continue to move forward without external forces. Solution: The main prevention, so that the process access to resources in the same order.
Type of process:
Interaction process
Batch Processing
Daemon process
Status of the process
Run state (running and ready to run)
Wait (can be interrupted wait, not interrupted wait)
Zombie State
Stop State