Analysis of process and thread (i)

Source: Internet
Author: User

First, introduce the basic concepts of both.

Process: 1. Procedure or task execution. (dynamic)

2. Holding resources (shared memory, files) and threads (is the carrier of resources and threads)

Threads: 1. Thread is the smallest execution unit in the system

2. There can be multiple threads in the same process

3. Resources for thread-sharing processes

In conclusion, the relationship between the process and the thread can be likened to the relationship between the class and the student, the student is the smallest unit of the class, the class is the carrier of the student, the students can use the resources of the class, such as chairs.

Second, describe the interaction of the threads.

The relationships between threads can be divided into two types, mutual exclusion and synchronization.

Mutex: When a thread holds the same resource, it must wait until the previous thread has freed the resource before a thread can hold it.

Synchronization: The process of mutual cooperation between threads.

In conclusion, the relationship between threads can also be likened to the relationship between students. Mutual exclusion is the student's use of limited learning materials, and must wait until no students use the information, they can use. Synchronization means that students need to work together to complete an activity, such as singing contests, and need to help each other.

Well, today's brief introduction summarizes the basic concepts of process and threading and continues tomorrow.

Analysis of process and thread (i)

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.