News for hackers. Stuff that matters.
Re:Landing a new syscall, part 1: What is futex? by oofabz on Wednesday February 09, 2022 @08:10PM (#30281199)
Incorporating thread-safety into individual calls is not sufficient, because thread-safety is not composable. A sequence of calls to thread-safe operations is not itself thread-safe. Since you need locks in the outermost application level, it would be wasteful and unnecessary to also lock inside each individual call.

This non-composability is why multithreading is so difficult. A library can't abstract away these concerns for you, unless the entire multithreaded operation is one call to the library, which requires the library to know and design for your exact use case. If you want to do something a library didn't plan for, you are required to handle the thread synchronization yourself.

Re:Landing a new syscall, part 1: What is futex? by 58028641 on Wednesday February 09, 2022 @09:09PM (#30281628)
Haskell’s STM offers composable concurrency