0% found this document useful (0 votes)
281 views5 pages

Investigating Process Scheduling

This document describes an experiment using a CPU-OS simulator to learn about different process scheduling methods: first-come first-served (FCFS), priority-based, round-robin. It provides learning objectives, instructions for setting up test processes in the simulator, and tasks for observing and comparing the behavior of each scheduling method by tracking running/waiting processes.

Uploaded by

brumguy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
281 views5 pages

Investigating Process Scheduling

This document describes an experiment using a CPU-OS simulator to learn about different process scheduling methods: first-come first-served (FCFS), priority-based, round-robin. It provides learning objectives, instructions for setting up test processes in the simulator, and tasks for observing and comparing the behavior of each scheduling method by tracking running/waiting processes.

Uploaded by

brumguy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

InvestigatingProcessScheduling

LearningObjectives
Attheendofthislabyoushouldbeableto:
1. Describefirstcomefirstserved(FCFS)processschedulingmethod
2. Describeprioritybasedprocessschedulingmethod
3. Explainthedifferencebetweennonpreemptiveandpreemptivepriorityscheduling
mechanisms
4. DemonstratetheuseofroundrobinprocessschedulingmethodinsharingtheCPU
betweendifferentprocesses

TutorialExercises
InitialPreparation
CPUOSSimulatorsimulatesthefunctionsofatypicalmodernCPUandatypicalOperating
System(OS)bothofwhicharesupportedbytheinbuiltassemblerandcompiler.Tostartthe
simulator,doubleclickonthesimulatoricon.ThisstartsuptheCPUsimulatorsmainwindow.
Inordertobeabletodothefollowingexercises,youneedtoenteraprogramwhichtheOS
simulatorcanrun.TodothisyouneedtogotothecompilerbyclickingontheCOMPILER
buttonintheAdvancedtab.Enterthefollowingprogramintheeditwindowandcompile.

pr ogr amSi mpl eLoop
f or n = 1 t o 40
p = p + 1
next
end

WhentheaboveprogramissuccessfullycompiledyoullneedtoloaditintheCPUsmemory.
YoudothisbyclickingontheLOADINMEMORYbutton.Thiswillthentakeyoubacktothe
CPUsimulator.ToviewtheOSsimulatorsmainwindowfirstselecttheAdvancedtabandthen
clickontheOS0button.

LO1:Describefirstcomefirstserved(FCFS)processschedulingmethod.
Nowthattheprogramcodeisinsimulatorsmemoryitcanberun.Todothisyouneedto
manuallycreateoneormoreinstancesofit(realOSdoesthisautomatically).Firstmakesure
theFCFSschedulingmethodisselectedinthePoliciestab.NextselecttheProcesstaband
usingtheCREATENEWPROCESSbuttoncreatetheprocessesinTable1,intheordertheyare
listed,makingsurecorrectprioritiesareselected:
1

ProcessId Priority
P1 2
P2 4
P3 3
Table1
YoushouldseetheprocesseslistedintheREADYPROCESSESview.Thisviewrepresentsthe
ReadyQueue.Theprocessatthetopofthelististheheadofthequeueandthelastprocessin
thelististhetailofthequeue.
Now,OSsimulatorisreadytoruntheprocesses.TodothisfirstdragtheCPUSpeedslidertoa
positionaround60(thenumberisdisplayedasyoudragtheslider).Thisisrequiredsothatthe
processesrunslowlyinordertoalloweasyobservations.ClickontheSTARTbutton.You
shouldnowseeaprocessintheRUNNINGPROCESSESview.Thisviewshowsthecurrently
runningprocess.
Next,createafourthprocess,P4,withpriority1andoncethisprocessiscreatedfillinthe
requiredinformationinTable2below:

Table2
MovetheCPUSpeedslidertotheFastposition(i.e.topoftheslider)andwaituntilALL
processesruntonormalcompletion(thismaytakefewseconds).
MakeabriefcommentinthespacebelowregardingthewayFCFSschedulingworks:

