What is the difference between running tasks sequentially and running them concurrently under a scheduler?
Sequential tasks run one after another in a fixed loop, so each waits for all the others; concurrent tasks are managed by a scheduler that switches between them, so each appears to run at the same time and urgent work is not stuck behind slow work.
The example is a voice-memo device with four jobs: update the LCD, scan the keys, record audio, play audio.
- Sequentially, the program loops Task 1 → 2 → 3 → 4 → 1. If recording a buffer of audio takes a while, the keys are not scanned during that time, so a button press can be missed, and audio samples can arrive late.
- Concurrently, a task scheduler interleaves them. Recording and playback, which have hard timing, get high priority and run whenever their data is due. Key scanning runs often but briefly. The LCD update fills the gaps.
On a single-core microcontroller only one instruction stream runs at a time, so concurrency here is an illusion created by fast switching. The result still behaves as if the tasks run in parallel, and each task can be written as a simple independent loop instead of one tangled main loop.
Tip: concurrency is about structure (independent tasks), parallelism is about hardware (multiple cores).