0
0
FreeRTOSprogramming~20 mins

Real-time vs general-purpose OS in FreeRTOS - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Real-time OS Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Key difference between Real-time OS and General-purpose OS

Which statement best describes the main difference between a Real-time Operating System (RTOS) and a General-purpose Operating System (GPOS)?

ARTOS guarantees task completion within strict time limits; GPOS focuses on maximizing throughput without strict timing guarantees.
BGPOS always runs tasks faster than RTOS because it uses more CPU cores.
CRTOS cannot run multiple tasks simultaneously, while GPOS can run many tasks at once.
DGPOS is designed only for embedded devices, while RTOS is for desktop computers.
Attempts:
2 left
💡 Hint

Think about what makes real-time systems special in terms of timing.

Predict Output
intermediate
1:30remaining
Task scheduling behavior in FreeRTOS

Consider two tasks in FreeRTOS: Task A with higher priority and Task B with lower priority. If both are ready to run, which task will the scheduler run first?

ATask B runs first because FreeRTOS uses round-robin scheduling regardless of priority.
BTask B runs first because tasks are run in the order they were created.
CBoth tasks run simultaneously on separate cores by default.
DTask A runs first because FreeRTOS always runs the highest priority ready task.
Attempts:
2 left
💡 Hint

Remember how priority affects task scheduling in FreeRTOS.

Predict Output
advanced
2:00remaining
Output of FreeRTOS task delay example

What will be the output of the following FreeRTOS code snippet?

void Task1(void *pvParameters) {
    for (;;) {
        printf("Task1 running\n");
        vTaskDelay(pdMS_TO_TICKS(1000));
    }
}

void Task2(void *pvParameters) {
    for (;;) {
        printf("Task2 running\n");
        vTaskDelay(pdMS_TO_TICKS(500));
    }
}

Assuming both tasks start at the same time and have the same priority, what is the expected output pattern?

AOnly Task1 prints because Task2 is blocked indefinitely.
BTask1 and Task2 print alternately every 1000ms each.
CTask1 running every 1000ms and Task2 running every 500ms, with Task2 printing twice as often.
DBoth tasks print simultaneously every 500ms.
Attempts:
2 left
💡 Hint

Consider how vTaskDelay affects task execution timing.

🔧 Debug
advanced
2:00remaining
Identify the error in FreeRTOS task creation

What error will occur when running this FreeRTOS code snippet?

void main() {
    xTaskCreate(TaskFunction, "Task", 100, NULL, 2, NULL);
    vTaskStartScheduler();
}

void TaskFunction(void *params) {
    for (;;) {
        // Task code
    }
}

Note: The task function is defined after main.

ACompilation error because TaskFunction is used before it is declared.
BRuntime error because the task stack size is too small.
CNo error; the code runs correctly.
DLinker error due to missing FreeRTOS library.
Attempts:
2 left
💡 Hint

Think about C language rules for function usage.

🚀 Application
expert
2:30remaining
Choosing OS type for a safety-critical embedded system

You are designing a safety-critical embedded system that must respond to sensor inputs within 10 milliseconds to avoid hazards. Which OS type is best suited for this system?

AA General-purpose Operating System (GPOS) because it supports more applications.
BA Real-time Operating System (RTOS) because it guarantees task deadlines are met.
CNo OS, just run bare-metal code for fastest response.
DA batch processing OS because it handles tasks in groups efficiently.
Attempts:
2 left
💡 Hint

Consider the importance of timing guarantees in safety-critical systems.