Division one P: processes, threads, concurrent, parallel

First, the process

Liu big fat turn on the computer and want to write something, then open the WPS, and suddenly want a girlfriend (I do not believe anyway) chat, and again opened the micro-channel PC side, then the operating system will generate two for the two programs a process, as shown:

image.png

 

Second, thread

Each process contains at least one thread, the thread is a basic unit of scheduling and execution of the CPU, may be received while the WPS text input, while automatically saved, then there will be two processes, as shown:

image.png

 

Third, concurrent

Liu Taipan entered in the WPS text, the program automatically saves, but did not appear Caton, because the CPU uses time-slicing in the implementation of multi-threading, because the CPU changes very fast, Liu did not feel Taipan card, In fact, a certain point of time on the CPU will only execute one thread, the thread switching multiple concurrent execution is called, as shown:

image.png

 

Fourth, parallel

Liu Tai Pan recently upgraded the computer's CPU, rose from a two nuclear core, multi-threaded execution so when the CPU can execute the two nuclear one, which is parallel, as shown:

image.png

 

V. Summary

  • Process: In fact, the operating system is an abstraction of a running program is
  • Thread: A thread is the smallest unit of CPU scheduling is to ensure that multi-task in a thread
  • Concurrency: a CPU core to execute multiple threads by switching time
  • Parallel: multiple CPU cores simultaneously execute multiple threads

More exciting content, the public may be concerned about my number

Guess you like

Origin www.cnblogs.com/liuzhenbao/p/12633253.html