Which statement best describes the main difference between a Real-time Operating System (RTOS) and a General-purpose Operating System (GPOS)?
Think about what makes real-time systems special in terms of timing.
RTOS is designed to guarantee that tasks finish within specific time limits (deadlines), which is critical for real-time applications. GPOS prioritizes overall system throughput and user experience but does not guarantee strict timing.
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?
Remember how priority affects task scheduling in FreeRTOS.
FreeRTOS scheduler always selects the highest priority task that is ready to run. Lower priority tasks run only when higher priority tasks are blocked or suspended.
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?
Consider how vTaskDelay affects task execution timing.
Task1 delays for 1000ms after each print, so it prints once per second. Task2 delays for 500ms, so it prints twice as often. Both run independently with same priority.
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.
Think about C language rules for function usage.
In C, functions must be declared before use or a prototype must be provided. Using TaskFunction before its declaration causes a compilation error.
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?
Consider the importance of timing guarantees in safety-critical systems.
RTOS is designed to guarantee that tasks complete within strict deadlines, which is essential for safety-critical systems requiring timely responses.