round robin cpu scheduling » gate fundas

Upload: shardapatel

Post on 01-Nov-2015

9 views

Category:

Documents


0 download

DESCRIPTION

1

TRANSCRIPT

  • 05/08/2015 RoundRobinCPUSchedulingGATEFundas

    http://www.gatefundas.com/roundrobincpuscheduling/ 1/5

    ALLGATERELATEDQUERIES,ARTICLESANDDISCUSSIONS

    Search

    GATEFundas

    ShortestRemainingtimefirst(SRTF)CPUscheduling

    MiscellaneousexamplesonCPUschedulingwhereprocessesspendsometimedoingCPUandsometimedoingI/O

    OperatingSystem Addcomments

    RoundRobinCPUSchedulingOct112014

    RoundRobinschedulingismostpracticalschedulingalgorithmsusedforschedulingtheprocessesontotheCPU.Inthisalgorithmeveryprocessisexecutedforatimequantum(timeslice)andthenpreemptedtogivechancetootherprocess.

    Criteria:Timequantum(Timeslice),arrivaltimeMode:Preemptive

    Flowchartofroundrobinscheduling

    Example1:Findaverageresponsetime,averageturnaroundtimeandaveragewaitingtime

    P.No. Arrivaltime Bursttime

    1 0 4

    2 1 5

    3 2 2

    4 3 1

    5 4 6

    6 6 3

    Timequantum=2

    Solution:Inroundrobinschedulingwehavetomaintainonereadyqueueinwhichprocessesarekeptandexecutedinthesameordertheyentered.

    Bethefirstofyourfriendstolikethis

    GATEfundas129likes

    LikePage Share

    Search

    Search

    Subnetting

    IPaddressing2

    IPaddressing1

    SolutionsofSomepreviousyearGATEquestionsonCPUscheduling

    PrioritybasedScheduling

    RecentPosts

    RecentComments

    Home ComputerNetworks TheoryOfComputation DBMS OperatingSystem Electronics&Communication

    Fe

    edba

    ck

  • 05/08/2015 RoundRobinCPUSchedulingGATEFundas

    http://www.gatefundas.com/roundrobincpuscheduling/ 2/5

    Readyqueue:emptyP1arrivesatt=0Readyqueue:P1soaccordingtoflowchartB.T

  • 05/08/2015 RoundRobinCPUSchedulingGATEFundas

    http://www.gatefundas.com/roundrobincpuscheduling/ 3/5

    2 4 6

    3 3 7

    4 1 9

    5 2 2

    6 6 3

    Timequantum=3

    Solution:FollowingtheexplanationofaboveexampleGANTTchartandreadyqueueofthisexampleareasfollows

    ReadyQueue:P4,P5,P3,P2,P4,P1,P6,P3,P2,P4,P1,P3

    P4 P5 P3 P2 P4 P1 P6 P3 P2 P4 P1 P3

    0 1 4 6 9 12 15 18 21 24 27 303233

    Responsetime=firstresponsetimearrivaltimeTurnaroundtime=completiontimearrivaltimeWaitingtime=turnaroundtimebursttime

    P.No. Arrivaltime Bursttime Completiontime Turnaroundtime Waitingtime responsetime

    1 5 5 32 27 22 10

    2 4 6 27 23 17 5

    3 3 7 33 30 23 3

    4 1 9 30 29 20 0

    5 2 2 6 4 2 2

    6 6 3 21 15 12 12

    Total=128 Total=96 Total=32

    AverageResponsetime=32/6=5.3Averageturnaroundtime=128/6=21.3Averagewaitingtime=96/6=16

    Example3:Consider4processesP1,P2,P3,P4allarrivinginthesameorder.Thebursttimerequirementsoftheprocessesare4,1,8,1respectivelythenwhatisthecompletiontimeofprocessP1.AssumingroundrobinschedulingwithTimeQuantum=1a)7b)8c)9d)10

    Solution:Givenallprocessesarriveinsameordersotakearrivingtimeofallprocessesas0

    P.No Arrivaltime Bursttime

    1 0 4

    2 0 1

    3 0 8

    4 0 1

    AsarrivaltimesofalltheprocessesaresamesofirstplacetheprocessesinreadyqueuebasedonlowestprocessnumberfirstReadyQueue:=P1,P2,P3,P4Nowproceedinthesamewayasexplainedabove.

  • 05/08/2015 RoundRobinCPUSchedulingGATEFundas

    http://www.gatefundas.com/roundrobincpuscheduling/ 4/5

    P1 P2 P3 P4 P1 P3 P1 P3 P1 P3

    0 1 2 3 4 5 6 7 8 9

    CompletiontimeofP1is9

    Example4:[GATE2012]Considerthreeprocessesshowninthetable

    Process Arrivaltime Bursttime

    P1 0 5

    P2 1 7

    P3 3 4

    ThecompletionorderoftheprocessesunderthepoliciesFCFSandroundrobinwithtimequantumof2units(a)FCFS:P1,P2,P3RR:P1,P2,P3(b)FCFS:P1,P3,P2RR:P1,P3,P2(c)FCFS:P1,P2,P3RR:P1,P3,P2(d)FCFS:P1,P3,P2RR:P1,P2,P3

    Solution:

    P1arrivesatt=0ReadyQueue:P1forP1B.T

  • 05/08/2015 RoundRobinCPUSchedulingGATEFundas

    http://www.gatefundas.com/roundrobincpuscheduling/ 5/5

    2014GATEFundas CustomisedbyGATEFundasteam

    Examplesonlosslessjoindecomposition2commentsayearago

    nishantagrawal25AC+isacbdegfororiginaldependencysetbutwhenyouwilllookindecomposedrelationitisonly

    MinimalcoverorCanonicalcoverofgivenFDset2commentsayearago

    nishantagrawal25GladtoknowthattheseexampleshelpedyouThanksforpointingoutthetypo,It'scorrectednowPleasetellif

    ALSOONWWW.GATEFUNDAS.COM

    2Comments www.gatefundas.com Login1

    Share SortbyBest

    Jointhediscussion

    Reply

    meli 7monthsagoAreusurethat?MynoteshowTurnarround=completesubmited..notTurnarround=completearrival

    Reply

    nishantagrawal25 7monthsagoMod >meliSubmittedandarrivalmeanssamethinghere...SubmittedmeanswhenjobissubmittedtotheCPUwhichissameasarrivaltime

    WHAT'STHIS?

    Subscribe AddDisqustoyoursited Privacy

    Recommend

    Share

    Share