CS703 - Advanced Operating Systems By Mr. Farhan Zaidi
Lecture No. 19
Characteristics of Real-Time Operating Systems Reliability Degradation of performance may have catastrophic consequences Fail-soft operation Ability of a system to fail in such a way as to preserve as much capability and data as possible Stability
Features of Real-Time Operating Systems Fast process or thread switch Small size Ability to respond to external interrupts quickly Multitasking with inter-process communication tools such as semaphores, signals, and events
Features of Real-Time Operating Systems Use of special sequential files that can accumulate data at a fast rate Preemptive scheduling base on priority Minimization of intervals during which interrupts are disabled Delay tasks for fixed amount of time Special alarms and timeouts
Real-Time Scheduling Static table-driven Determines at load or even compile time when a task begins execution Static priority-driven preemptive Traditional priority-driven scheduler is used Dynamic planning-based Feasibility determined at run time Dynamic best effort No feasibility analysis is performed
Deadline Scheduling Information used Ready time Starting deadline Completion deadline Processing time Resource requirements Priority Subtask scheduler
Rate Monotonic Scheduling Assigns priorities to tasks on the basis of their periods Highest-priority task is the one with the shortest period
Dynamic Memory Allocation Application Dynamic Memory Allocator Heap Memory Explicit vs. Implicit Memory Allocator Explicit: application allocates and frees space E.g., malloc and free in C Implicit: application allocates, but does not free space E.g. garbage collection in Java, ML or Lisp Allocation In both cases the memory allocator provides an abstraction of memory as a set of blocks Gives out free memory blocks to application
Process Memory Image Allocators request additional heap memory kernel virtual memory memory invisible to user code stack %esp Memory mapped region for shared libraries Allocators request additional heap memory from the operating system using the sbrk function. the “brk” ptr run-time heap (via malloc) uninitialized data (.bss) initialized data (.data) program text (.text)
Assumptions Memory is word addressed (each word can hold a pointer) Free word Allocated block (4 words) Free block (3 words) Allocated word
Constraints Applications: Can issue arbitrary sequence of allocation and free requests Free requests must correspond to an allocated block Allocators Can’t control number or size of allocated blocks Must respond immediately to all allocation requests i.e., can’t reorder or buffer requests Must allocate blocks from free memory i.e., can only place un-allocated blocks in free memory Must align blocks so they satisfy all alignment requirements 8 byte alignment for GNU malloc (libc malloc) on Linux machines