Multiprocessor and Real-time Scheduling - PowerPoint PPT Presentation

1 / 50
About This Presentation
Title:

Multiprocessor and Real-time Scheduling

Description:

Lecture #8 Multiprocessor and Real-time Scheduling – PowerPoint PPT presentation

Number of Views:168
Avg rating:3.0/5.0
Slides: 51
Provided by: Mario186
Category:

less

Transcript and Presenter's Notes

Title: Multiprocessor and Real-time Scheduling


1
Lecture 8
  • Multiprocessor and Real-time Scheduling

2
?? ???? ??
  • Loosely coupled multiprocessor
  • ? ????? ?? ??? ?? ???? I/O ??? ???
  • Distributed system, clustered system ?
  • Functionally specialized processors
  • I/O processor ?
  • master processor? ?? ????
  • Tightly coupled multiprocessing
  • ?? ????? ?????? ????
  • SMP ?

3
???? ???(Process Parallelism)
  • Synchronization Granularity
  • Independent Parallelism
  • ??? ???? ?? ???? ??? ???
  • Very coarse grained parallelism
  • ???? ?? ?? ?? ??(distributed processing)
  • Coarse grained parallelism
  • ?? ????? ???? ?????? ?? ?? (multiprocessing)
  • Medium grained parallelism
  • ??? ????? ?? ??(Parallel processing)
  • Thread ??? ???
  • Fine grained parallelism
  • ??? ??? ???

4
Independent Parallelism
  • Separate application or job
  • No synchronization among processes
  • Example is time-sharing system

5
Coarse and Very Coarse-Grained Parallelism
  • Synchronization among processes at a very gross
    level
  • Good for concurrent processes running on a
    multiprogrammed uniprocessor
  • Can by supported on a multiprocessor with little
    change

6
Medium-Grained Parallelism
  • Single application is a collection of threads
  • Threads usually interact frequently

7
Fine-Grained Parallelism
  • Highly parallel applications
  • Specialized and fragmented area

8
(No Transcript)
9
Process Scheduling
  • Single queue for all processes
  • Multiple queues are used for priorities
  • All queues feed to the common pool of processors

10
Thread Scheduling
  • Executes separate from the rest of the process
  • An application can be a set of threads that
    cooperate and execute concurrently in the same
    address space
  • Threads running on separate processors yields a
    dramatic gain in performance

11
?? ??? ????(Multiprocessor Scheduling) (1)
  • Multiprocessor thread scheduling
  • Load sharing
  • processes are not assigned to a particular
    processor
  • Gang scheduling
  • a set of related threads is scheduled to run on a
    set of processors at the same time
  • Dedicated processor assignment
  • threads are assigned to a specific processor
  • Dynamic scheduling
  • number of threads can be altered during course of
    execution

12
?? ??? ????(Multiprocessor Scheduling) (2)
  • Load Sharing(?? ??)
  • ??? ?? ????? ?? ???? ????
  • ?? ????? ??? ??
  • ?? ??? ????? ?? ??
  • global queue? ??
  • ? ?
  • global queue? ?? ????
  • ? ?? ??? ????? ??? ??? ??? ??? ? ?? bottleneck?
    ? ? ??
  • ??? ???? ??? ?????? ??? ??? ???? ?? ? ??? ????
    ?????
  • ??? ????? ???? ?? ???? ??? ????? ?? ??? ???? ??

13
?? ??? ????(Multiprocessor Scheduling) (3)
  • Gang Scheduling
  • ??? ????? ???? ?? ????? ?? ?? ????
  • ?? ????? ???? ???? ??? ???? ???? ?? ????? ????
    ????
  • ???? ???? ???? ?? ????
  • Dedicated Processor Scheduling
  • ??? ????? ???? ?? ???? ??? ????? ????
  • ?? ????? ????? ? ? ??
  • process switching? ???

14
?? ??? ????(Multiprocessor Scheduling) (4)
  • Dynamic Scheduling
  • ????? ???? ??? ?? ???? ??? ???? ??? ??
  • ????? ? ????? ??? ???? ????? ????
  • Assign idle processors
  • New arrivals may be assigned to a processor that
    is used by a job currently using more than one
    processor
  • Hold request until a processor is available
  • Assign a processor to a job in the list that
    currently has no processors (i.e., to all waiting
    new arrivals)

15
??? ???(Real-Time System)
  • ??? ???(Real-Time System)
  • 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
  • Task Deadline - ?? ??? ???? ???? ???? ?? ? ?? ??
  • ? ? deadline ?? ??? ??
  • ?? ??? ???(Hard Real-Time System)
  • ?? ??? ???(Soft Real-Time System)
  • ?
  • Control of laboratory experiments
  • Process control plants
  • Robotics
  • Air traffic control
  • Telecommunications

16
??? ????? ?? (1)
  • Deterministic
  • Operations are performed at fixed, predetermined
    times or within predetermined time intervals
  • Concerned with how long the operating system
    delays before acknowledging an interrupt and
    there is sufficient capacity to handle all the
    requests within the required time
  • Responsiveness
  • How long, after acknowledgment, it takes the
    operating system to service the interrupt
  • Includes amount of time to begin execution of the
    interrupt
  • Includes the amount of time to perform the
    interrupt
  • Effect of interrupt nesting

17
??? ????? ?? (2)
  • User control
  • User specifies priority
  • Specify paging
  • What processes must always reside in main memory
  • Disks algorithms to use
  • Rights of processes
  • 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

