The shadow of the computer-multitasking

Today, let's take a look at the multitasking in computers. The literal meaning of computer multitasking is that the computer can run multiple tasks at the same time.
For example, when we use the computer, we can make QQ calls while playing League of Legends. You can even take the time to open a nervous and exciting Happy Landlord. This is called multitasking. In the chestnuts above, our computer is running at least 3 tasks at the same time (QQ, League of Legends, Happy Landlord)
. What is multitasking, we have to talk about how the computer realizes multitasking at the same time?

There are two ways to run computer multitasking: 1. Concurrency 2. Parallel

Concurrent

We all know that in the past, computers were basically single-core computers. Unlike our current computers, which are basically four-core computers, how do single-core computers run multiple tasks at the same time? The key lies in: computers Will perform tasks alternately within a period of time.
Here we still take the above chestnuts: the computer is running QQ and League of Legends at the same time.
For single-core cpu processing multi-tasking, the operating system will alternately execute each software, if QQ executes 0.01s , Switch to League of Legends and execute 0.01s, then switch to QQ to execute 0.01s... Repeated execution. On the surface, these softwares are all being executed at the same time, but the real situation is that they are executed one by one, because the current CPU calculation speed is very fast, and you can't feel this alternate process.
What? Don't understand? Directly on the picture:
Insert picture description here
but note: single core CPU can only use concurrent execution of multitasking

parallel:

For multi-core CPUs to handle multiple tasks, the operating system will arrange an execution software for each core of the CPU, and multiple cores are the real software to execute together.
Note that multi-core CPUs perform multiple tasks in parallel, and multiple software is always executed together
Insert picture description here

Guess you like

Origin blog.csdn.net/Layfolk_XK/article/details/107940410