Quiz 1 Flashcards
There are two types of real-time systems, what are they?
Hard real-time systems and soft real-time systems
What is the difference between hard and soft real-time systems
Hard real-time systems are strictly adherent to deadlines, where timing is absolutely vital.
Soft real-time systems are more forgiving, where occasional timing breaches do not cause critical failure.
The primary difference between the two is based on their tolerance for timing constraints.
To coordinate the process of sharing the CPU between multiple tasks, RTOS uses a program called a ________________
Kernel
What four things is an RTOS responsible for?
- Task management (scheduling/dispatching)
- Communication between tasks
- Input and output management
- Memory management
True or False: An RTOS can run tasks in parallel
False, an RTOS can switch between tasks (run concurrently) but they cannot be run in parallel
True or False: Tasks executions are asynchronous to each other
True
What is an event?
An event is defined as a change in the signals (hardware) or in the variables (software)
What are the two types of events that could occur?
Periodic: An event with a deterministic period
Sporadic: Non-periodic and non-deterministic
True or False: The minimum time between sporadic events must be known
True, or else all events may not be captured
To detect an event, input signals can be ___________________________ to synchronize real-time events with the program
Sampled periodically
If you are given the task execution time, T, and the period, P, how can you calculate the load on the CPU?
Divide the task execution time by the period (L = T/P)
If you are given multiple task execution times and periods, how can you calculate the load on the CPU?
Find the sum of all execution times divided by their periods (L = T1/P1 + T2/P2 + … + Tn/Pn)
True or False: The necessary condition for a design to be realizable is L > 1
False, L (load on CPU) must be less than or equal to 1
True or False: Given the time required to make one pass through the sampling loop, S, and the time required to update the outputs, D, the worst-case response time, R, is:
R <= S + D ~= 2S
True
What are the three different types of event detection
- Level detection
- Flag detection
- Edge detection
Event detection can be done by _________ in a free-running event loop
Polling
What is the formula for polling time in a level-detection free-running event loop
T_poll = T_det + T_srv < T_ep + T_et_2 - T_et_1
What is the formula for polling time in a flag-based free-running event loop
T_poll = T_det + T_srv < T_ep
What is the condition to detect edges in a free-running event loop
2*T_det + T_srv < T_ep
What is the formula for the response time from an event becoming active to the time the response is made in a free-running event loop
T_R = T_poll + T_det + T_srv + T_cir
True or False: CPU load can be decreased by using hardware
True
An ______________ is a hardware solution for both event detection and changing the program flow
Interrupt
What is a problem with using interrupts in multitask systems?
It results in nondeterministic timings and can interrupt a task in the middle of it. To address this, the CPU context must be saved prior to servicing the interrupt (referred to as a context switch)
What is a timed event loop?
A programming construct that executes code at regular intervals, ensuring multiple tasks can run at regular intervals
True or False: Timed event loops makes scheduling and executing multiple tasks possible
True
To not miss an event, the event signal must be sampled with a period, P, that is ________ than the event time
Less
The response time of a timed event loop is _________ than a free-running loop
Longer
A ________ is needed to coordinate task executions
Kernel
To coordinate tasks, either the kernel must ________ tasks or tasks themselves must _________ to share the CPU
Preempt/Interrupt, cooperate
What is the difference between a preemptive kernel and a cooperative kernel
Cooperative kernel relies on each task to cooperate in execution, where tasks run until they reach a point where they can voluntarily yield the processor to enable another task to run.
Preemptive kernel determines which task should run at any given time and may preempt one task to run another task.
What is the condition for proper switch debouncing?
The sampling period must be less than the bounce time (S < B)
What is the two-step validation method for switch debouncing?
Read the switch twice in consecutive polling cycles. If the state remains the same, register the press
What is mutual exclusion in task scheduling?
Tasks take turns running in different time slices to prevent interference while keeping their original periods
When does mutual exclusion NOT help?
When a task is too long to fit in its allocated time slot
What is task decomposition?
Splitting a long task into smaller parts so it can run in multiple cycles without blocking other tasks
What are the two types of task decomposition?
Co-routines: The task pauses and resumes in multiple cycles
State decomposition: The task is broken into steps that run in separate time slices
When should task decomposition be used?
When a task’s execution time is longer than the required period of another task
Tasks an be decomposed into shorter pieces using a ____________________
State machine
What are the most important features of a real-time program?
- Deterministic timing
- Predictable
- Priority management
- Interrupt handling
- Concurrency handling