What is a thread? What is the difference between a thread and a process?

Source: Internet
Author: User

1. The process is the basic unit of the system resource allocation, has the independent memory address space, the thread is the basic unit of CPU dispatch, there is no individual address space, there are independent stacks, local variables, registers, program counters and so on.
2. The cost of creating a process is large, including the creation of virtual address space, which requires a lot of system resources; the creation of thread overhead is small and basically only one kernel object and one stack.
3. One process cannot directly access the resources of another process, and multiple threads within the same process share the resources of the process.
4. High process switching overhead, low thread switching overhead, high inter-process communication overhead, and low inter-thread communication overhead.
5. Threads belong to a process and cannot be executed independently. Each process must have at least one thread, which becomes the main path.

What is a thread? What is the difference between a thread and a process?

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.