© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems zScheduling policies: yRMS; yEDF. zScheduling modeling assumptions.

Slides:



Advertisements
Similar presentations
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Advertisements

© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Processes and operating systems zScheduling policies: yRMS; yEDF. zScheduling modeling.
WHAT IS AN OPERATING SYSTEM? An interface between users and hardware - an environment "architecture ” Allows convenient usage; hides the tedious stuff.
Real-time concepts Lin Zhong ELEC424, Fall Real time Correctness – Logical correctness – Timing Hard vs. Soft – Hard: lateness is intolerable Pass/Fail.
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
Courseware Scheduling Uniprocessor Real-Time Systems Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens.
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Chapter 11 Operating Systems
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Processes and operating systems zInterprocess communication. zOperating system performance.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
Introduction to Embedded Systems
High Performance Embedded Computing © 2007 Elsevier Lecture 14: Real Time Concepts Embedded Computing Systems Mikko Lipasti Based on slides and textbook.
Chapter 4 Processor Management
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
Introduction to Embedded Systems Rabie A. Ramadan 6.
Real-Time Systems Design1 Priority Inversion When a low-priority task blocks a higher-priority one, a priority inversion is said to occur Assume that priorities:
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Processes and operating systems zPriority-driven scheduling zScheduling policies: yRMS; yEDF. zInterprocess communication. zOperating system performance.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems zMotivation for processes. zThe process abstraction. zContext.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
8-Sep Operating Systems Yasir Kiani. 8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.
Computer Studies (AL) Operating System Process Management - Process.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems  Operating systems.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems Operating systems. 1.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
CSE 451: Operating Systems Section 5 Midterm review.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
Introduction to Embedded Systems Rabie A. Ramadan 5.
Ch4 Process and Operating System. Content Motivation for processes The process abstraction Context switching and Multitasking Operating System Scheduling.
Design & Co-design of Embedded Systems
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 31 – Process Management (Part 1) Klara Nahrstedt Spring 2009.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems zScheduling policies: yRMS; yEDF. zScheduling modeling assumptions.
Unit - I Real Time Operating System. Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Scheduling.
Lecture 6: Real-Time Scheduling
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
REAL-TIME OPERATING SYSTEMS
Process Management Process Concept Why only the global variables?
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Topics Covered What is Real Time Operating System (RTOS)
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Protection of System Resources
Chapter 6: CPU Scheduling
Operating Systems CPU Scheduling.
CS 143A - Principles of Operating Systems
Process & its States Lecture 5.
Processes and operating systems
Ch4 Process and Operating System
CSCI1600: Embedded and Real Time Software
Processes and operating systems
CSCI1600: Embedded and Real Time Software
Processes and operating systems
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Presentation transcript:

© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems zScheduling policies: yRMS; yEDF. zScheduling modeling assumptions. zInterprocess communication. zPower management.

© 2000 Morgan Kaufman Overheads for Computers as Components Metrics zHow do we evaluate a scheduling policy: yAbility to satisfy all deadlines. yCPU utilization---percentage of time devoted to useful work. yScheduling overhead---time required to make scheduling decision.

© 2000 Morgan Kaufman Overheads for Computers as Components Rate monotonic scheduling zRMS (Liu and Layland): widely-used, analyzable scheduling policy. zAnalysis is known as Rate Monotonic Analysis (RMA).

© 2000 Morgan Kaufman Overheads for Computers as Components RMA model zAll process run on single CPU. zZero context switch time. zNo data dependencies between processes. zProcess execution time is constant. zDeadline is at end of period. zHighest-priority ready process runs.

© 2000 Morgan Kaufman Overheads for Computers as Components Process parameters  T i is computation time of process i;  i is period of process i. period  i Pi computation time T i

© 2000 Morgan Kaufman Overheads for Computers as Components Rate-monotonic analysis zResponse time: time required to finish process. zCritical instant: scheduling state that gives worst response time. zCritical instant occurs when all higher- priority processes are ready to execute.

