← BYTES
Unix IPC·Starter·Ref: 15.1.46

At a basic level, what is the difference between a blocking and a non-blocking read() call?

Have a question about this video? Mention reference 15.1.46 when you contact us.

a.There is no real difference between the two
b.A blocking read() waits (pauses the calling thread) until data is actually available before returning; a non-blocking read() returns immediately, with an error indicating 'nothing available right now' if there's nothing to read
c.A non-blocking read() always returns more data than a blocking one
d.Blocking reads can only be used with files, never with sockets
Blocking I/O pauses your program until the operation can complete. Non-blocking I/O returns right away either way -- with actual data if available, or an error (commonly EAGAIN/EWOULDBLOCK) meaning 'try again later' if not -- which is the mode typically paired with select/poll/epoll-style readiness notification.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES15146#UnixIPC