Difference between concurrency and concurrency
Parallel refers to the simultaneous execution of multiple commands on multiple processors at the same time. It is like two people each dig a pitfall with an iron shovel. An hour later, each person has a big pitfall. Therefore, both of them are executed together in both the micro and macro aspects.
Concurrency indicates that only one command can be executed at a time, but multiple process commands are quickly rotated, so that multiple processes can be executed simultaneously at a macro level, however, at the micro level, it is not executed at the same time. It only divides the time into several segments so that multiple processes can be executed quickly and cyclically. It seems that two people use the same tie and dig holes in turn. One hour later, each of them dug a small pitfall. It will take two hours to dig two big pitfall.
According to the above understanding, real parallelism can only exist in a multi-processor system, while concurrency can exist in a single-processor and multi-processor system, concurrency can exist in a single processor system because concurrency is the illusion of parallelism. parallelism requires the program to be able to execute multiple operations at the same time, concurrency only requires the program to pretend to execute multiple operations at the same time (one operation is executed for each slice, and multiple operations are executed in turn ).