1 / 55

Lecture #8

Lecture #8. Multiprocessor and Real-time Scheduling. 다중 처리기의 분류. Loosely coupled multiprocessor 각 프로세서가 자기 고유의 지역 메모리와 I/O 채널을 가진다 Distributed system, clustered system 등 Functionally specialized processors I/O processor 등 master processor 에 의해 제어된다 Tightly coupled multiprocessing

lrenee
Télécharger la présentation

Lecture #8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 등 Operating System

  3. 처리 병렬성(Processing Parallelism) • Synchronization Granularity • Frequency of synchronization between processes • Independent Parallelism • 다수의 연관성이 없는 프로세스 사이의 병렬성 • Very coarse grained parallelism • 네트워크 노드 상의 분산 처리(distributed processing) • Coarse grained parallelism • 다중 프로그래밍 환경에서 프로세스들의 다중 처리 (multiprocessing) • Medium grained parallelism • 하나의 응용에서의 병렬 처리(Parallel processing) • Thread 수준의 병렬성 • Fine grained parallelism • 명령어 수준의 병렬성 Operating System

  4. Independent Parallelism • Separate application or job • No synchronization among processes • Multiple unrelated processes • Example is time-sharing system Operating System

  5. Very Coarse-Grained Parallelism • Distributed processing across network nodes to form a single computing environment • Good when there is infrequent interaction among processes • overhead of network would slow down communications Operating System

  6. Coarse 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 Operating System

  7. Medium-Grained Parallelism • Parallel processing or multitasking within a single application • Single application is a collection of threads • Threads usually interact frequently Operating System

  8. Fine-Grained Parallelism • Much more complex use of parallelism than is found in the use of threads • parallelism inherent in a single instruction stream • Highly parallel applications • Specialized and fragmented area Operating System

  9. Operating System

  10. Design Issues of Multiprocessor Scheduling • 프로세스를 어느 처리기에 할당할 것인가? • 각 처리기에서 다중프로그래밍을 지원할 것인가? • 다음에 실행할 프로세스로 어떤 프로세스를 선택할 것인가?

  11. Assignment of Processes to Processors (1) • Treat processors as a pooled resource and assign process to processors on demand • Permanently assign process to a processor • Known as group or gang scheduling • Dedicate short-term queue for each processor • Less overhead • Processor could be idle while another processor has a backlog

  12. Assignment of Processes to Processors (2) • Global queue • Schedule to 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 whole system • Master can become a performance bottleneck

  13. Assignment of Processes to Processors (3) • Peer architecture • Operating system can execute on any processor • Each processor does self-scheduling • Complicates the operating system • Make sure two processors do not choose the same process

  14. Process Scheduling • Single queue for all processes • Multiple queues are used for priorities • All queues feed to the common pool of processors Operating System

  15. 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 Operating System

  16. 다중 처리기 스케줄링(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 Operating System

  17. 다중 처리기 스케줄링(Multiprocessor Scheduling) (2) • Load Sharing(부하 분산) • 부하를 모든 프로세서에 대해 적절하게 분산한다 • 유휴 프로세서가 없음을 보장 • 중앙 집중식 스케줄러가 필요 없다 • global queue을 사용 • 단 점: • global queue에 대한 상호배제  하나 이상의 프로세서가 동시에 실행할 작업을 얻고자 할 때에 bottleneck이 될 수 있다 • 선점된 스레드가 동일한 프로세서에서 실행을 재개할 가능성이 적다  캐시의 효율성을 떨어뜨린다 • 하나의 프로그램을 구성하는 모든 스레드가 동시에 프로세서를 얻어 실행할 가능성이 적다 Operating System

  18. 다중 처리기 스케줄링(Multiprocessor Scheduling) (3) • Gang Scheduling • 하나의 프로세스을 구성하는 모든 스레드들에 대해 동시 스케줄링 • 응용 프로그램의 부분적인 실행으로 성능이 심각하게 떨어지는 응용 프로그램에 대해서는 유용하다 • 스레드는 상호간에 동기화를 종종 요구한다 • Dedicated Processor Scheduling • 하나의 프로세스를 구성하는 모든 스레드를 하나의 프로세서에 할당한다 • 일부 프로세서가 유휴상태가 될 수 있다 • process switching을 피한다 Operating System

  19. 다중 처리기 스케줄링(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) Operating System

  20. 실시간 시스템(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 Operating System

  21. 실시간 운영체제의 특성 (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 Operating System

  22. 실시간 운영체제의 특성 (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 Operating System

  23. 실시간 운영체제의 기술적 특징 (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 Operating System

  24. 실시간 운영체제의 기술적 특징 (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 Operating System

  25. Scheduling of a Real-Time Process (1) Operating System

  26. Scheduling of a Real-Time Process (2) Operating System

  27. 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 Operating System

  28. 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 Operating System

  29. Deadline Scheduling (2) • Earliest deadline scheduling • 데드라인이 가장 임박한 태스크를 먼저 실행하도록 스케줄링 • 데드라인이 가장 가까운 태스크에게 높은 우선순위를 부여 • 데드라인을 만족시켜 주지 못하는 태스크의 수를 최소화 • 단일 처리기/다중 처리기 시스템 모두에 적용 가능 • 모드 태스크들이 주기적으로 실행되고 또 예측 가능하여야 함 • 자발적 유휴 시간을 허용하는 earliest deadline scheduling • 기본적으로 earliest deadline scheduling 정책에 따라 스케줄링 • 충분한 데드라인을 가지는 타스크에 대해 유휴 시간을 가지게 함으로써 다른 타스크에 대한 스케줄링에 융통성을 제공 Operating System

  30. Two Tasks Operating System

  31. Operating System

  32. Operating System

  33. Operating System

  34. 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 • 주기적 실시간 다중 타스크들을 스케줄링할 때 발생하는 문제점들을 효율적으로 해결 Operating System

  35. Periodic Task Timing Diagram Operating System

  36. Operating System

  37. Earliest Deadline Scheduling(EDS)vs. Rate Monotonic Scheduling(RMS) • EDS가 이론적으로 더 높은 처리기 이용률을 달성하여 RMS보다 더 많은 주기적 타스크들을 스케줄링 가능 • 반면, 상용 실시간 시스템에서는 RMS를 광범위하게 사용 • 두 스게줄링 정책의 성능 차이가가 현실적으로 크기 않다 • 경성 실시간 타스크와 연성 실시간 타스크가 동시에 지원되는 환경에서 RMS는 경성 실시간 타스크 스케줄링 과정에서 발생하는 유휴 처리기 시간을 이용하 연성 실시간 타스크를 스케줄링함으로써 시스템 효율성을 높임 • RMS가 EDS보다 높은 시스템 안정성을 확보 Operating System

  38. 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 Operating System

  39. Duration of a priority inversion depends on unpredictable actions of other unrelated tasks Unbounded Priority Inversion Operating System

  40. Lower-priority task inherits the priority of any higher priority task pending on a resource they share Priority Inheritance Operating System

  41. Thread Scheduling (1) • Possible scheduling of user-level threads • 50-msec process quantum / threads run 5 msec/CPU burst • 응용 스레드 스케줄러 사용으로 보다 효율적으로 스케줄링 가능 • 스레드 문맥 교환은 운영체제의 개입이 필요 없어 간단 Operating System

  42. Thread Scheduling (2) • Possible scheduling of kernel-level threads • 50-msec process quantum / threads run 5 msec/CPU burst • 커널 스케줄러에 의해 스레드 스케줄링이 실행 • 스레드 문맥 교환 비용이 크다 A1 스레드가 블록킹 된 후에 다른 스레드로 스케줄링할 때에 A2와 B1 스레드의 중요도가 같으나 문맥교환 비용이 B1이 높을 때에 다음에 실행될 스레드는? Operating System

  43. 알고리즘 평가 • 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) Operating System

  44. 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 Operating System

  45. Operating System

  46. 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 Operating System

  47. Operating System

  48. UNIX SVR4 Scheduling • Highest preference to real-time processes • Next-highest to kernel-mode processes • Lowest preference to other user-mode processes Operating System

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

  50. SVR4 Priority Classes Operating System

More Related