General Alternative: Event-Driven Systems
If handling an event requires waiting for I/O to complete, the thread arranges for another event to notify it of completion, and keeps going, e.g., asynchronous non-blocking I/O.
Structure the code as a single thread that responds to a series of events, each of which carries enough state to determine what is needed and “pick up where we left off”.
Question: in what order should events be delivered?