Differences between programs, processes, and threads

Source: Internet
Author: User
Tags switches
A process is the basic execution entity of a program and a container for threads.
1) The program is an ordered set of instructions and data, which itself does not have any meaning of running, is a static concept. The process is a process of execution of the program on the processing machine, it is a dynamic concept.
2) The program can be used as a software data for a long time, and the process is a certain life cycle. The program is permanent and the process is temporary.
3) The process can describe concurrency more realistically, and the program cannot.
4) The same program can correspond to multiple processes.

threads, which are sometimes referred to as lightweight processes.
1) You can include several threads in a process.
2) The process is usually used as the basic unit of allocating resources, and the thread as the basic unit of independent operation and independent Dispatch.
3) The process has a separate memory unit during execution. Threads have their own stacks and local variables, but they do not own system resources.
4) processes are independent of each other and shared among threads of the same process. Threads within a process are not visible in other processes.
5) Process switching, the cost of large resources, less efficient. Thread context switches are much faster than process context switches.

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.