Monday, June 9, 2025

Threads to Process

Single Core
Threads run sequentially and concurrently.
Slow in executing a process.

Multicore
Threads run sequentially and parallelly.
Therefore, processes run smoothly and fast adding to efficiency.

Text
Data
Heap 
Stack

Stack
Last in First out

Heap
Concurrency 

Process

1. Threads
Thread is a unit of execution in a process.
Theards can run concurrently.
Process is an instant in a running program.

2. Processes
Process is a running instance of a program.
Process is dynamic instance and has set of instructions to execute.
There are many processes (instances) within a running program.


3. Program
Set of instructions in programming code that tells the computer to perform a specific task.
Set of steps (instructions) needed to perform a specific task.
Program is a composite unit written in code where multiple threads and process  run concurrently to perform a task or tasks.

CPI
There is no need for threads and processes to wait one to finish before the other to commence.
CPU job is to allocate or schedule them as and when the memory is free.
The end result is multitasking.
Both efficiency and performance are achieved by division of labour

That is why a computer is much more efficient than human brain.
Brain logic is completely different with a bias towards visual impressions.
Of course computer converts the information to a visual text or image or audio signal.

4. Task

Multiprocessing and Concurrency are the keywords.

Threads are there to respond to process need concurrently or alternatively.
Without threads the CPU cannot schedule processes

No comments:

Post a Comment