From 14cb84545cd133fd0e95e1db66609bee2c82da4a Mon Sep 17 00:00:00 2001 From: flip111 <flip101@gmail.com> Date: Sun, 17 Feb 2019 21:37:45 +0000 Subject: [PATCH 1/2] Update index.md --- src/concurrency/index.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/concurrency/index.md b/src/concurrency/index.md index 5d432f9d..97188d47 100644 --- a/src/concurrency/index.md +++ b/src/concurrency/index.md @@ -140,8 +140,10 @@ _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 — which comes at a cost to overhead and interrupt -latency and jitter. +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. 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 From a65223fe58cf3cdc022944dbb51e4d96f33631cc Mon Sep 17 00:00:00 2001 From: James Munns <james.munns@ferrous-systems.com> Date: Sun, 26 Apr 2020 19:23:36 +0200 Subject: [PATCH 2/2] Apply suggestions from @adamgreig --- src/concurrency/index.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/concurrency/index.md b/src/concurrency/index.md index 97188d47..f11701bd 100644 --- a/src/concurrency/index.md +++ b/src/concurrency/index.md @@ -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