The difference between threads and processes

Source: Internet
Author: User

The final summary is:

(1) noun explanation: a process is an execution activity of a program on a computer. Threads (Thread) is an entity of a process .

A program has at least one process , and a process has at least one thread .

(2) Address space: The process has an independent resource, and the thread shares the resources. There is a separate address space between different processes, and the address space of the process is shared between different threads of a process. The most essential difference

Note: From a logical point of view, the meaning of multithreading is that in an application, multiple execution parts can be executed concurrently. However, the operating system does not consider multiple threads as separate applications to implement scheduling and management of processes and resource allocation. This is the important difference between processes and threads. "

Note: The process overhead is large and the thread overhead is small. Indeed, this is the most basic difference. 】

(3) Resource allocation

A process is the unit in which the operating system allocates resources, and threads are the basic unit of CPU Dispatch and Dispatch

Threads (Thread) is an entity of the process and is CPU basic unit of dispatch and Dispatch

(4) Individual benefits

Process: Multiple programs can be loaded into memory at the same time, under the scheduling of the operating system, executing concurrently, greatly improving the utilization of the CPU, the process is to achieve multi-channel programming on the CPU proposed.

Threads: On the one hand, the concurrency of the process can be increased, and the thread has the advantage of being able to effectively utilize multiprocessor and multicore computers.

Classic Reference article: http://www.cnblogs.com/hazir/archive/2011/05/09/2447287.html

Http://blog.chinaunix.net/uid-21411227-id-1826748.html

The difference between threads and processes

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.