The difference between "Linux" programs, processes, and threads

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.