Differences between programs, processes, and threads
A program is a set of instructions and parameters that commands the computer to run according to a given logical control. A process is a running program, which is the basic unit of operating system execution. A thread is an execution unit that can share resources in the same process in order to conserve resources.
?
The difference between a program and a process:
???? C, C + +, Java and other languages written by the source program compiled by the corresponding compiler into an executable file, submitted to the computer processor to run. The running state of an application is called a process. The difference between a process and an application is that the application is stored as a static file in the storage space of the computer system's hard disk, while the process is a resource management entity maintained by the operating system under dynamic conditions. There are several things you can do to make the difference:
- The process is dynamic, and the program is static.
- The process has a certain life cycle, and the program is a set of instructions, itself without the meaning of "movement".
- A process can only correspond to one program, and a program may correspond to a process. The relationship between the process and the program is like the relationship between drama and play.
Processes and Threads
???? Threads and processes are another pair of meaningful concepts, the main differences and links are as follows:
- A process is the basic unit of the operating system's resource allocation, with complete process space. When allocating resources to the system, the threads are not allocated separate resources except CPU resources, and the resources required by the threads need to be shared.
- A thread is a part of a process that, if not displayed, can be considered single-threaded, and if a thread is established in the process, it can be considered multithreaded.
- Multithreading and multi-process are two different concepts. Multiple threads have different ways of sharing resources with multiple processes.
- The process has a Process control block PCB, the system through the PCB process scheduling. The process threads control block TCP, but the TCB represents much less state than the PCB.
The difference between "Linux" programs, processes, and threads