All jobs / Embedded / hardware / RTOS
Embedded / hardware interview question · 1–3 years
Two tasks write a global “state” byte. What is the grown-up move?
The strongest answer
A queue or a critical section I can name — I do not add a delay to “let the other one finish”
Why it works
Exactly. A real exclusion. Volatile is visibility, not a lock. Sleeps and prints are folklore.
What a good answer covers
- Queue or named critical section.
- No luck delays.
- volatile ≠ exclusion.
- Printf ≠ a lock.
Answers that fall short
- Close, but not the strongest: A 1 ms sleep for luck
Luck is jitter. - Weak: Make it volatile and call it solved
Volatile ≠ mutex. - Red flag: Print from both; prints serialise
UART is not a lock.
Who gets asked this
More RTOS questions
- A low-priority task holds a lock a high-priority task needs. What do you name?
- One task corrupts another’s stack. What do you add besides “be careful”?
- You have a 2 ms control deadline. What number do you present?
- A low-priority logger never runs. What do you check before “buy a faster MCU”?
- Two teams share one firmware, each has added mutexes, and you have now had two hangs that reproduce about…
- What does a staff engineer pin on the wall for a control product?
- When do you reach for a mutex, and when for a binary semaphore?
- When do you pick an RTOS over a main-loop, and when not?