Download presentation
Presentation is loading. Please wait.
1
Multiprocessor and Real-Time Scheduling Chapter 10
2
Classification of Multiprocessor Systems Loosely coupled multiprocessor Each processor has its own memory and I/O channels Message-passing Distributed memory Tightly coupled multiprocessors Shared memory (e.g. single address space) Controlled by a central operating system Symmetric Multiprocessors
3
Types of Parallelism Independent parallelism Separate applications or jobs running on multiple processors No synchronization between them Average response time to users is small Coarse-Grained Parallelism Synchronization among processes is very sparse (e.g. once for every 10,000 instructions) Examples: Multiple threads of a program assigned to run on multiple processors noise filtering in a large image; image is divided into regions and each processor handles one region. Medium-Grained Parallelism Parallel processing or multitasking within a single application Single application is a collection of threads which interact frequently Example : multiple concurrent searches on a database that are carried out in parallel and updates are performed one at a time (synchronized) inside a critical section Fine-Grained Parallelism Highly parallel applications; parallelism at instruction level lots of synchronization and communication between processes Example: “sorting a list in parallel” or “finding prime numbers in parallel”
5
Scheduling Issues on Multiprocessors Should multiprogramming be used on individual processors? If we want to get maximum speedup, then we may want to dedicate the processors to the processes of a single application. If a single queue is used for all processes, then a process can be scheduled to run on any processor. (A master node is needed) Unless a single queue is used for scheduling, it becomes more difficult to maintain specific scheduling disciplines such as FCFS, RR, SPN, SRT in a global sense. However, preemptive schemes (e.g. RR) are costly to implement with a single queue approach.
6
Assignment of Processes/Threads to Processors Treat processors as a pooled resource and assign processes to processors on demand Global queue: Schedule to run on any available processor Master/slave architecture Key kernel functions always run on a particular processor Master is responsible for scheduling Slave sends service request to the master Disadvantages Failure of master brings down the whole system Master can become a performance bottleneck Permanently assign a process to a processor Dedicate short-term queue for each processor Less overhead Processor could be idle while another processor has a backlog Gang Scheduling Simultaneous scheduling of the threads that make up a single process
7
Real-Time Systems Tasks or processes attempt to control or react to events that take place in the outside world in “real-time” and process must be able to keep up with them Examples: –Control of laboratory experiments –Process control in industrial plants –Intelligent manufacturing –Robotics –Autonomous land rover –Air traffic control –Telecommunications –Military command and control systems –Space station –Undersea exploration Correctness of the system depends not only on the logical result of the computation but also on the time at which the results are produced
8
Periodic tasks once per period T exactly T units apart Aperiodic tasks has a deadline by which it must finish or start may have a constraint on both start and finish time Hard real-time task must meet the deadline otherwise it will cause unacceptable damage or a fatal error to the system Soft real-time task has an associated deadline that is desirable but not mandatory it still makes sense to schedule and complete the task even if it has passed its deadline
9
Characteristics of Real-Time OS Deterministic –Operations are performed at fixed, predetermined times or within predetermined time intervals –The speed that the OS can respond to high priority interrupts. Could there be a deterministic upper bound? Responsiveness is critical –How long, after acknowledgment, it takes the OS to service the interrupt. Includes the amount of time to begin execution and perform the ISR (Interrupt Service Routine)
10
Characteristics of Real-Time OS Increased User control : –control over task priorities and rights –user should be able to distinguish between hard and soft tasks and to specify relative priorities within each class –May allow user to specify such characteristics as: Must be Reliable –Degradation of performance may have catastrophic consequences –Fail-safe operation: Attempt to correct the problem or minimize its effects while continuing to run (ex: failure of the traffic lights ) –Most critical, high priority tasks execute first paging or process swapping what processes must always be resident in main memory what disk transfer algorithms are to be used what rights the processes in various priority bands have
11
Features of Real-Time OS To meet the foregoing requirements, real-time operating systems typically include the following features: Fast context switch (minimize dispatch latency) Small size Ability to respond to external interrupts quickly (minimize interrupt latency) Use files that accumulate data at a fast rate Preemptive scheduling based on priorities Intervals at which interrupts are disabled are minimized Do not delay tasks more than a specified fixed amount of time May use special alarms and timeouts
12
Deadline Scheduling Real-time applications are not concerned with fairness or minimizing the response time but with completing certain tasks in a timely manner (i.e. before their deadlines are reached) Scheduling tasks with the earliest deadline could minimize the number of tasks that miss their deadlines For proper scheduling, it’s better to know the following for each task: –Ready time (time at which task becomes ready for execution - known in advance for periodic tasks) –Starting deadline (time by which a task must begin running) –Completion deadline (time by which task must be completed) –Processing time –Resource requirements –Priority
13
Execution Profile of Two Periodic Tasks
14
Comparison of Various Scheduling Algorithms
15
Rate Monotonic Scheduling Assigns priorities to tasks on the basis of their periods Highest-priority task is the one with the shortest period Processor Utilization = C 1 /T 1 + C 2 /T 2 + … C n /T n ≤ 1 If the following inequality is satisfied, schedulability is guaranteed: Upper Bound for RMS: C 1 /T 1 + C 2 /T 2 + … C n /T n ≤ n(2 1/n -1) RMS has been widely adapted for use in industrial applications
16
Rate Monotonic Scheduling
17
Value of the RMS Upper Bound n n(2 1/n -1) ______________________________ 1 1.0 2 0.828 3 0.779 4 0.756 5 0.743 6 0.734 ∞ ln 2 » 0.693 C 1 /T 1 + C 2 /T 2 + … C n /T n ≤ n(2 1/n -1)
18
UNIX SVR4 Scheduling Highest preference to real-time processes Next-highest to kernel-mode processes Lowest preference to other user-mode processes LINUX Scheduling Scheduling classes SCHED_FIFO : First-in-first-out real-time threads SCHED_RR : Round-robin real-time threads SCHED_OTHER : Other, non-real-time threads Within each class multiple priorities may be used
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.