RTOS & Real-Time Concepts · Interview question

Sketch how you'd structure a FreeRTOS app that processes UART data without losing bytes.

A strong answer

I'd use the deferred-interrupt pattern with a queue. Create a queue sized for the worst-case burst (xQueueCreate). The UART RX ISR does the minimum: read the data register and xQueueSendFromISR the byte into the queue, then portYIELD_FROM_ISR(woken) so that if a higher-priority consumer was unblocked, the scheduler switches to it on ISR exit. A dedicated worker task blocks on xQueueReceive(..., portMAX_DELAY), waking to process each byte, so it consumes no CPU while idle and wakes promptly when data arrives. Because the queue copies by value and buffers depth-many items, the fast ISR and slower task are decoupled and bytes aren't lost as long as the queue depth covers the burst and the worker keeps up on average. If the worker updates shared state (counters, a parser context shared with other tasks), it protects that with a mutex (xSemaphoreCreateMutex) held only briefly. I'd give the worker a higher priority than background/reporting tasks so received data is handled promptly, set the UART ISR priority at or below configMAX_SYSCALL_INTERRUPT_PRIORITY so its FromISR call is legal, and for very high rates escalate to DMA into a buffer with a half/full-transfer interrupt rather than per-byte interrupts. The structure is: ISR produces to queue → worker task consumes → mutex guards any shared state.

What a weak answer sounds like

You know the answer. Do you know what gets you dinged?

Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.

From the lesson

FreeRTOS: A Practical Tour

Tying it together: the FreeRTOS API mapped to every concept (tasks, queues, mutexes, timers, notifications), a worked ISR-to-task app, key FreeRTOSConfig.h knobs, heap schemes, and debugging.

More FreeRTOS: A Practical Tour questions

Browse all 472 interview questions
Sketch how you'd structure a FreeRTOS app that processes UART data without losing bytes. | EmbeddedPrep.io