Processes and Threads

Source: Internet
Author: User

A process is an independent unit of system resource allocation and scheduling.

A thread is an entity of a process that is the basic unit of CPU dispatch and dispatch, which is a smaller unit that can run independently than a process. The thread itself basically does not own system resources, it only has a bit of resources that are essential in the run, but it can share all of the resources owned by the process with other threads that belong to one process.

The main difference between processes and threads is that they are different ways to manage operating system resources.

The process has a separate address space, and after a process crashes, it does not affect other processes in protected mode.

A thread is just a different execution path in a process. Threads have their own stacks and local variables, but there is no separate address space between threads, and a thread that dies equals the entire process dead (a process with only one thread). For some concurrent operations that require simultaneous and shared variables, only threads are used.

Nutshell

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

The process has independent memory units during execution, while multiple threads share memory.

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.