Does multiple cores in CPU affect how many programs I can run

cpucpu cores

I have question about multiple cores in CPU.
Let's say I am working in few programs at the same time, for example:
– Photoshop
– Autodesk Maya
– Visual Studio
– Unreal Engine

If I would have more cores in my CPU it would mean that those programs would perform faster(like each core for one program, etc.)

Best Answer

Operating systems use the concept of processes and threads for running programs.

When you load a program, a process is created. The process has its own memory and credentials and that process can only read/write to its own memory and do through the kernel whatever its credentials allow.

On a single CPU system, the OS goes through each running process and gives it a portion of CPU time, round robin. Only one process actually executes in a given instant of time. (If a process is waiting or "blocked" for I/O, a very common condition, it is skipped.)

A process can split part of itself off as a thread. This is essentially two parts of a single process having two separate turns on the CPU (all of a processes threads "live in" the process and can see its memory).

A process can also

  • spawn another separate, new process - i.e. load a separate program. Windows Explorer spawns processes when it launches programs.
  • fork another process - i.e. create a copy of itself, as a separate process (not a thread) - this is common in Unix/Linux operating systems.

If there is more than one CPU core, while a process begins on a single core, the OS can place its threads on other cores, and if the process spawns or forks other processes, it can place them on other cores than the parent process.

The OS manages which cores it uses and might even transparently migrate processes to different CPUs from time to time to keep things balanced. On Windows and probably Linux you can pin CPU "affinity" so it stays only on specific cores if you wanted.

So, if the application spawns threads and/or processes to accomplish its work, it will benefit from multiple CPU cores. If it doesn't, that specific program will not. Your OS will still be assigning other programs to other cores, so it can mean other programs will have less of an impact on your single-threaded single-process program.

Related Question