kprotty/usync

Fairness

tbu- opened this issue · 2 comments

tbu- commented

Interesting project, got here from Reddit.

Some questions after reading the README:

  1. Is the mutex fair or eventually fair, i.e. does it guarantee that no thread can permanently starve another?
  2. What are the disadvantages and advantages compared to parking_lot? Quickly skimming the README of parking_lot suggests that their synchronization structures are also ≤ 1 word large, but even that information would be interesting in the README IMO.
  1. No, it relies on the OS scheduler for fairness but tries to wake up threads in FIFO order to imply less unfair scheduling. See here for more. It looks like docs.rs isn't working atm and i'm not sure why.

  2. Advantages and disadvantages are listed in the README. It also does no heap allocations for the global table unlike in parking_lot (meaning it can be used in #[global_allocator] or whatever the lang attribute was). Run the benchmarks or use it locally to decide practical advantage.

tbu- commented

Thanks for the answers.

I'm not that familiar with synchronization primitives and also wouldn't know how to benchmark them, but I understand the #[global_allocator] use case.