18
??? ????? ??? ?? (1)
  • Fast process or thread switch
  • Small size
  • Ability to respond to external interrupts quickly
  • Multitasking with interprocess communication
    tools such as semaphores, signals, and events

19
??? ????? ??? ?? (2)
  • 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

20
Scheduling of a Real-Time Process (1)
21
Scheduling of a Real-Time Process (2)
22
Real-Time Scheduling
  • Static table-driven
  • Determines at run time when a task begins
    execution
  • e.g) Deadline scheduling
  • Static priority-driven preemptive
  • Traditional priority-driven scheduler is used
  • e.g) Rate monotonic algorithm
  • Dynamic planning-based
  • Feasibility determined at run time
  • Dynamic best effort
  • No feasibility analysis is performed

23
Deadline Scheduling (1)
  • Real-time applications are not concerned with
    speed but with completing tasks
  • Information used for real-time task scheduling
  • Ready time
  • Starting deadline
  • Completion deadline
  • Processing time
  • Resource requirements
  • Priority
  • Subtask scheduler

24
Deadline Scheduling (2)
  • Earliest deadline scheduling
  • ????? ?? ??? ???? ?? ????? ????
  • ????? ?? ??? ????? ?? ????? ??
  • ????? ???? ?? ??? ???? ?? ???
  • ?? ???/?? ??? ??? ??? ?? ??
  • ?? ????? ????? ???? ? ?? ????? ?
  • ??? ?? ??? ???? earliest deadline scheduling
  • ????? earliest deadline scheduling ??? ?? ????
  • ??? ????? ??? ???? ?? ?? ??? ??? ???? ?? ???? ??
    ????? ???? ??

25
Two Tasks
26
(No Transcript)
27
(No Transcript)
28
(No Transcript)
29
Rate Monotonic Scheduling
  • Assigns priorities to tasks on the basis of their
    periods
  • Task period T
  • ?? ???? ????? ??? ??? ?? ?? ????? ??? ???? ??
  • ???? ?? ???? ??
  • Task rate R - ??? ??? ??, Hz ??? ??
  • Highest-priority task is the one with the
    shortest period
  • ??? ??? ?? ????? ????? ? ???? ????? ????? ??

30
Periodic Task Timing Diagram
31
(No Transcript)
32
Earliest Deadline Scheduling(EDS) vs. Rate
Monotonic Scheduling(RMS)
  • EDS? ????? ? ?? ??? ???? ???? RMS?? ? ?? ???
    ????? ???? ??
  • ??, ?? ??? ?????? RMS? ????? ??
  • ? ???? ??? ?? ???? ????? ?? ??
  • ?? ??? ???? ?? ??? ???? ??? ???? ???? RMS? ?? ???
    ??? ???? ???? ???? ?? ??? ??? ??? ?? ??? ????
    ???????? ??? ???? ??
  • RMS? EDS?? ?? ??? ???? ??

33
Priority Inversion
  • Can occur in any priority-based preemptive
    scheduling scheme
  • Occurs when circumstances within the system force
    a higher priority task to wait for a lower
    priority task

34
Unbounded Priority Inversion
  • Duration of a priority inversion depends on
    unpredictable actions of other unrelated tasks

35
Priority Inheritance
  • Lower-priority task inherits the priority of any
    higher priority task pending on a resource they
    share

36
Thread Scheduling (1)
  • Possible scheduling of user-level threads
  • 50-msec process quantum / threads run 5 msec/CPU
    burst
  • ?? ??? ???? ???? ?? ????? ???? ??
  • ??? ?? ??? ????? ??? ?? ?? ??

37
Thread Scheduling (2)
A1 ???? ??? ? ?? ?? ???? ????? ?? A2? B1 ????
???? ??? ???? ??? B1? ?? ?? ??? ??? ?????
  • Possible scheduling of kernel-level threads
  • 50-msec process quantum / threads run 5 msec/CPU
    burst
  • ?? ????? ?? ??? ????? ??
  • ??? ?? ?? ??? ??

38
???? ??
  • Which one is best?
  • The answer depends on
  • on the system workload (extremely variable)
  • hardware support for the dispatcher
  • relative weighting of performance criteria
    (response time, CPU utilization, throughput...)
  • evaluation method used
  • ?? ??
  • ??? ???(Deterministic Modeling)
  • ?? ??(Queueing Model)
  • ????(Simulation)
  • ??(Implementation)

39
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

40
(No Transcript)
41
Non-Real-Time Scheduling
  • Linux 2.6 uses a new scheduler the O(1) scheduler
  • Time to select the appropriate process and assign
    it to a processor is constant
  • Regardless of the load on the system or number of
    processors

42
(No Transcript)
43
UNIX SVR4 Scheduling
  • Highest preference to real-time processes
  • Next-highest to kernel-mode processes
  • Lowest preference to other user-mode processes

44
UNIX SVR4 Scheduling
  • Preemptable static priority scheduler
  • Introduction of a set of 160 priority levels
    divided into three priority classes
  • Insertion of preemption points

45
SVR4 Priority Classes
46
SVR4 Priority Classes
  • Real time (159 100)
  • Guaranteed to be selected to run before any
    kernel or time-sharing process
  • Can preempt kernel and user processes
  • Kernel (99 60)
  • Guaranteed to be selected to run before any
    time-sharing process
  • Time-shared (59-0)
  • Lowest-priority

47
SVR4 Dispatch Queues
48
Windows Scheduling
  • Priorities organized into two bands or classes
  • Real time
  • Variable
  • Priority-driven preemptive scheduler

49
(No Transcript)
50
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com