Real-Time Systems and Scheduling
- 71Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What two aspects define a real-time system, and what is the central timing responsibility of its operating system?
71 questions
- 1
What two aspects define a real-time system, and what is the central timing responsibility of its operating system?
Model answer
A real-time system has both temporal and functional aspects. Its operating system must handle tasks’ timing constraints and deadlines.
Explanation
The operating system’s ability to deal with the temporal aspect is described as its timeliness.
- 2
Why is average response time an inadequate measure of performance in a real-time system?
Model answer
Meeting deadlines matters for each individual response, so an average can hide a response that misses its deadline.
Explanation
Real-time performance focuses on whether deadlines are met, rather than on average response time.
- 3
How does predictability differ from speed in a real-time system?
Model answer
Predictability means being able to estimate how long tasks or jobs will take; it is not the same as being fast or having high average performance.
Explanation
A system can perform quickly yet unpredictably, whereas real-time systems prioritize predictable execution.
- 4
How does the value of completing a task after its deadline differ in soft, firm, and hard real-time systems?
Model answer
In a soft system, value declines after the deadline; in a firm system, it becomes zero; in a hard system, missing the deadline can incur a penalty or serious harm.
Explanation
The three categories distinguish how the consequences of a missed deadline affect task utility.
- 5
What happens to the value of a task in a soft real-time system if it finishes before its deadline, and if it finishes increasingly late?
Model answer
It provides full value if completed by the deadline. Afterward, its value declines linearly until it reaches zero.
Explanation
In the described soft-deadline model, completing the task after value has fallen to zero provides no value.
- 6
Why is a late task worthless in a firm real-time system?
Model answer
A firm task provides full value if it finishes by its deadline, but no value if it finishes after the deadline.
Explanation
Unlike a soft system, a firm system does not assign gradually declining value to late completion.
- 7
What makes a missed deadline especially serious in a hard real-time system?
Model answer
Missing a deadline can cause a negative utility or severe consequences, such as danger to human life.
Explanation
Engine and flight-control systems are examples where a late response can have serious consequences.
- 8
How do the examples of computer simulations, user interfaces, cruise control, and flight control illustrate the range of real-time requirements?
Model answer
Simulations may have no strict deadline, user interfaces value responsiveness, cruise control is soft real-time, and flight control can require hard real-time behavior.
Explanation
These examples illustrate a spectrum from systems with little timing urgency to systems where missing a deadline can be dangerous.
- 9
How does the main scheduling objective differ between general-purpose and real-time operating systems?
Model answer
General-purpose systems commonly aim for high throughput or average performance, while real-time systems focus on meeting each task’s timing requirements and controlling worst-case response time.
Explanation
The real-time objective emphasizes individual task deadlines rather than aggregate performance.
- 10
What does it mean to provide predictability guarantees for a real-time workload?
Model answer
It means being able to establish that tasks will meet their deadlines when specified workload criteria are satisfied.
Explanation
For example, the lecture describes a guarantee under a stated condition involving system utilization.
- 11
Why are fault tolerance, peak-load design, and maintainability desirable properties of real-time systems?
Model answer
Fault tolerance helps isolate failures instead of allowing one fault to crash the whole system; peak-load design and maintainability support reliable operation under demanding conditions and ongoing system changes.
Explanation
The lecture identifies all three as important properties, particularly in systems where failures can have serious effects.
- 12
Why can ordinary multitasking and scheduling mechanisms be unsuitable for real-time systems?
Model answer
They are often designed to maximize general performance and may not provide the predictable timing needed to meet deadlines.
Explanation
The lecture identifies multitasking and scheduling as major areas of difference between general-purpose and real-time systems.
- 13
How can DMA create timing unpredictability for a high-priority CPU task?
Model answer
DMA lets an I/O device transfer data without continuous CPU involvement, but the device and CPU may share a memory bus. Heavy device use can delay CPU memory access and backlog the task.
Explanation
DMA can improve general-purpose performance while making the CPU’s access to the shared bus less predictable.
- 14
How can time-slicing a bus shared by the CPU and I/O devices improve predictability?
Model answer
It gives the CPU a known share of bus access, allowing its memory-transfer time to be estimated even when I/O devices also need the bus.
Explanation
Without allocated time slices, bursts of I/O traffic can make the CPU’s access delay unpredictable.
- 15
Why can processor caches make execution time less predictable in a real-time system?
Model answer
A memory access takes different amounts of time depending on whether its data is cached; a cache miss may require slower memory access or, in some cases, disk access.
Explanation
The system may not know in advance whether a particular access will be a fast cache hit or a slower miss.
- 16
What is one way to avoid cache-related timing variability, and what trade-off does it involve?
Model answer
A system can use a processor without caches or disable caches, avoiding cache-hit and cache-miss timing variation. The trade-off is losing the performance benefit caches provide.
Explanation
The lecture describes removing caches as a possible, if drastic, real-time design choice.
- 17
Why might assuming a cache miss for every access still make whole-workload analysis difficult?
Model answer
Even if a worst-case time can be estimated for one task, execution-time variation across chains of related tasks can complicate guarantees for the workload as a whole, especially when tasks share locks or mutexes.
Explanation
The lecture notes that considering best-case, worst-case, and intermediate execution times across many related tasks can make whole-workload analysis difficult.
- 18
What protection benefit does virtual memory provide to processes?
Model answer
It gives each process a separate virtual address space and translates its virtual addresses to physical addresses.
Explanation
Separate virtual address spaces are used to provide process protection.
- 19
How do virtual and physical pages relate to address translation?
Model answer
Virtual memory and physical memory are divided into fixed-size pages, and address translation maps virtual pages to physical pages.
Explanation
Paging turns address translation into finding the physical page corresponding to a virtual page.
- 20
What information does a page table store?
Model answer
A page table stores the mappings that identify where virtual pages are located in physical memory.
Explanation
The operating system uses these mappings to translate virtual addresses.
- 21
What is a translation lookaside buffer, and why is it used?
Model answer
A translation lookaside buffer (TLB) is a small, processor-close cache of address translations. It avoids repeatedly retrieving translations from memory.
Explanation
Caching a previously used virtual-to-physical translation can reduce translation overhead.
- 22
How does a TLB hit differ from a TLB miss in its effect on address-translation time?
Model answer
A TLB hit supplies the translation quickly, while a miss requires obtaining the translation from memory and takes longer.
Explanation
This variation in translation time can undermine predictability.
- 23
What is one real-time alternative to virtual memory, and what trade-offs can it create?
Model answer
A system can use physical memory directly, avoiding variable translation behavior. This can reduce flexibility and create security risks because processes may lack the isolation provided by virtual memory.
Explanation
The lecture notes that this approach can be acceptable in some embedded or single-user systems, depending on the circumstances.
- 24
How does paging use physical memory, and why can it cause unpredictable delays?
Model answer
Paging uses physical memory as a cache for disk pages. When a needed page is absent and memory is full, the system may write an existing page to disk and load the needed one, which takes substantial time.
Explanation
The delay depends on whether the required page is already resident in memory.
- 25
How can pinning pages help a real-time task meet its deadlines?
Model answer
Pinning prevents the operating system from evicting selected pages, reducing the risk that the task will incur slow disk-based paging.
Explanation
Keeping the task’s pages in physical memory mitigates paging-related timing variability.
- 26
Why can system calls cause missed deadlines in a real-time operating system?
Model answer
System-call handlers may be non-preemptive and disable interrupts. A high-priority task that arrives while a long handler is running may be unable to take the processor promptly.
Explanation
Delaying a newly arrived task with a close deadline can make the system unpredictable and cause a deadline miss.
- 27
What is one proposed real-time approach to system-call handlers, and why can it help?
Model answer
System-call handling can allow preemption, so a more urgent task can reclaim the processor rather than waiting for a long handler to finish.
Explanation
The lecture presents preemptible handling as a feasible approach for reducing deadline delays.
- 28
Why are interrupts more difficult to handle predictably than system calls?
Model answer
System calls are initiated synchronously by the running task, whereas interrupts arrive asynchronously from external events that the task cannot control.
Explanation
The number and timing of external events can vary during task execution.
- 29
Why can making interrupt handlers freely preempt one another be problematic?
Model answer
Further interrupts can repeatedly preempt earlier handlers, potentially preventing an earlier interrupt from being handled promptly.
Explanation
The lecture warns that nested preemption can interfere with completing the initial interrupt’s work.
- 30
What is the basic idea of handling I/O by disabling device interrupts and having each task poll its own devices?
Model answer
Only the timer interrupt is kept, while each task performs its own I/O by polling the devices it needs.
Explanation
This moves device-handling logic into individual tasks rather than relying on device interrupts.
- 31
What predictability and kernel-maintenance benefits can result when tasks handle their own I/O by polling?
Model answer
Tasks are not interrupted by device events, and their polling transfers can be timed. The kernel need not be changed when device-handling logic is added to a task.
Explanation
The device-specific work is performed by the tasks rather than by kernel I/O routines.
- 32
What are two costs of putting device-polling logic in every task?
Model answer
Polling wastes CPU time, especially for infrequent events, and device logic must be duplicated or updated across affected tasks when devices change.
Explanation
Each task may need its own drivers or other logic to communicate with its devices.
- 33
How does periodic kernel polling of devices differ from having every task poll its own devices?
Model answer
Device-polling routines are placed in the kernel and run periodically, rather than being implemented separately in each task.
Explanation
The kernel routines check for device data and handle it when their timer-triggered execution occurs.
- 34
What advantages does periodic kernel polling offer compared with polling separately in every task?
Model answer
The design centralizes and isolates hardware details in the kernel, keeps those details out of tasks, and allows the routines’ execution time to be estimated.
Explanation
The approach preserves polling’s timing control while providing a more modular design.
- 35
What are the main disadvantages of periodic kernel polling?
Model answer
It still wastes CPU time, requires kernel changes when devices change, and can add communication hops and delay between a task and a device.
Explanation
The task’s I/O request may have to pass through the kernel before reaching the device.
- 36
What is the central idea of the lightweight-interrupt approach used in many real-time operating systems?
Model answer
Interrupt handlers and device drivers do as little work as possible, such as creating or waking a task that will handle the event.
Explanation
The detailed I/O work is delegated to tasks instead of being performed in a long interrupt handler.
- 37
How are tasks activated by a lightweight interrupt handled by the scheduler?
Model answer
They are treated like other tasks, with their own deadlines, rather than automatically receiving higher priority just because they handle device events.
Explanation
This lets the scheduler consider device-handling work within its ordinary task-scheduling framework.
- 38
What are the main advantages and costs of the lightweight-interrupt approach?
Model answer
It avoids busy waiting and minimizes interrupt-handler work, while reducing device-related communication compared with kernel polling. It still has some communication overhead and can retain unbounded delays, although the risk is reduced.
Explanation
The approach improves on polling methods but does not remove every source of delay.
- 39
How does the lightweight-task approach differ from traditional top-half and bottom-half interrupt handling as described in the lecture?
Model answer
Instead of performing substantial logic in interrupt halves, it minimizes handler work and creates or wakes a task to perform the event-specific work.
Explanation
The central distinction is delegating the actual handling to a task rather than implementing it within the interrupt halves.
- 40
Why can dynamic memory allocation make execution time unpredictable?
Model answer
Allocation algorithms such as first fit, best fit, or worst fit may search different amounts of the free-memory list before finding space.
Explanation
The time needed to locate a suitable block can vary from one request to another.
- 41
What is external fragmentation, and how can it cause an allocation to fail even when free memory remains?
Model answer
External fragmentation occurs when free memory is split into separate, noncontiguous blocks. A request for a larger contiguous block can fail even if the total free space is sufficient.
Explanation
A contiguous allocation cannot be satisfied by adding together separated free blocks.
- 42
Why may a memory allocator be unable to fix external fragmentation by moving allocated blocks?
Model answer
A program may have copied pointers to an allocated block, and the allocator cannot track every copy. Moving the block could leave those pointers referring to an invalid location.
Explanation
The lecture uses this pointer problem to explain why defragmentation is not always an option.
- 43
How can fixed-size memory blocks improve predictability, and what kind of fragmentation can they cause?
Model answer
Fixed-size blocks avoid searching for arbitrarily sized allocations, but a request may receive a block larger than it needs, wasting space through internal fragmentation.
Explanation
For example, a request for three units may be assigned a five-unit block, leaving some of the block unused.
- 44
Why do some real-time systems prohibit dynamic memory allocation?
Model answer
They can require needed memory to be allocated statically, avoiding unpredictable allocation time and fragmentation at the cost of flexibility.
Explanation
This approach trades flexible runtime allocation for greater predictability.
- 45
Why can recursion make it difficult to guarantee a real-time program’s execution time?
Model answer
If the number of recursive calls depends on runtime input or data, the recursion depth may be unpredictable or unbounded, making execution time difficult to guarantee.
Explanation
The lecture identifies recursion with a dynamically determined number of calls as a concern for real-time systems.
- 46
What is the relationship between DMA and the shared CPU–device memory bus?
Model answer
DMA lets devices transfer data without continuous CPU involvement, but the device and CPU can still contend for the bus they share to access memory.
Explanation
This distinction explains how DMA can reduce CPU work yet still delay CPU memory access.
- 47
How can static memory allocation reduce uncertainty compared with heap allocation?
Model answer
Static allocation determines the required memory in advance, avoiding runtime searches for heap space and the associated allocation-time variation.
Explanation
The cost is reduced flexibility because memory is not allocated dynamically as needs arise.
- 48
What is a periodic task, and how is a job related to it?
Model answer
A periodic task produces jobs at regular intervals. Each individual arrival or instance of the task is called a job.
Explanation
The task is the recurring unit, while a job identifies one occurrence of it.
- 49
What timing parameters characterize each job of a periodic task?
Model answer
A job has a worst-case execution time and a hard relative deadline; the task has a period that determines its recurring arrivals.
Explanation
These parameters are used to reason about whether the periodic workload can meet its deadlines.
- 50
What relative deadline should be assumed for a periodic task if none is specified?
Model answer
Assume its relative deadline is equal to its period.
Explanation
The lecture states that an unstated periodic-task deadline should be taken as the period.
- 51
How is the utilization of a periodic task calculated?
Model answer
Divide the job’s worst-case execution time by the task’s period: U=C/P.
Explanation
Here, C is the worst-case execution time and P is the period.
- 52
How do aperiodic and sporadic tasks differ in their deadline requirements?
Model answer
Both may arrive irregularly, but aperiodic tasks do not have hard deadlines, whereas sporadic tasks do.
Explanation
The key distinction in the lecture is whether the irregularly arriving task has a hard deadline.
- 53
What are two independent characteristics that can describe a set of real-time tasks?
Model answer
Tasks may be independent or dependent, and they may be preemptible or non-preemptible.
Explanation
These are separate classifications of task relationships and execution behavior.
- 54
How do static, dynamic, and fully dynamic schedulers differ in their priority assignments?
Model answer
Static schedulers assign unchanging priorities to tasks; dynamic schedulers assign unchanging priorities to individual jobs; fully dynamic schedulers can change job priorities over time.
Explanation
The categories differ in what receives a priority and whether that priority can change.
- 55
What does it mean for a schedule to be feasible?
Model answer
A schedule is feasible if all tasks meet their deadlines.
Explanation
Feasibility describes the outcome of a schedule, not the general class of a scheduler.
- 56
When is a task set schedulable under a class of schedulers?
Model answer
It is schedulable under that class if at least one scheduling algorithm in the class can produce a feasible schedule for it.
Explanation
If no algorithm in the class can produce a feasible schedule, the task set is not schedulable in that class.
- 57
What does it mean for an algorithm to be optimal with respect to a scheduler class?
Model answer
It can produce a feasible schedule for every task set that is schedulable by any algorithm in that class.
Explanation
Optimality is defined relative to a particular class of schedulers and concerns schedulable task sets.
- 58
How does round-robin scheduling illustrate the need for real-time scheduling policies?
Model answer
Round robin gives tasks turns without necessarily prioritizing their deadlines, so it can miss a deadline even when scheduling the workload.
Explanation
The lecture’s example demonstrates that a general-purpose policy does not necessarily meet real-time deadlines.
- 59
How does rate-monotonic scheduling assign priorities?
Model answer
It assigns fixed priorities to tasks, giving higher priority to tasks with shorter periods.
Explanation
Because its priorities belong to tasks and do not change, rate-monotonic scheduling is static.
- 60
Which task and workload assumptions are used when introducing rate-monotonic scheduling?
Model answer
The tasks are periodic and independent, and their worst-case execution times are known in advance.
Explanation
These assumptions allow the scheduler to assign fixed priorities based on task periods.
- 61
What does it mean that rate-monotonic scheduling is optimal among static schedulers?
Model answer
If any static scheduler can produce a feasible schedule for a task set, rate-monotonic scheduling can also produce one.
Explanation
This optimality claim applies to the static-scheduler class, not to all possible scheduler classes.
- 62
State the utilization-bound condition that guarantees rate-monotonic scheduling will produce a feasible schedule for n periodic tasks.
Model answer
A sufficient guarantee is 4_i=1^n C_i/P_i n(2^{1/n}-1).
Explanation
Each task’s utilization is its worst-case execution time divided by its period; if the total is at most this bound, rate-monotonic scheduling is guaranteed to succeed.
- 63
What can be concluded if total utilization exceeds the rate-monotonic utilization bound?
Model answer
The bound no longer guarantees a feasible schedule, but exceeding it does not prove that rate-monotonic scheduling will fail.
Explanation
The condition is sufficient for a guarantee, not a statement that all larger utilizations are unschedulable.
- 64
For three tasks, what utilization bound does the rate-monotonic guarantee give, and how does the lecture’s 0.98-utilization example compare?
Model answer
For n=3, the bound is approximately 0.78. A total utilization of 0.98 exceeds it, so the guarantee does not apply.
Explanation
In the example, rate-monotonic scheduling also fails to produce a feasible schedule, but that failure is established by the example rather than by exceeding the bound alone.
- 65
Why can rate-monotonic scheduling miss a deadline even though it always favors the task with the shortest period?
Model answer
Fixed task priorities do not guarantee that every possible periodic workload is feasible; a higher-priority task can repeatedly take processor time needed by another task.
Explanation
The lecture gives a workload in which rate-monotonic scheduling misses a deadline, showing that the policy is not guaranteed to succeed for every task set.
- 66
How does earliest-deadline-first scheduling assign priorities?
Model answer
It assigns priorities to jobs and gives higher priority to the job with the earlier deadline.
Explanation
Unlike rate-monotonic scheduling, EDF bases priority on job deadlines rather than fixed task periods.
- 67
Why is earliest-deadline-first classified as a dynamic scheduler rather than a static scheduler?
Model answer
It assigns priorities to individual jobs, and different jobs from the same task can have different deadlines and priorities.
Explanation
Each job’s priority remains fixed once assigned, but priorities are assigned at the job level rather than permanently to the task.
- 68
What does it mean that earliest-deadline-first is optimal among online schedulers?
Model answer
If any online scheduler can produce a feasible schedule for a task set, EDF can also produce a feasible schedule for it.
Explanation
This optimality statement is relative to online schedulers, not to every conceivable scheduling approach.
- 69
How can earliest-deadline-first succeed on a workload that rate-monotonic scheduling fails to schedule?
Model answer
EDF can change which task runs according to the deadlines of the jobs currently available, rather than always favoring the task with the shortest period.
Explanation
The lecture demonstrates EDF producing a feasible schedule for a workload that rate-monotonic scheduling failed to schedule.
- 70
Why are task sets that no scheduler in a class can feasibly schedule excluded from that class’s optimality comparison?
Model answer
Optimality compares performance only on task sets that are schedulable in the class; a set that no algorithm in the class can schedule is outside that comparison.
Explanation
The definition asks whether an algorithm succeeds whenever another algorithm in the same class can succeed.
- 71
How does a periodic task differ from one of its jobs when reasoning about arrivals and deadlines?
Model answer
The task represents the recurring activity, while each job is one particular arrival with its own execution requirement and deadline.
Explanation
Distinguishing jobs lets a scheduler reason about separate instances of the same periodic task.

Ask anything
We've read this whole study set, so questions about it get the best answers.