Chapter 19 RealTime Systems Chapter 19 RealTime Systems

  • Slides: 24
Download presentation
Chapter 19: Real-Time Systems

Chapter 19: Real-Time Systems

Chapter 19: Real-Time Systems n System Characteristics n Features of Real-Time Systems n Implementing

Chapter 19: Real-Time Systems n System Characteristics n Features of Real-Time Systems n Implementing Real-Time Operating Systems n Real-Time CPU Scheduling n Vx. Works 5. x Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 2 Silberschatz, Galvin and Gagne © 2005

Objectives n To explain the timing requirements of real-time systems n To distinguish between

Objectives n To explain the timing requirements of real-time systems n To distinguish between hard and soft real-time systems n To discuss the defining characteristics of real-time systems n To describe scheduling algorithms for hard real-time systems Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 3 Silberschatz, Galvin and Gagne © 2005

Overview of Real-Time Systems n A real-time system requires that results be produced within

Overview of Real-Time Systems n A real-time system requires that results be produced within a specified deadline period. n An embedded system is a computing device that is part of a larger system (I. e. automobile, airliner. ) n A safety-critical system is a real-time system with catastrophic results in case of failure. n A hard real-time system guarantees that real-time tasks be completed within their required deadlines. n A soft real-time system provides priority of real-time tasks over non real-time tasks. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 4 Silberschatz, Galvin and Gagne © 2005

System Characteristics n Single purpose n Small size n Inexpensively mass-produced n Specific timing

System Characteristics n Single purpose n Small size n Inexpensively mass-produced n Specific timing requirements Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 5 Silberschatz, Galvin and Gagne © 2005

System-on-a-Chip n Many real-time systems are designed using system-on-a-chip (SOC) strategy. n SOC allows

System-on-a-Chip n Many real-time systems are designed using system-on-a-chip (SOC) strategy. n SOC allows the CPU, memory-management unit, and attached peripheral ports (I. e. USB) to be contained in a single integrated circuit. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 6 Silberschatz, Galvin and Gagne © 2005

Bus-Oriented System Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 7

Bus-Oriented System Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 7 Silberschatz, Galvin and Gagne © 2005

Features of Real-Time Kernels n Most real-time systems do not provide the features found

Features of Real-Time Kernels n Most real-time systems do not provide the features found in a standard desktop system. n Reasons include l Real-time systems are typically single-purpose. l Real-time systems often do not require interfacing with a user. l Features found in a desktop PC require more substantial hardware that what is typically available in a real-time system. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 8 Silberschatz, Galvin and Gagne © 2005

Virtual Memory in Real-Time Systems n Address translation may occur via: n (1) Real-addressing

Virtual Memory in Real-Time Systems n Address translation may occur via: n (1) Real-addressing mode where programs generate actual addresses. n (2) Relocation register mode. n (3) Implementing full virtual memory. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 9 Silberschatz, Galvin and Gagne © 2005

Address Translation Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 10

Address Translation Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 10 Silberschatz, Galvin and Gagne © 2005

Implementing Real-Time Operating Systems n In general, real-time operating systems must provide: (1) Preemptive,

Implementing Real-Time Operating Systems n In general, real-time operating systems must provide: (1) Preemptive, priority-based scheduling (2) Preemptive kernels (3) Latency must be minimized Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 11 Silberschatz, Galvin and Gagne © 2005

Minimizing Latency n Event latency is the amount of time from when an event

Minimizing Latency n Event latency is the amount of time from when an event occurs to when it is serviced. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 12 Silberschatz, Galvin and Gagne © 2005

Interrupt Latency n Interrupt latency is the period of time from when an interrupt

Interrupt Latency n Interrupt latency is the period of time from when an interrupt arrives at the CPU to when it is serviced. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 13 Silberschatz, Galvin and Gagne © 2005

Dispatch Latency n Dispatch latency is the amount of time required for the scheduler

Dispatch Latency n Dispatch latency is the amount of time required for the scheduler to stop one process and start another. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 14 Silberschatz, Galvin and Gagne © 2005

Real-Time CPU Scheduling n Periodic processes require the CPU at specified intervals (periods) n

Real-Time CPU Scheduling n Periodic processes require the CPU at specified intervals (periods) n p is the duration of the period n d is the deadline by when the process must be serviced n t is the processing time Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 15 Silberschatz, Galvin and Gagne © 2005

Scheduling of tasks when P 2 has a higher priority than P 1 Operating

Scheduling of tasks when P 2 has a higher priority than P 1 Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 16 Silberschatz, Galvin and Gagne © 2005

Rate Montonic Scheduling n A priority is assigned based on the inverse of its

Rate Montonic Scheduling n A priority is assigned based on the inverse of its period n Shorter periods = higher priority; n Longer periods = lower priority n P 1 is assigned a higher priority than P 2. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 17 Silberschatz, Galvin and Gagne © 2005

Missed Deadlines with Rate Monotonic Scheduling Operating System Concepts – 7 th Edition, Jan

Missed Deadlines with Rate Monotonic Scheduling Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 18 Silberschatz, Galvin and Gagne © 2005

Earliest Deadline First Scheduling n Priorities are assigned according to deadlines: the earlier the

Earliest Deadline First Scheduling n Priorities are assigned according to deadlines: the earlier the deadline, the higher the priority; the later the deadline, the lower the priority. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 19 Silberschatz, Galvin and Gagne © 2005

Proportional Share Scheduling n T shares are allocated among all processes in the system.

Proportional Share Scheduling n T shares are allocated among all processes in the system. n An application receives N shares where N < T. n This ensures each application will receive N / T of the total processor time. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 20 Silberschatz, Galvin and Gagne © 2005

Pthread Scheduling n The Pthread API provides functions for managing real-time threads. n Pthreads

Pthread Scheduling n The Pthread API provides functions for managing real-time threads. n Pthreads defines two scheduling classes for real-time threads: (1) SCHED_FIFO - threads are scheduled using a FCFS strategy with a FIFO queue. There is no time-slicing for threads of equal priority. (2) SCHED_RR - similar to SCHED_FIFO except time-slicing occurs for threads of equal priority. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 21 Silberschatz, Galvin and Gagne © 2005

Vx. Works 5. 0 Operating System Concepts – 7 th Edition, Jan 1, 2005

Vx. Works 5. 0 Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 22 Silberschatz, Galvin and Gagne © 2005

Wind Microkernel n The Wind microkernel provides support for the following: (1) Processes and

Wind Microkernel n The Wind microkernel provides support for the following: (1) Processes and threads; (2) preemptive and non-preemptive round-robin scheduling; (3) manages interrupts (with bounded interrupt and dispatch latency times); (4) shared memory and message passing interprocess communication facilities. Operating System Concepts – 7 th Edition, Jan 1, 2005 19. 23 Silberschatz, Galvin and Gagne © 2005

End of Chapter 19

End of Chapter 19