Techletter #103 | December 14, 2024
In this techletter, let us understand the following terms
Core, process, concurrency, parallel processing, multi-processing, thread, multi-threading, hyper-threading.
What do you mean by a core?
A core is the “brain” of a CPU. It is the processor within your computer that executes instructions and processes data.
A processor is the entire chip that plugs into your motherboard whereas cores are the individual processing units within that chip.
A processor with two cores is called a dual-core processor;
with four cores: a quad-core;
six cores: hexa-core;
eight cores: octa-core;
What do you mean by a process?
A process is an independent program in execution, containing its own memory space and system resources. It represents a complete instance of a running application, including the program code, current activity, and allocated resources.
Usually, when you run a Python script, your code at some point becomes a process, and the process runs on a single core of your CPU.
But modern computers have more than one core, so what if you could use more cores for your computations, it will be faster.
The idea behind parallelism is to write your code in such a way that it can use multiple cores of the CPU.
What is the difference between multiprocessing and parallel processing?
What do you mean by cores of a CPU?
- Cores are physical processing units.
- Threads are virtual sequences of instructions given to a CPU.
- Multithreading allows for better utilization of available system resources by dividing tasks into separate threads and running them in parallel.
- Hyperthreading further increases performance by allowing processors to execute two threads concurrently.
The number of cores in a system determines how many programs and tasks it can execute at once.
What do you mean by threads?
A thread is a sequence of instructions given to the CPU by a program or application. The more threads a CPU can execute at once, the more tasks it can complete.
What is the difference between a thread and a process?
- Process: A process is an independent program in execution, containing its own memory space and system resources. It represents a complete instance of a running application, including the program code, current activity, and allocated resources.
- Thread: A thread, often referred to as a “lightweight process” is the smallest unit of execution within a process. Multiple threads can exist within the same process, sharing the same memory space but executing independently.
What is multithreading?
When multiple threads are running simultaneously, it’s called multithreading.
Modern processors support hyperthreading, a technology that allows one physical core to be divided into two virtual cores,
This allows the CPU to work on multiple execution threads simultaneously.
References:
https://www.baeldung.com/cs/core-vs-cpu
https://www.intel.com/content/www/us/en/gaming/resources/hyper-threading.html
https://www.liquidweb.com/blog/difference-cpu-cores-thread/