Skip to main content
InterviewHubPRO
Section Overview
Q11

Question 11 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

22%
Redis & Caching (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

How does the single-threaded Event Loop work in Redis?

senior LevelMost AskedEvent LoopSystem Design

In Simple Words: Redis's core request-processing loop runs on a single main execution thread:

  • Built around I/O multiplexing primitives (epoll on Linux, kqueue on macOS).
  • The operating system notifies the event loop when a socket has incoming data to read or is ready to write.
  • Redis processes commands in memory sequentially in nanoseconds without thread synchronization locks.
  • Redis 6.0+ I/O Threading: Socket network reading and writing (parsing RESP protocol) can be delegated to auxiliary threads, but command execution remains strictly single-threaded and lock-free.