2 ms·
You can hand off data with channels without any copy. That you think mutexes work in constant time is funny. How long it takes to enter a mutual exclusion sect
by mgaunard 4y ago
You can hand off data with channels without any copy.
That you think mutexes work in constant time is funny. How long it takes to enter a mutual exclusion section is entirely non-deterministic and unbounded.
- samsquire 4y agoOnce the mutex is acquired, you can move any amount of data with a pointer. This is what I meant.
- mgaunard 4y agoWhile the mutex is held, everybody else that is in contention is waiting, possibly forever. It's a terrible paradigm not suitable for any serious systems programming, especially if you have any sort of real-time requirements.
- preseinger 4y agomutexes are a primitive that guarantee access to a resource is synchronized, and only one actor is accessing it at a time this necessarily requires actors in contention to wait, possibly forever it is a fundamental paradigm that is used extensively throughout every kind of programming, even in real-time systems
- mgaunard 4y agoIt isn't used in real-time systems no, it's fundamentally incompatible. Check out wait-free algorithms.
- preseinger 4y agosynchronization requires serialized access, regardless of the nature of the consumer system (real-time or not) wait-free algorithms might use spin-locks instead of typical mutexes, but spin-locks aren't like better or faster than mutexes, they just replace syscall/io waits with hot waits