Urgent.News

What's breaking now, across thousands of outlets.

Tech

Cancelation Terminology

Cancelation terminology encompasses three primary concepts: synchronous cancelation, asynchronous cancelation, and graceful shutdown. Although the author does not hold strongly to these specific terms, they emphasize the importance of distinguishing between them. Synchronous cancelation functions like a control flow structure, unwinding the stack.

It emerges frequently in error handling scenarios, prompting the termination of loops, conditionals, and blocks while invoking necessary cleanup actions. Asynchronous cancelation, on the other hand, constitutes a communication protocol between two entities. One entity requests cancelation, subsequently awaiting the acknowledgment of the other party and the corresponding shutdown.

Asynchronous cancelation finds application in scenarios such as CPU thread pools and io_uring, where cancelation requests necessitate waiting for partial work to complete. Graceful shutdown represents an application programming pattern for managing connections. In web services, graceful shutdown involves terminating the accept loop while continuing to serve existing connections until they are individually closed by their respective clients.

This approach facilitates rolling upgrades without disrupting service. Additionally, the concept of crash-only software introduces a related idea, wherein software is designed to withstand abrupt terminations, such as memory allocation failures or power loss, without compromising data integrity. In TigerBeetle, Grid.cancel exemplifies an asynchronous cancelation mechanism, allowing replicas to cancel outstanding grid read operations when necessary.

StateMachine.reset, another synchronous cancelation example, simplifies code implementation by differentiating between asynchronous and synchronous cancelation.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at matklad.github.io →

More in Tech

More from Monday 31 August →