Whether it is parallel or concurrent, in the view of the user is ' simultaneously ' running, whether it is a process or a thread, is only a task, the real work is cpu,cpu to do these tasks, and a CPU can only perform one task at a time
1. Concurrency: Pseudo-parallel, which appears to be running at the same time. Single cpu+ multi-channel technology enables concurrent
Example (single core + multi-channel, implementing concurrent execution of multiple processes):
Zhang San at the same time to do more things: writing, practicing listening, watching the United States, but Zhang San the same time can only do one thing,
So in order to achieve the effect of multiple tasks concurrent execution, you can write a job, then practice listening, and then see a beautiful drama
2. Parallel: Run concurrently, only with multiple CPUs to achieve parallelism
Single-core, multi-channel technology can be used, multiple cores, each core can also use multi-channel technology ( Multi-channel technology is for single-core )
There are four cores, six missions, so that four tasks are executed at the same time, assuming they were assigned to CPU1,CPU2,CPU3,CPU4,
Once task 1 encounters I/O and is forced to interrupt execution, Task 5 takes the cpu1 time slice to execute, which is the multi-channel technology under single core.
And once the I/O for Task 1 is over, the operating system calls it back ( knowing the scheduling of the process, which CPU to run, and what the operating system decides )
May be assigned to any one of the four CPUs to execute