. Net multithreading note (1): process, thread, and fiber

Source: Internet
Author: User

Process

A process represents an application running on the operating system.Program. A process has its own block, exclusive resources and data, and can be scheduled by the operating system. Even if the same application is forced to start multiple times, it will be installed in an inaccessible process and run independently.

Thread

A thread is also called a microprocess or a lightweight process. It is similar to a process. It is a scheduling Unit and maintains its own stack and Context Environment. A thread is affiliated with a process. A process can contain one or more threads, and multiple threads in the same process share a memory block and resources. A thread is a basic unit that can be scheduled by an operating system. At the same time, its scheduling is limited by the processes that contain the thread. That is to say, the operating system first decides the next process to be executed, then the thread in the process will be scheduled.

Differences between threads and processes

The biggest difference between a thread and a process is isolation. Each process is isolated independently, with its own memory block, exclusive resources and running data. The crash of a process does not affect other processes, and interaction between processes is quite difficult. Unlike a process, threads in a process share resources and memory blocks, and one thread can access and end other threads in the same process.

Optical Fiber

A thread is a lightweight thread concept proposed by Microsoft. A fiber has its own stack and register status. A thread can contain multiple fiber threads. Different from a thread called by the operating system, the scheduling of fiber threads in a thread is completely controlled by the programmer, the operating system kernel does not know the existence of the fiber.

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.