Skip to content

Commit

Permalink
Apply suggestions from @adamgreig
Browse files Browse the repository at this point in the history
  • Loading branch information
James Munns committed Apr 26, 2020
1 parent 14cb845 commit a65223f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/concurrency/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,7 @@ for two reasons:
If `COUNTER` was being shared by multiple interrupt handlers that might
_preempt_ each other, then each one might require a critical section as well.

This solves our immediate problem, but we're still left writing a lot of
`unsafe` code which we need to carefully reason about, and we might be using
critical sections needlessly. Each critical section adds a small amount of
code size. Also delay of interrupts (latency) and varying delay between
repetitive interrupts (jitter) can be added, which is often worse because the
system will be less capable of handling real time events.
This solves our immediate problem, but we're still left writing a lot of unsafe code which we need to carefully reason about, and we might be using critical sections needlessly. Since each critical section temporarily pauses interrupt processing, there is an associated cost of some extra code size and higher interrupt latency and jitter (interrupts may take longer to be processed, and the time until they are processed will be more variable). Whether this is a problem depends on your system, but in general we'd like to avoid it.

It's worth noting that while a critical section guarantees no interrupts will
fire, it does not provide an exclusivity guarantee on multi-core systems! The
Expand Down

0 comments on commit a65223f

Please sign in to comment.