© 2000 Morgan Kaufman Overheads for Computers as Components Critical instant P4 P3 P2 P1 critical instant P1 P2 P3 interfering processes

© 2000 Morgan Kaufman Overheads for Computers as Components RMS priorities zOptimal (fixed) priority assignment: yshortest-period process gets highest priority; ypriority inversely proportional to period; ybreak ties arbitrarily. zNo fixed-priority scheme does better.

© 2000 Morgan Kaufman Overheads for Computers as Components RMS example time 0510 P2 period P1 period P1 P2 P1

© 2000 Morgan Kaufman Overheads for Computers as Components RMS CPU utilization zUtilization for n processes is   i T i /  i zAs number of tasks approaches infinity, maximum utilization approaches 69%.

© 2000 Morgan Kaufman Overheads for Computers as Components RMS CPU utilization, cont’d. zRMS cannot asymptotically guarantee use 100% of CPU, even with zero context switch overhead. zMust keep idle cycles available to handle worst-case scenario. zHowever, RMS guarantees all processes will always meet their deadlines.

© 2000 Morgan Kaufman Overheads for Computers as Components RMS implementation zEfficient implementation: yscan processes; ychoose highest-priority active process.

© 2000 Morgan Kaufman Overheads for Computers as Components Earliest-deadline-first scheduling zEDF: dynamic priority scheduling scheme. zProcess closest to its deadline has highest priority. zRequires recalculating processes at every timer interrupt.

© 2000 Morgan Kaufman Overheads for Computers as Components EDF example P2 P1

© 2000 Morgan Kaufman Overheads for Computers as Components EDF analysis zEDF can use 100% of CPU. zBut EDF may miss a deadline.

© 2000 Morgan Kaufman Overheads for Computers as Components EDF implementation zOn each timer interrupt: ycompute time to deadline; ychoose process closest to deadline. zGenerally considered too expensive to use in practice.

© 2000 Morgan Kaufman Overheads for Computers as Components Fixing scheduling problems zWhat if your set of processes is unschedulable? yChange deadlines in requirements. yReduce execution times of processes. yGet a faster CPU.

© 2000 Morgan Kaufman Overheads for Computers as Components Priority inversion zPriority inversion: low-priority process keeps high-priority process from running. zImproper use of system resources can cause scheduling problems: yLow-priority process grabs I/O device. yHigh-priority device needs I/O device, but can’t get it until low-priority process is done. zCan cause deadlock.

© 2000 Morgan Kaufman Overheads for Computers as Components Solving priority inversion zGive priorities to system resources. zHave process inherit the priority of a resource that it requests. yLow-priority process inherits priority of device if higher.

© 2000 Morgan Kaufman Overheads for Computers as Components Data dependencies zData dependencies allow us to improve utilization. yRestrict combination of processes that can run simultaneously. zP1 and P2 can’t run simultaneously. P1 P2

© 2000 Morgan Kaufman Overheads for Computers as Components Context-switching time zNon-zero context switch time can push limits of a tight schedule. zHard to calculate effects---depends on order of context switches. zIn practice, OS context switch overhead is small.

© 2000 Morgan Kaufman Overheads for Computers as Components What about interrupts? zInterrupts take time away from processes. zPerform minimum work possible in the interrupt handler. P1 OS P2 OS intr P3

© 2000 Morgan Kaufman Overheads for Computers as Components Device processing structure zInterrupt service routine (ISR) performs minimal I/O. yGet register values, put register values. zInterrupt service process/thread performs most of device function.

© 2000 Morgan Kaufman Overheads for Computers as Components POSIX scheduling policies zSCHED_FIFO: RMS zSCHED_RR: round-robin ywithin a priority level, processes are time- sliced in round-robin fashion zSCHED_OTHER: undefined scheduling policy used to mix non-real-time and real- time processes.

© 2000 Morgan Kaufman Overheads for Computers as Components Interprocess communication zOS provides interprocess communication mechanisms: yvarious efficiencies; ycommunication power.

