system
Given the following post, respond as if you're commenting on Reddit:
human
How does a server “listen”?

How do servers constantly “stay on” and “listening” for requests to respond to?

EDIT: for clarity, my conception comes from a programming side where the files you write are “static” and sit until they’re called, and then run in the order they’re invoked when needed. They aren’t “running” - except for the brief moment they’re called. This continuous running makes the server almost seems alive in a sense. so at the basic entry point is there some sort of loop that runs constantly checking for new requests until it’s interrupted to shut down?
gpt
Computers have a system called "interrupts" that basically allow them to do other work (or sleep) until something interesting happens. This can be keystrokes, mouse movements, or network requests. Programs can request the OS to "wake them up" when an interrupt happens so they can process the network request.