0
0
FreeRTOSprogramming~20 mins

Hard real-time vs soft real-time in FreeRTOS - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Real-Time Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Hard Real-Time Systems

Which statement best describes a hard real-time system?

AA system where every deadline must be met strictly, or the system fails.
BA system where missing a deadline occasionally is acceptable without serious consequences.
CA system that processes tasks without any timing constraints.
DA system that prioritizes tasks randomly without deadlines.
Attempts:
2 left
💡 Hint

Think about what happens if a deadline is missed in safety-critical systems.

Predict Output
intermediate
2:00remaining
Task Priority Impact on Deadline in FreeRTOS

Consider two FreeRTOS tasks: TaskA with priority 3 and TaskB with priority 2. TaskA must complete within 10ms. What happens if TaskB runs longer than expected?

What is the likely outcome regarding TaskA's deadline?

FreeRTOS
void TaskA(void *pvParameters) {
  // Critical task
  for(;;) {
    // Must finish within 10ms
    vTaskDelay(pdMS_TO_TICKS(5));
    // Perform critical work
  }
}

void TaskB(void *pvParameters) {
  for(;;) {
    // Runs longer than expected
    vTaskDelay(pdMS_TO_TICKS(20));
  }
}
ATaskA may miss its deadline if TaskB blocks system resources.
BTaskA will always meet its deadline because it has higher priority.
CTaskB will preempt TaskA causing TaskA to miss its deadline.
DBoth tasks run simultaneously without affecting each other.
Attempts:
2 left
💡 Hint

Remember how FreeRTOS schedules tasks based on priority.

Predict Output
advanced
2:00remaining
Soft Real-Time Deadline Miss Behavior

In a soft real-time system, what is the typical behavior when a task misses its deadline?

Consider this FreeRTOS task code snippet:

void SoftTask(void *pvParameters) {
  for(;;) {
    // Simulate variable processing time
    vTaskDelay(pdMS_TO_TICKS(rand() % 15));
    // Process data
  }
}
AThe system halts immediately upon deadline miss.
BThe system raises a hard fault and resets.
CThe task is killed and restarted automatically.
DThe task continues running; occasional deadline misses are tolerated.
Attempts:
2 left
💡 Hint

Soft real-time systems allow some flexibility in timing.

🧠 Conceptual
advanced
1:30remaining
Choosing Between Hard and Soft Real-Time

Which scenario best requires a hard real-time system?

AA weather app updating forecasts every hour.
BA video streaming app where occasional frame drops are acceptable.
CAn industrial robot arm controlling precise movements in a factory.
DA background file backup process running overnight.
Attempts:
2 left
💡 Hint

Think about when timing failures cause physical harm or damage.

🔧 Debug
expert
2:30remaining
Diagnosing Deadline Miss in FreeRTOS Hard Real-Time Task

A FreeRTOS hard real-time task sometimes misses its deadline. Which of the following code snippets is the most likely cause?

void HardTask(void *pvParameters) {
  for(;;) {
    // Critical work
    vTaskDelay(pdMS_TO_TICKS(5));
    // Heavy processing
    for(int i=0; i<1000000; i++) {
      // Busy wait
    }
  }
}
AThe busy wait loop blocks the CPU, preventing timely task switching.
BThe task priority is too high, causing starvation of other tasks.
CThe vTaskDelay call causes the task to run too often.
DThe task uses too little CPU time, so deadlines are missed.
Attempts:
2 left
💡 Hint

Consider how busy waiting affects multitasking in FreeRTOS.