threads, processes, parallelism, concurrency

    As the title shows, many people are confused about threads, processes, concurrency, and parallelism, and they cannot clear their understanding and positioning. Suddenly, they think of some of their own understandings. I hope that I can share them with you. I hope everyone can point out what is wrong. progress.

    Process: It is the smallest unit that applies to the system for computer resources , such as the basic unit that applies to the system for computer cpu resources, memory resources, peripheral hard disk resources, etc. The system will allow the process to start using various resources if it gets the corresponding, such as in win7 Open a QQ.exe next, this is an example of a process applying for permission;

 Thread: A thread is the smallest unit that applies to the system for CPU resources. Compared with the smallest unit of the process above, it is more accurate and only uses the resources of the CPU, excluding other resources, because it belongs to a process and exists. Process threads are not allowed to exist alone in the system. It can be said that the process is the running and living environment of the thread and is interdependent.

 

Parallel: Multiple tasks occur at the same time, each of which has a corresponding CPU for processing

Concurrency: Multiple tasks occur at the same time, only one CPU installs the time-sharing segment to process each task fragment, and each task is run as a whole

 

It can be said that a process and a thread describe the unit in which the tasks of a computer system are executed from the perspective of the applicant.

Concurrency and parallelism are from the perspective of the executor, that is, the computer processor CPU processing tasks

They are descriptions of different aspects, such as consumers and sellers, one describes the classification of consumer behavior from the perspective of consumers, and the other describes the classification and description from the perspective of sellers. How are they comparable?

 

The relationship between threads and processes is as follows

 

 

Concurrency, parallel relationship diagram

 

Concurrency and parallelism are different solutions that appear in multitasking implementation.

Concurrency In the case of a single core with limited cpu resources, multiple tasks can be divided into time segments and executed in turn, so as to achieve the effect of multi-task running at the same time;

Parallelism is a solution in which each task corresponds to a CPU execution in the true sense.

The two solutions are only solutions under different hardware resource conditions.

 

The final overview is shown below

All of the above are what I think of, I hope that the gods will guide us to make progress together.

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326928378&siteId=291194637