All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Catalog of Atomic Operations in UNIX/POSIX Systems for Thread-Safe Programming

By

onurkanbkrc

3mo ago· 5 min readen

Summary

This article presents a catalog of atomic operations available in UNIX-like/POSIX-compliant operating systems that can be used as building blocks for creating thread-safe and multi-process-safe programs without requiring mutexes or read/write locks. The author advocates for leveraging kernel-level atomic operations rather than implementing custom locking mechanisms, arguing that kernel developers are more trustworthy and that it's inefficient to lock around operations that are already atomic at the kernel level. The catalog is presented as a living document expected to be updated frequently.

Key quotes

· 4 pulled
This is a catalog of things UNIX-like/POSIX-compliant operating systems can do atomically, making them useful as building blocks for thread-safe and multi-process-safe programs without mutexes or read/write locks.
The philosophy here is to let the kernel do as much work as possible. At my most pessimistic, I trust the kernel developers more than I trust myself.
More practically, it's stupid to spend CPU time locking around an operation that's already atomic at the kernel level.
The list is by no means exhaustive and I expect it to be updated frequently for the foreseeable future.
Snippet from the RSS feed
This is a catalog of things UNIX-like/POSIX-compliant operating systems can do atomically, making them useful as building blocks for thread-safe and multi-process-safe programs without mutexes or read/write locks.  The list is by no means exhaustive and I

You might also wanna read