Multiprocessor and Real-Time Scheduling Chapter 10.

18
Multiprocessor and Real-Time Scheduling Chapter 10
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    232
  • download

    2

Transcript of Multiprocessor and Real-Time Scheduling Chapter 10.

Page 1: Multiprocessor and Real-Time Scheduling Chapter 10.

Multiprocessor and Real-Time Scheduling

Chapter 10

Page 2: Multiprocessor and Real-Time Scheduling Chapter 10.

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

Page 3: Multiprocessor and Real-Time Scheduling Chapter 10.

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”

Page 4: Multiprocessor and Real-Time Scheduling Chapter 10.
Page 5: Multiprocessor and Real-Time Scheduling Chapter 10.

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.

Page 6: Multiprocessor and Real-Time Scheduling Chapter 10.

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

Page 7: Multiprocessor and Real-Time Scheduling Chapter 10.

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

Page 8: Multiprocessor and Real-Time Scheduling Chapter 10.

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

Page 9: Multiprocessor and Real-Time Scheduling Chapter 10.

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)

Page 10: Multiprocessor and Real-Time Scheduling Chapter 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

Page 11: Multiprocessor and Real-Time Scheduling Chapter 10.

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

Page 12: Multiprocessor and Real-Time Scheduling Chapter 10.

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

Page 13: Multiprocessor and Real-Time Scheduling Chapter 10.

Execution Profile of Two Periodic Tasks

Page 14: Multiprocessor and Real-Time Scheduling Chapter 10.

Comparison of Various Scheduling Algorithms

Page 15: Multiprocessor and Real-Time Scheduling Chapter 10.

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 = C1/T1 + C2/T2 + … Cn/Tn ≤ 1

• If the following inequality is satisfied, schedulability is guaranteed:

Upper Bound for RMS: C1/T1 + C2/T2 + … Cn/Tn ≤ n(21/n-1)

• RMS has been widely adapted for use in industrial applications

Page 16: Multiprocessor and Real-Time Scheduling Chapter 10.

Rate Monotonic Scheduling

Page 17: Multiprocessor and Real-Time Scheduling Chapter 10.

Value of the RMS Upper Bound

n n(2 1/n -1)______________________________

1 1.02 0.8283 0.7794 0.7565 0.7436 0.734• •• •• •∞ ln 2 » 0.693

C1/T1 + C2/T2 + … Cn/Tn ≤ n(21/n-1)

Page 18: Multiprocessor and Real-Time Scheduling Chapter 10.

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 classesSCHED_FIFO : First-in-first-out real-time threadsSCHED_RR : Round-robin real-time threadsSCHED_OTHER : Other, non-real-time threads

Within each class multiple priorities may be used