Running
Process
WaitingProcesses
(firstentryisthe
headofthequeue)

2
LO2:Describeprioritybasedprocessschedulingmethod.
Forthisexerciseyouneedtoselectadifferentschedulingmethod.TodothisselectthePolicies
tab.ThenselectthePriority(static)optionandtheNonpreemptiveoption.Next,usingthe
CREATENEWPROCESSbuttoncreatethefourprocesseslistedintheTable1,oneafterthe
other,makingsurecorrectprioritiesareselected.
NowrepeatthesameprocedureasinthefirstexerciseandentertheresultsintheTable3
below:
Running
Process
WaitingProcesses
(firstentryisthe
headofthequeue)

Table3
MovetheCPUSpeedslidertotheFastposition(i.e.topoftheslider)andwaituntilALL
processesruntonormalcompletion(thismaytakefewseconds).
Makeabriefcommentinthespacebelowregardingthewaynonpreemptivepriority
schedulingworks:

LO3:Explainthedifferencebetweennonpreemptiveandpreemptivepriorityscheduling
mechanisms.
Inthisexerciseyoullagainusepriorityschedulingmethodasintheaboveexercisebutthis
timeyouneedtoselectthePreemptiveoptioninthePoliciestab.Onceagain,usingthe
CREATENEWPROCESSbuttoncreatethefourprocesseslistedintheTable1,oneafterthe
other,makingsurecorrectprioritiesareselected.
NowrepeatthesameprocedureasinthefirstexerciseandentertheresultsintheTable4
below:
3
Running
Process
WaitingProcesses
(firstentryisthe
headofthequeue)

Table4
MovetheCPUSpeedslidertotheFastposition(i.e.topoftheslider)andwaituntilall
processesruntonormalcompletion(thismaytakefewseconds).
Makeabriefcommentinthespacebelowregardingthewaypreemptivepriorityscheduling
workssummarisinghowthetwopriorityschedulingmethodsdiffer:

LO4:DemonstratetheuseofroundrobinprocessschedulingmethodinsharingtheCPU
betweendifferentprocesses.
ForthisexerciseyouneedtochangetheschedulingmethodtoRoundRobin(RR)inthePolicies
tab.AlsoselectthepriorityoptionNonemeaningprocessprioritieswillnotbeused.Nextyou
needtoselectRRTimeSliceof5ticksfromthedropdownlist.ThisisusedbytheOSsimulator
todecidehowlongaprocesswillbeallowedtorunbeforeitisreturnedtothereadyqueue.
Finally,ticktheSuspendonstatechangecheckboxundertheRUNNINGPROCESSESview.This
suspendstheprocessassoonasitisputintotherunningstatetofacilitateobservations.
NowcreatetheprocessesasspecifiedinTable5below(Tospecifyprocesslifetimeselectthe
SecsoptionandenterthetimeinsecondsintheLifetimebox.Youneedtodothisbefore
creatingtheprocessbyclickingontheCREATENEWPROCESSbutton)
ProcessId Processlifetimein
ticks
P1 10
P2 7
P3 20
Table5
4
MovetheCPUSpeedslidertotheFastposition(i.e.topoftheslider)andclicktheSTART
button.AstheprocessesmovefromReadytoRunningstatetheyaresuspended.Makeanote
oftherunningprocessandclickontheRESUMEbuttontorestartthesuspendedrunning
process.Repeatthiseachtimemakingnoteofthenextrunningprocessuntilallprocessesrun
tonormalcompletion.EnterthesequenceoftherunningprocessesinTable6below:

Elapsed
tick
count

Process
Id

Table6

Makeabriefcommentinthespacebelowregardingthewayroundrobinschedulingworks:

Note:TheOSsimulatormaintainsarunninglogwhichcanbeviewedtoobtaininformationon
thehistoryofprocessstates.ToviewthislogselecttheViewtabintheOSsimulatorwindow
andclickontheVIEWLOGbutton.Thisisforyourinformationonly.
5

You might also like