届普通本科专业毕业论文(设计).ppt_第1页
届普通本科专业毕业论文(设计).ppt_第2页
届普通本科专业毕业论文(设计).ppt_第3页
届普通本科专业毕业论文(设计).ppt_第4页
届普通本科专业毕业论文(设计).ppt_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Scheduling Algorithmic Research,Rami Abielmona 94.571 (ELG 6171) Monday March 27, 2000 Prof. T. W. Pearce,Scheduling Algorithms Introduction,Problem definition: “One CPU with a number of processes. Only one process can use the CPU at a time and each process is specialized in one, and one task. Whats the best way to organize the processes (schedule them) ?” 1 “How will the CPU time be divided among the processes and threads competing to use it ?” 2,Scheduling Algorithms Embedded OS Architecture,Kernel: The executor Executive: The manager Application Programs: The programmer tasks Real World Interfacing: S/W handling the H/W,Scheduling Algorithms Basic Assumptions,A pool of runnable processes are contending for one CPU; The processes are independent and compete for resources; The job of the scheduler is to distribute the scarce resource of the CPU to the different processes “fairly” and in an optimal way; The job of the dispatcher is to provide the mechanism for running the processes; The OS is a multitasking, but not a multiprocessor, one; Only CPU scheduling is considered (the lowest level of scheduling).,Scheduling Algorithms Evaluation Characteristics,Scheduling Algorithms Processes and Resources,Resources: Preemptible: Take resource away, use it for something else, then give it back. (e.g. processor or I/O channel) Non-preemptible: Once give, it cant be reused until process gives it back. (e.g. file space or terminal),Processes: IO bound: Perform lots of IO operations. IO burst - short CPU burst to process IO - IO burst CPU bound: Perform lots of computation and do little IO CPU burst - Small IO burst - CPU burst,Scheduling Algorithms Process State Transitions,The states of a process, at any given time, is comprised of the following minimal set: Running: The CPU is currently executing the code belonging to the process. Ready: The process could be running, but another process has the CPU. Waiting: Before the process can run, some external event must occur.,Scheduling Algorithms Types of Schedulers,Long-term scheduler: admits new processes to the system; required because each process needs a portion of the available memory for its code and data. Medium-term scheduler: is not found in all systems; required to control the temporary removal from memory of a process when the latter is extractable. Short-term scheduler: determines the assignment of the CPU to ready processes; required because of IO requests and completions.,Scheduling Algorithms The Contestants (1),First-Come First-Serve (FCFS) One ready queue; OS runs the process at head of the queue; New processes come in at the end of the queue; Running process does not give up the CPU until it terminates or it performs IO. Round Robin Process runs for one time slice, then moved to back of the queue; Each process gets equal share of the CPU.,Scheduling Algorithms The Contestants (2),Shortest Time to Completion (STCF) Process with shortest computation time left is picked; Varianted by preemption; Requires knowledge of the future. Exponential Queue (Multi-level Feedback) Gives newly runnable processes a high priority and a very short time slice; If process uses up the time slice without blocking then decrease priority by one and double time slice for next time; Solves both efficiency and response time problems.,Scheduling Algorithms The Contestants (3) - Priorities,Priority Systems The highest priority ready process is selected In case of a tie, FCFS can be used Priorities could be assigned: Externally (e.g. by a system manager) Internally (e.g. by some algorithm) Combination of external and internal Preemptive schemes: Once a process starts executing, allow it to continue until it voluntarily yields the CPU Non-preemptive schemes: A running process may be forced to yield the CPU by an external event rather than by its own action,Scheduling Algorithms First-Come First-Serve,Non-preemptive FCFS (no priority scheme) Simplest implementation of scheduling algorithms Used on timeshared systems (with timer interruption) Non-preemptive FCFS (with priority scheme) Next highest priority process is picked when CPU is yielded Once process grabs CPU, former keeps latter until completion Rarely used in real-time systems Preemptive FCFS (with priority scheme) Most popular FCFS algorithm,Scheduling Algorithms Round Robin,Used mostly on timeshared systems Allows multiple users slices of the CPU on a “round robin” basis Majority of users have the same priority Not a popular scheme with dynamic priority systems,Scheduling Algorithms Shortest Time to Completion,Priorities are assigned in inverse order of time needed for completion of the entire job Minimizes average turnaround time Exponential averaging is used to estimate the process burst duration A job exceeding the resource estimation is aborted A job exceeding the time estimation is preempted Store estimated value in PCB for the current burst, and compare with actual value,Scheduling Algorithms Exponential Queues,Popular in interactive systems A single queue is maintained for each priority level A new process is added at the end of the highest priority queue It is alloted a single time quantum when it reaches the front If it yields the CPU within the time quantum, it is moved to the rear If not, it is placed at the rear of the next queue down Dispatcher selects the head of the highest priority queue A job that “succeeds” moves up A job that “fails” moves down,Scheduling Algorithms Implementation - Data Structures,A queue of processes is implemented by linking PCBs together using a linked list (with first and last node pointers) Since this projects queues are known to be short, priority is implemented by using priority queues, and PriorityInsert() function calls Different queues are used to represent different states of processes (Ready, Suspended) Self-release of CPU Internal signal Process completion Forced-release of CPU Time slot expired External signal,Process ID Status Priority Next Process,Scheduling Algorithms Implementation - Progress,Used an OO template in order to easily and efficiently implement any necessary queue Used structurally defined functions to “simulate” the scheduler and dispatcher fill_poolQ(), get_tasks(src,dest), sort(queue) Implemented FCFS, RR and STCF RR was implemented to fairly compare schemes Theoretical work still needs to be done comparison and evaluation,Scheduling Algorithms Implementation - Issues,The underlying interrupt system basically readies the task for a switch, but does not perform the switch Process switches are directly handled by the scheduler This causes a delay from the time of readiness to the time of the switch, which is not tolerated for, lets say, system exceptions The solution is to completely by-pass the scheduler (OS) and go directly to an ISR. 1,Each process is allocated its own private stack and workspace This is done to avoid different processes overwriting each others data and code This is based on a strict process model, where all heavyweight processes do not share resources Code that can be shared safely is called re-entrant code 1,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论