What blocking means
When a thread calls read on a blocking socket and no data has arrived, the kernel parks that thread until bytes show up. The thread sits idle, holding its stack and its place in the scheduler. One thread can therefore serve only one slow connection at a time, which is why the simplest servers spin up one thread per client.
What non blocking means
A socket put into non blocking mode behaves differently. If the read would have to wait, it returns immediately with the error EWOULDBLOCK instead of sleeping. The thread is free to go do other useful work and come back later. Nothing is lost, but the program now owns the job of deciding when to retry.
Why this matters
- Blocking is simple to reason about but ties up a thread per pending operation
- Non blocking frees the thread but forces you to poll or to ask the kernel which sockets are ready
- Non blocking is the foundation that event loops and IO multiplexing are built on top of
Most high concurrency servers choose non blocking sockets and then add a readiness notification layer so a handful of threads can watch thousands of connections.
Key idea
Blocking IO parks the thread when data is not ready, while non blocking IO returns at once and leaves the waiting decision to your code.