0

The test-and-set instruction is a very important CPU instruction for achieving atomic locks.

Is there a similar operation for the filesystem on linux/mac/windows?

Use case: A database program might be storing data in files. This instruction would be useful to ensure no changes occur to a file by another process while an operation is in progress.

David Callanan
  • 4,570
  • 4
  • 54
  • 90
  • **Edit**: This is similar to an existing question: https://stackoverflow.com/questions/28417765/compare-and-swap-over-posix-compliant-filesystem-objects – David Callanan Dec 01 '21 at 17:47

0 Answers0