Concurrency and threads
Mon Jan 21, 2019 · 210 words

Threads are not ‘free’. Threads come with significant cognitive overhead and management complexity.

Overheads of threading

Good reasons to use threads

Bad reasons to use threads

In general, many embedded systems are overly-threaded. This leads to inefficient, bloated and overly-dynamic complex code. Concurrency is quite often a form of “accidental complexity”, i.e. complexity that is not inherent to the problem we’re solving, but rather complexity we have added ourselves due to our design.

There are valid reasons for using threads, for example when interfacing a software-system to the outside world. Interactions of this form are truly asynchronous and should have threads associate with them. This leads to a common pattern where the input/sensor devices have threads driving the input through the system to some output.


back · Articles · Who am I? ·