DEV Community

Priyanshi Gupta
Priyanshi Gupta

Posted on

Threads: The Tiny Workers Inside Your Computer 👷🧵

“If a program is a body, then a process is its soul. And threads are the hands, legs, and eyes doing the actual work.”

When I first heard words like process, thread, and multithreading, they sounded like secret terms used by computer wizards.

But once I understood them, everything clicked.

Suddenly I knew:

  • Why does Google Chrome open many tabs without crashing
  • Why can Visual Studio Code highlight errors while I type
  • Why do games keep running while music plays in the background
  • Why some apps freeze 😵‍💫

  • So let me explain this the way I wish someone had explained it to me.*

Program = Body, Process = Soul, Threads = Workers

Imagine a robot 🤖

Program -> Robot blueprint 📄
Process -> Living robot with energy ⚡
Thread -> Robot’s arms and legs 🦾🦿

Program = The Blueprint 📄

A program is just instructions stored on disk.

Examples:

  • Google Chrome
  • Visual Studio Code
  • Spotify

At this stage, the program is sleeping 😴

Program on Disk:
Program on Disk:

Process = The Program Comes Alive ⚡

When you double-click Chrome, the Operating System says:

“Wake up! Here’s memory, CPU time, and resources.”

Now the program becomes a process.

Beautiful Analogy

Program = Body 🧍
Process = Soul 👻

A body without a soul cannot move.
A program without becoming a process cannot run.

Once a program becomes a process
Once a program becomes a process

Threads = Tiny Workers Inside the Process🧵

A process can have many threads.

Think of threads as little workers wearing helmets 👷👷👷

Each worker performs one specific task.

Some Examples are:

  1. Google Chrome: The Best Real Example

Google Chrome 🌍 is a giant multitasking machine.

When you open it, many threads are created.

Chrome Threads

UI Thread -> Handles clicks and scrolling 🖱️
Network Thread -> Downloads websites 🌐
Renderer Thread -> Draws pages 🎨
Audio Thread -> Plays sound 🔊
GPU Thread -> Handles graphics 🎮

  1. Multiple Tabs = More Work🗂️

Open 10 tabs:

  • YouTube
  • Gmail
  • Google Docs
  • X

Each tab needs work:

  • Downloading data
  • Rendering content
  • Playing videos
  • Responding to clicks

Why is my computer so slow??
Why is my computer so slow??

Why Threads Are Fast 🏃‍♂️

Creating a new process is like building a new house.

Creating a new thread is like adding another family member to the same house.

Which is easier? Obviously adding one more person.

That is why threads are lightweight.

Process A: "Need your spoon."
Process B: "Need your fork."
Operating System: "Fantastic. Nobody eats."

My Brain has too many tabs open....
My Brain has too many tabs open....

CPU Cores and Threads🤯

A CPU like Intel Core i5 has multiple cores.

Each core is like a worker.

4 cores = 4 workers
8 hardware threads = 8 lanes of work

The Operating System schedules software threads onto these CPU resources.

Learning processes and threads changed how I look at computers.

Now when I open Chrome, I don’t just see a browser.

I see:

  • One living process 🧠
  • Many hardworking threads 👷
  • A scheduler acting like a traffic police officer 🚦
  • CPU cores doing work ⚙️

Behind every click, thousands of tiny workers are collaborating.

And that is the magic of Operating Systems. ✨🖥️

If You Found This Helpful ❤️

If this article helped you understand Operating Systems in a fun way:

  • Give it a reaction👍
  • Leave a comment💬
  • Share it with your friends🔁
  • Follow me for more beginner-friendly tech blogs➕

I’m planning to write next on:

  • Mutex and Semaphores🔒
  • Deadlocks Explained with Funny Stories😵

Top comments (0)