A strong answer
A strong candidate frames What is the FD_SETSIZE limitation of select? around the exact memory layout, compiler semantics, and hardware execution model covered in Synchronous Multiplexing: Non-Blocking Descriptors, select, and poll. Explain select's fixed fd_set size (typically 1024) and why poll/epoll scale beyond it.
If Client A connects and completes the TCP handshake, the server advances to read(client_fd, ...).
- If Client A immediately transmits its request, the read returns, the server replies, and the loop repeats.
- But if Client A opens the connection and transmits nothing (due to network latency, a slow mobile connection, or an intentional Slowloris denial-of-service attack),
read()blocks indefinitely. - While the server is blocked waiting for Client A, no other client can connect. Even if 50 other clients are queued in the kernel Accept queue waiting to be accepted, the server cannot call
accept().
In Module 4, we saw that spawning a thread per client (pthread_create) alleviates this issue at the cost of high memory overhead and scheduler thrashing under 10,000+ connections.
In a production interview, always connect the specification rule to its concrete runtime consequence: state what lives on the stack versus the heap or static storage segment, how the compiler or operating system validates alignments, lifetimes, and error codes, and what happens under adversarial or boundary inputs (such as zero-length buffers, integer overflow, concurrent mutation, or partial I/O). Backing your explanation with a small trace of register/memory state transitions immediately separates senior systems engineers from candidates who only memorized syntax.
What the interviewer is listening for
- Mastery of core invariant: Configure file descriptors for non-blocking I/O using fcntl and handle EAGAIN/EWOULDBLOCK.
- Mastery of core invariant: Monitor multiple socket descriptors simultaneously using select and fd_set bitmasks.
- Mastery of core invariant: Eliminate FD_SETSIZE limitations and destructive bitmask overhead using poll and struct pollfd.
- Hardware and ABI awareness: Explaining how sizes, alignments, calling conventions, or kernel boundaries behave on real 64-bit targets rather than relying on implementation-defined assumptions.
- Defensive engineering: Naming the exact compiler flags (
-Wall -Wextra -Werror), static analyzers, or runtime sanitizers (-fsanitize=address,undefined,thread) that verify correctness in CI.
Common mistakes
- Explaining only surface syntax without tracing the underlying memory addresses, ownership lifetime, or kernel/user-space state transitions.
- Assuming undefined behavior (such as signed overflow, uninitialized reads, strict-aliasing violations, or dangling pointers) will "just work" because it passed an unoptimized
-O0debug build. - Ignoring return codes, partial reads/writes, alignment padding, or cleanup paths when an allocation or syscall fails midway through a function.