zoukankan      html  css  js  c++  java
  • Operation System Concepts Ch.5 Process Scheduling

    Time-sharing

    Hdw save u-regs(A) to k-stack(A)

    OS save k-regs(A) to PCB(A)

    OS restore k-regs(B) from PCB(B)

    Hdw restore u-regs(B) from k-stack(B)

    CPU scheduler decides which runs next

    Dispatcher performs context switch (switch context, switch to user mode, jump to proper location)

    Dispatch latency: time it takes

    Timing: CPU scheduling decisions make occur when a process: run->wait, run->ready, wait->ready, end (->ready may be preemptive)

    Scheduling Overview

    Criteria: CPU utilization, throughput, turnaround time, waiting time, response time

    Assumptions:

    1. same amount of time
    2. same arrive time
    3. no preemption
    4. only CPU, no I/O
    5. length known

    FCFS

    just FIFO

    now, relax assumption 1

    Convoy effect: short queued behind heavyweight

    SJF

    shortest job first

    it's a special case of priority

    Priority

    priority highest first

    Starvation: low prio may never execute

    Aging: as time goes by, prio++

    HRRN

    highest response ratio next

    [RR=1+frac {wait} {Erun} ]

    relax assumption 3: preemptive (modern)

    Preemptive SJF

    also called STCF, SRTF

    good for turnaround time, not good for response time

    Round-Robin

    time-slicing

    good for response time, not good for turnaround time

    relax 4, consider I/O, then... break job into subjobs

    relax 5, can only estimate length, use exp averaging (T_{n+1}=alpha t_n + (1-alpha) T_n)

    MLQ

    ready queue separate (e.g. fore interactive, back batch)

    proc permanently in a given queue

    each queue has own algorithm (e.g. fore RR, back FCFS)

    cross-queue schedule: fixed priority, time slice

    MLFQ

    relax all assumptions

    goal: optimize turnaround time, minimize response time

    idea: learn the feature (first assumes a short, if not, move down)

    Original Version

    1. A>B, A run
    2. A=B, RR
    3. new, highest
    4. uses up entire time slice, prio reduce
    5. give up before slice end, prio keep

    Limitations: starvation (too many short), game (hack), changeable

    Priority Boost

    New Rule: After some period S, move all jobs in the topmost queue

    Improvement: no starvation, prio adjust

    Better Accouting

    how to prevent the game (hack)?

    New Rule: Once use up (acc), prio reduced

    note: vary length across different queues

    etc

    Thread Scheduling

    it is kernel-level threads(not processes) that are being scheduled

    M:1/M:M: thread lib schedules uer-level threads to run on LWP

    Multiple-Processor Scheduling

    Cache Affinity

    Asymmetric MP: single-queue mp scheduling, all job in a single queue

    Symmetric MP: one queue per CPU, each queue a particular discipline,

    Real-Time

    Soft: no guarantee

    Hard: must by deadline

    Interrupt/Dispatch latency

  • 相关阅读:
    1030 完美数列 (25 分)
    1029 旧键盘 (20 分)
    数据库命令失败原因汇总
    代码有中文括号,导致错误
    win10笔记本触控板使用指南
    (已解决)vsC#控制台应用添加System.Windows.Forms引用失败(精通C#)
    ildasm中Ctrl+M闪退的问题(已解决, 精通C# 15.1)
    C#控制台应用(.NET Core)添加System.Windows.Forms失败(已解决)
    知识点_指针_增加对指针的理解
    自己写出的Bug_应是%f却写成%d
  • 原文地址:https://www.cnblogs.com/mollnn/p/14704272.html
Copyright © 2011-2022 走看看