Lecture Scheduling

Embed Size (px)

Citation preview

  • 7/25/2019 Lecture Scheduling

    1/19

    CGS 3763 Operating Systems Concepts

    Spring 2013

    Dan C. MarinescuOffice: HC 30!

    Office "ours: M#$% 11:30 # 12:30 &M

  • 7/25/2019 Lecture Scheduling

    2/19

    'ast time:

    (o%ay: C)* sc"e%u+ing

    ,e-t time

    'ecture / Mon%ay anuary 2 2013

    12116 2

  • 7/25/2019 Lecture Scheduling

    3/19

    Sc"e%u+ing

    4asic concepts5 sc"e%u+ing oecti8es.

    Sc"e%u+ing po+icies 9irst#Come 9irst#Ser8e 9C9S;

    S"ortest o 9irst S9;

  • 7/25/2019 Lecture Scheduling

    4/19

  • 7/25/2019 Lecture Scheduling

    5/19

  • 7/25/2019 Lecture Scheduling

    6/19

    Sc"e%u+ing po+icies

    4urst time

    time re=uire% y a t"rea% to use t"e processorcore (ime s+ice=uantumtime a t"rea% is a++o>e% to use t"e processorcore

    )reempti8e sc"e%u+ing& t"rea% cou+% e force% to re+ease t"e

    contro+ of t"e processor

    )o+icies

    9irst#Come 9irst#Ser8e 9C9S S"ortest o 9irstS9

  • 7/25/2019 Lecture Scheduling

    7/19

    9irst#Come 9irst#Ser8e% 9C9S;

    ("rea% 4urst (imeP1 2!

    P2 3

    P3 3 )rocesses arri8e in t"e or%er: P1P2P3

    Gantt C"art for t"e sc"e%u+e:

    $aiting time for P1 05 P2 2!5 P3 27 &8erage >aiting time: 0 F 2! F 27;3 17 Convoy effects"ort process e"in% +ong process

    )1 )2 )3

    2! 27 300

    7'ecture 20

  • 7/25/2019 Lecture Scheduling

    8/19

    ("e effect of t"e re+ease time on 9C9S sc"e%u+ing

    ,o> t"rea%s arri8e in t"e or%er: P2P3P1

    Gantt c"art:

    $aiting time for P1 =6;P2 0; P3 = 3

    &8erage >aiting time: 6 F 0 F 3;3 3 Muc" etterEE

    )1)3)2

    63 300

    8'ecture 20

  • 7/25/2019 Lecture Scheduling

    9/19

    S"ortest#o#9irst S9;

    *se t"e +engt" of t"e ne-t urst to sc"e%u+e t"e t"rea%process >it"

    t"e s"ortest time.

    S9 is optima+minimum a8erage >aiting time for a gi8en set of

    t"rea%sprocesses

    (>o sc"emes: ,on#preempti8et"e t"rea%process cannot e preempte% unti+

    comp+etes its urst

    )reempti8eif a ne> t"rea%process arri8es >it" urst +engt" +ess t"an

    remaining time of current e-ecuting process preempt. ?no>n as

    S"ortest#

  • 7/25/2019 Lecture Scheduling

    10/19

    -amp+e of non#preempti8e S9

    ("rea% aiting time 0 F 6 F 3 F 7;! !

    )1 )3 )2

    73 160

    )!

    12

    10'ecture 20

  • 7/25/2019 Lecture Scheduling

    11/19

    -amp+e of S"ortest#

  • 7/25/2019 Lecture Scheduling

    12/19

    it" respect to conte-t s>itc"

    ot"er>ise o8er"ea% is too "ig"

    12'ecture 20

  • 7/25/2019 Lecture Scheduling

    13/19

    it" time s+ice = 20

    ("rea% 4urst (ime

    P1 3

    P2 17

    P3 6

    P4

    2!

    (ypica++y "ig"er a8erage turnaroun% t"an S9 ut etter response

    )1 )2 )3 )! )1 )3 )! )1 )3 )3

    0 20 37 7 77 7 117 121 13! 1! 162

    13'ecture 20

  • 7/25/2019 Lecture Scheduling

    14/19

    (ime s+ice =uantum; an% conte-t s>itc" time

    14'ecture 20

  • 7/25/2019 Lecture Scheduling

    15/19

    (urnaroun% time function of time =uantum

    15'ecture 20

  • 7/25/2019 Lecture Scheduling

    16/19

    o

  • 7/25/2019 Lecture Scheduling

    17/19

    Sc"e%u+ingpo+icy

    &8erage >aiting timeti++ t"e o starte%

    &8erage time insystem

    9C9S 73 173

    S9 !3 1!3

  • 7/25/2019 Lecture Scheduling

    18/19

    )riority sc"e%u+ing

    ac" t"rea%process "as a priority an% t"e one >it" t"e "ig"est

    priority sma++est integer "ig"est priority; is sc"e%u+e% ne-t. )reempti8e

    ,on#preempti8e

    S9 is a priority sc"e%u+ing >"ere priority is t"e pre%icte% ne-t C)*

    urst time

    )ro+emStar8ation / +o> priority t"rea%sprocesses may ne8er

    e-ecute

    So+ution to star8ation&ging / as time progresses increase t"e

    priority of t"e t"rea%process

    )riority my e compute% %ynamica++y

    18'ecture 20

  • 7/25/2019 Lecture Scheduling

    19/19