Tag: tech

How Operating Systems and Hardware Enforce Atomicity

From File Systems to Transistors: How Operating Systems and Hardware Enforce Atomicity - Part 1 AI Generated Problem Statement: If two CPU cores attempt the same operation at almost exactly the same instant—such as creating temp.txt with O_CREAT | O_EXCL—why does only one succeed? Every backend engineer has relied on file-system atomicity. Creating a lock file with open(..., O_CREAT | O_EXCL) or using mkdir() as a lock are common synchronization techniques. Read more...

Long Polling

Explanations of Long Polling start with the server “holds the connection open.”. To understand Long Polling, it helps to go one level lower than HTTP. Suppose a client wants to fetch messages. GET /messages The HTTP request is converted into bytes, passed to TCP, encapsulated into IP packets and sent over the network. Before any HTTP request is sent, TCP establishes a connection. Client Server SYN ----------------------> <------------------- SYN-ACK ACK ----------------------> Once this handshake completes, the client and server have an established TCP connection. Read more...