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)