</>
ShikshaCSLearn. Code. Grow.
🔍
☕ Support Us
ShikshaCSâ€ēNotesâ€ēOperating Systems
Operating Systems
🕒 7 min read

Process vs Thread

Two ways your program runs — and why threads are 'lightweight'.

What is a Process?

A process is an independent program in execution, with its own memory space (code, data, heap, stack). Processes don't share memory with each other by default, making them isolated but heavier to create.

What is a Thread?

A thread is a unit of execution within a process. Multiple threads in the same process share the same memory space, making them faster to create and switch between — but requiring careful synchronization to avoid conflicts.

Key Difference

Processes are isolated and heavyweight; threads are shared and lightweight. Multi-threading is used for tasks like handling multiple users on a server simultaneously without the overhead of separate processes.

🌍 Real-World Use

When you open multiple Chrome tabs, each is often a separate process (so one crashing tab doesn't crash your whole browser). Inside a single app like a game, multiple threads handle graphics rendering, sound, and input simultaneously.

💡 Pro Tip

A classic interview follow-up: 'why do threads need synchronization but processes usually don't?' — answer: because threads share memory, so two threads writing to the same variable at once can corrupt data (a 'race condition'), which processes avoid by having separate memory.

đŸ§Ē Quick Self-Test

Check what you just learned — no pressure, just practice.

1. Do threads within the same process share memory?

2. Why are threads called 'lightweight'?

← Back to all Notes