News for hackers. Stuff that matters.
Re:Fast, simple, hard real time allocator for Rust by couchand on Thursday May 02, 2024 @07:29AM (#40234909)
Any uc worth programming on has interrupts!
Re:Fast, simple, hard real time allocator for Rust by TrueDuality on Thursday May 02, 2024 @08:28AM (#40235383)
Even with interrupts there is almost always a single execution unit, and thus single-threaded. An interrupt is just a jump instruction to a predefined handler. The code that was running is entirely stopped until the system decides to resume from that point.
Re:Fast, simple, hard real time allocator for Rust by couchand on Thursday May 02, 2024 @09:13AM (#40235838)
That doesn't mean that naive single-threaded code is necessarily interrupt-safe. If the allocator is interrupted and the interrupt service routine needs to make use of the allocator's data structures for any reason there could very much be a conflict.

This particular algorithm is focused on GPUs, so I'm not clear on the applicability. However I did want to clear up the idea that there are no concurrency concerns for single-threaded library code, an assumption that's been the source of many bugs.

Re:Fast, simple, hard real time allocator for Rust by loeg on Thursday May 02, 2024 @12:32PM (#40238148)
The presence of interrupts is basically equivalent to not being single threaded, though. There are true single-threaded environments, it's just limited to userspace processes that don't handle signals.
Re:Fast, simple, hard real time allocator for Rust by gpderetta on Friday May 03, 2024 @05:55AM (#40245910)
It is even worse: re-entrancy safe is a different property than thread-safe. For example you can't use mutexes to guarantee mutual exclusions with interrupts.

Some algorithms are both thread safe and reentrancy safe, but generally this is not the case.