© 2000 Morgan Kaufman Overheads for Computers as Components Signals zA Unix mechanism for simple communication between processes. zAnalogous to an interrupt---forces execution of a process at a given location. yBut a signal is caused by one process with a function call. zNo data---can only pass type of signal.

© 2000 Morgan Kaufman Overheads for Computers as Components POSIX signals zMust declare a signal handler for the process using sigaction(). zHandler is called when signal is received. zA signal can be sent with sigqueue(): sigqueue(destpid,SIGRTMAX-1,sval)

© 2000 Morgan Kaufman Overheads for Computers as Components POSIX signal types zSIGABRT: abort zSIGTERM: terminate process zSIGFPE: floating point exception zSIGILL: illegal instruction zSIGKILL: unavoidable process termination zSIGUSR1, SIGUSR2: user defined

© 2000 Morgan Kaufman Overheads for Computers as Components Signals in UML zMore general than Unix signal---may carry arbitrary data: > aSig p : integer someClass sigbehavior() >

© 2000 Morgan Kaufman Overheads for Computers as Components POSIX shared memory zPOSIX supports counting semaphores with _POSIX_SEMAPHORES option. ySemaphore with N resources will not block until N processes hold the semaphore. zSemaphores are given name: y/sem1 zP() is sem_wait(), V() is sem_post().

© 2000 Morgan Kaufman Overheads for Computers as Components POSIX message-based communication zUnix pipe supports messages between processes. zParent process uses pipe() to create a pipe. yPipe is created before child is created so that pipe ID can be passed to child.

© 2000 Morgan Kaufman Overheads for Computers as Components POSIX pipe example /* create the pipe */ if (pipe(pipe_ends) < 0) { perror(“pipe”); break; } /* create the process */ childid = fork(); if (childid == 0) { /* child reads from pipe_ends[1] */ childargs[0] = pipe_ends[1]; execv(“mychild”,childargs); perror(“execv”); exit(1); } else { /* parent writes to pipe_ends[0] */ … }

© 2000 Morgan Kaufman Overheads for Computers as Components Evaluating performance zMay want to test: ycontext switch time assumptions; yscheduling policy. zCan use OS simulator to exercise process set, trace system behavior.

© 2000 Morgan Kaufman Overheads for Computers as Components Processes and caches zProcesses can cause additional caching problems. yEven if individual processes are well- behaved, processes may interfere with each other. zWorst-case execution time with bad behavior is usually much worse than execution time with good cache behavior.

© 2000 Morgan Kaufman Overheads for Computers as Components Power optimization zPower management: determining how system resources are scheduled/used to control power consumption. zOS can manage for power just as it manages for time. zOS reduces power by shutting down units. yMay have partial shutdown modes.

© 2000 Morgan Kaufman Overheads for Computers as Components Power management and performance zPower management and performance are often at odds. zEntering power-down mode consumes yenergy, ytime. zLeaving power-down mode consumes yenergy, ytime.

© 2000 Morgan Kaufman Overheads for Computers as Components Simple power management policies zRequest-driven: power up once request is received. Adds delay to response. zPredictive shutdown: try to predict how long you have before next request. yMay start up in advance of request in anticipation of a new request. yIf you predict wrong, you will incur additional delay while starting up.

© 2000 Morgan Kaufman Overheads for Computers as Components Probabilistic shutdown zAssume service requests are probabilistic. zOptimize expected values: ypower consumption; yresponse time. zSimple probabilistic: shut down after time T on, turn back on after waiting for T off.

© 2000 Morgan Kaufman Overheads for Computers as Components Advanced Configuration and Power Interface zACPI: open standard for power management services. Hardware platform device drivers ACPI BIOS OS kernel applications power management

© 2000 Morgan Kaufman Overheads for Computers as Components ACPI global power states zG3: mechanical off zG2: soft off xS1: low wake-up latency with no loss of context xS2: low latency with loss of CPU/cache state xS3: low latency with loss of all state except memory xS4: lowest-power state with all devices off zG1: sleeping state zG0: working state