How do multi core processors handle programs

May 16, 2017
14
0
510
Hello,
I was hoping someone could explain to me how multi core processors handle programs.
For examples there is 2 scenarios that come to my mind atm.
1. Regarding processors with multiple cores. If two programs that use 1 core run at the same time. Will the processor use 2 cores, 1 for each program? Or will they share 1 core if it is enough?
and
2. Expanding on this, how would it work with multiple programs (for example,8 programs) running on a processor (4 cores)?
 
G

Guest

Guest
Each CPU Core has a pre-determined number of threads, for example, a dual core CPU could potentially have 4 threads (Hyper-threading), meaning that any given program running will use its assigned amount of CPU resources on an assigned core. (Resource assignment is determined primarily by the system itself, and whether or not the user, and therefore the CPU has assigned resources to the workload). the CPU threads, and cores, all run at the CPU's rated frequency, that is, billion cycles per second. The faster the clock speed, the faster processes are completed. A CPU with more cores can split its workload more efficiently. For example, an 8 Core processor running at 1.5 Ghz may indeed complete a process quicker, if the process is using all 8 cores at once. BUT, a single threaded program (A program using only one thread), will take a much higher advantage of a CPU with say 2 cores running at 3 Ghz.

If two programs are open that are programmed to use only 1 CPU Core, the Program with the highest priority will be assigned to Core 0 (Core zero is the first core). Any other programs that are open will be assigned to the processor core that will complete the process quickest. More often than not, the computers operating system will work relatively well to split workloads across multiple cores, unfortunately, some programs are only programmed to take advantage of one core. If this is the case, the program likely does not need multiple cores, unlike a video editing program or 3D development program.

If 8 programs were open at once, and if they were all using a considerable amount of CPU resources, on a 4 core CPU, for 1, the computer would be noticeably slower than if it were idle. Each process will be given an assigned amount of CPU resources, and each program would be prioritised accordingly, and instructions would be stored in the CPU's cache, but if the programs open are using 100% of the CPU's usage, and is running at its maximum frequency, then the programs will slow down, as they will be held in a 'queue' and a considerable delay would be implied until the CPU has completed its instructions. Note, a similar effect can be witnessed when downloading files; 8 simultaneous downloads will download slower than 2, if the files are reaching the download speed limit.

Hope this helps, and as a general rule of thumb, for basic applications, CPU Speed is more important than core count, although generally speaking, a CPU with 2 or more cores is pretty good for general use.
 
Applications are made up of "threads" of execution. You can think of a thread as the smallest unit of work a CPU can operate on. Every clock cycle, the thread(s) with the highest priority are executed by the CPU, with one thread being assigned per core. Priorities are adjusted over time so all threads eventually get a chance to run.