Skip to content

Commit

Permalink
update feature advaantages over std
Browse files Browse the repository at this point in the history
  • Loading branch information
yjhn authored Sep 4, 2022
1 parent e44aceb commit f8b804f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ The primitives provided by this library have several advantages over those
in the Rust standard library:

1. `Mutex` and `Once` only require 1 byte of storage space, while `Condvar`
and `RwLock` only require 1 word of storage space. On the other hand the
standard library primitives require a dynamically allocated `Box` to hold
OS-specific synchronization primitives. The small size of `Mutex` in
particular encourages the use of fine-grained locks to increase
parallelism.
and `RwLock` only require 1 word of storage space. On the other hand on
some platforms (macOS and a few others) the standard library primitives
require a dynamically allocated `Box` to hold OS-specific synchronization
primitives. The small size of `Mutex` in particular encourages the use
of fine-grained locks to increase parallelism.
2. Since they consist of just a single atomic variable, have constant
initializers and don't need destructors, these primitives can be used as
`static` global variables. The standard library primitives require
dynamic initialization and thus need to be lazily initialized with
`lazy_static!`.
`static` global variables.
3. Uncontended lock acquisition and release is done through fast inline
paths which only require a single atomic operation.
4. Microcontention (a contended lock with a short critical section) is
Expand Down

0 comments on commit f8b804f

Please sign in to comment.