Difference between concurrency and Parallelism
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.
In the system, 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 that the program be able to execute multiple operations at the same time, while concurrency only requires the program to pretend to execute multiple operations at the same time (one operation is executed for each small time segment, and multiple operations are executed in turn ).