Hi everyone! π
This is my very first post on dev.to.
I'm Yuvaraj, and I've been writing technical blogs on Medium for a while. I recently decided to start publishing here as well because I love learning in public, and I believe dev.to is the perfect community for that.
I won't claim to be an expert in Node.js. I'd say I'm somewhere in the middle of my journeyβcomfortable enough to build applications, but still curious enough to question everything happening under the hood.
So, I'm starting a new series where we'll explore Node.js from the ground upβnot just how to use it, but why it works the way it does.
Hopefully, we'll both learn something along the way.
Wish me luck! π
The Question That Changed My Perspective
It all started while I was learning Express.js, building APIs, and trying to understand JavaScript's Event Loop and callbacks.
Coming from frontend development, I already understood how JavaScript executes inside Chrome. Naturally, I assumed Node.js worked in almost the same way.
Then I came across something called worker threads and learned that operations like file system tasks don't always behave the way I imagined.
That completely changed my perspective.
I realized I had been using Node.js without truly understanding what was happening underneath.
My First Question: What Is a Thread?
Before trying to understand Node.js, I wanted to answer a much simpler question:
What exactly is a thread?
A simple way to think about it is this:
A thread is a unit of execution. Whenever a program has work to do, that work is performed by a thread.
That immediately led me to another question:
How do threads actually run inside a computer?
To answer that, I had to go back to the basics of computer hardware.
Understanding the Computer First
Every computer (or even your smartphone) has three important components:
RAM
RAM is the computer's working memory.
It temporarily stores the data and program instructions that are actively being used.
You can think of it as the workspace where running programs keep the information they currently need.
It isn't technically "holding threads." Instead, it stores the memory that running processes and their threads use while executing.
Storage (SSD/HDD)
This is where your files live permanently.
Your source code, images, videos, applications, and operating system are all stored here until they're needed.
When you launch a program, the operating system loads the required parts from storage into RAM.
CPU
This is where the actual execution happens.
The CPU executes instructions.
Modern CPUs contain multiple cores, and each core can execute one or more threads simultaneously (depending on the processor and technologies such as Hyper-Threading or SMT).
For example:
- A dual-core CPU can execute multiple threads concurrently.
- A quad-core CPU can execute even more work in parallel.
This was a huge "Aha!" moment for me.
Then My Curiosity Exploded...
Once I understood this much, my mind was full of questions.
- If this is how computers execute programs...
- How does Node.js actually work?
- Why is Node.js called single-threaded?
- What role does the Event Loop play?
- Where do worker threads fit into the picture?
- What happens when Node.js reads a file?
- And if I wrote the same application in Java instead of Node.js... what would be different?
Those questions pulled me deeper into understanding operating systems, threads, CPU scheduling, and eventually the internal architecture of Node.js.
And that's exactly what this series is about.
We're not just going to learn Node.js APIs.
We're going to understand why Node.js behaves the way it does.
If you're curious about what's happening behind the scenes, I think you'll enjoy this journey.
See you in the next post! π
Top comments (0)