Journal of STEM Education: Innovations and Research · Framework for Organization and Control of...

24

Transcript of Journal of STEM Education: Innovations and Research · Framework for Organization and Control of...

Page 1: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance
Page 2: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education: Innovations and ResearchJuly – December 2006, Volume 7, Issues 3 & 4

International Editorial Advisory Board Members 2

Editorial Review Board Members 3

Editorial 4

FEATURES

The Right Answer Is Communication When Capstone Engineering 5Courses Drive the Questions Julie Dyke Ford and Scott W. Teare

Teaching Teachers to Teach Green Engineering 13Ann Marie Flynn, Mohammad H. Naraghi, Nicole Austin, Sean Helak andJarrod Manzer

Web-based Implementation of Discrete Mathematics 25Tanzy Love, Fritz Keinert and Mack Shelley

Framework for Organization and Control of Capstone Design/Build 36 Darrell D. Massie, Ph.D. and Cheryl A. Massie, P.E., L.C.

An Electronic Web-based Assessment System 44Raina Petrova, Abhilasha Tibrewal and Tarek M. Sobh

Parametric Optimization Of Some Critical Operating System 58Functions – An Alternative Approach To The Study Of Operating System Design Tarek M. Sobh and Abhilasha Tibrewal

Experimental Modal Analysis of Rectangular and Circular Beams 80B. H. Emory and W. D. Zhu

Instructions for Authors 101 Contribution Form 102

The Journal of STEM Education: Innovations and Research (ISSN 1557-5284) is published by The Institute for STEM Education and Research, P.O. Box 4001, Auburn, AL 36831. www.jstem.org The Institute for STEM Education and Research is a non-profit entity. Periodicals postage rate paid at Auburn, AL and additional mailing offices.

CONTRIBUTIONS are greatly appreciated and are tax-exempt.

PERMISSION FOR USE: The copyright owner’s consent does not extend to copying for general distribution, for promotion, for creating new works or for resale. Specific written permission must be obtained from the publisher for such copying.

Copyright @ 2006 by The Institute for STEM Education and Research. It is a condition of publication that manuscripts submitted to this journal have not been published and will not be simultaneously submitted or published elsewhere. By submitting a manuscript, the authors agree that the copyright for their article is transferred to the publisher if and when the article is accepted for publication. The copyright covers the exclusive rights to reproduce and distribute the article, including reports, photographic reproductions, microfilm or any other reproduction of similar nature and translations. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, photocopying, recording or otherwise, without permission in writing from the copyright holder.

Page 3: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 58

Parametric Optimization Of Some Critical Operating System Functions – An Alternative Approach To The Study Of Operating Systems Design

University of Bridgeport

Tarek M. Sobh, Abhilasha Tibrewal

AbstractOperating systems theory primar-ily concentrates on the optimal use of computing resources. This paper presents an alternative ap-proach to teaching and studying operating systems design and concepts by way of parametrically optimizing critical operating sys-tem functions. Detailed examples of two critical operating systems functions using the presented ped-agogical approach are included.

1. Introduction Thefocusofthispaperistopresentanewapproach to teaching and studying operatingsystemsdesignandconceptsbywayofpara-metricallyoptimizingcriticaloperatingsystemsfunctions.Byusingparametricoptimization,thestudents get an opportunity to build a strongunderstanding of critical operating systemsfunctions and design without implementing areal system. Moreover, the use of simulationgivesthemachancetohonetheirprogrammingskillsanddatastructureskillsas theydevelopa model of the real system. Specifically, CPUscheduling, memory management, deadlock/synchronization primitives and disc schedul-ingarethefourspecificfunctionsstudiedinthecourse.Thispaperpresentsthegeneralorgani-zationofthecoursewithin-depthdiscussionoftwoofthecriticaloperatingsystemfunctions.Alltheconcernedparametersareelaboratedupon,focusingontheireffectonsystemperformanceaswellasinteractionwithotherparameters.

2. Background The operating system is an essential partofanycomputersystem,theoperatingsystembeingtheprogramthatactsasanintermediarybetweenauserofthecomputerandthecom-puterhardware [1].O’Gorman [2] inhispaperprovides a comprehensive list of reasons forwhy operating systems should be part of anycomputersciencecurriculum.Theseinclude:

• Knowledge of how an operating systemdoeswhatitdoes

• Making an informed decision about selec-tionofanoperatingsystem

• Improving theperformanceofanoperatingsystem by adjusting values of associatedparameters

• Operatingsystemsbeingthelargestpiecesofsoftwarewrittenprovidemanyideasandtechniques thatcanbeapplied insoftwaredevelopment

O’Gorman[2],Yun-Lin[3]andLeach[4]intheirrespectivepapershavepresentedthethreetra-ditionalapproachesfollowedinthestudyofop-eratingsystems.Thesecanbeenumeratedas:

a)High level discussion with most program-mingdoneinahighlevellanguage

b)General theoretical approach with severalrealsystemsaddedascasestudies

c)Use of emulator programs which emulatespecialarchitectures

Krishnamoorthy [5] in his paper describesa course using the first approach. He reportsseveral advantages of involving programmingprojects such as valuable implementation ex-perience of essential features of an operatingsystem,testinganddebuggingalargeprogramandvalidationofprinciplesofoperatingsystemslearntintheory. Authors of several textbooks including Sil-berschatz and Galvin [1] and Tanenbaum [6]takethesecondapproachintheirpresentationofthematerial.Whileit iscertainlyatriedandtested approach, O’Gorman [2] elaborates onpotentialdifficultiesinintegratingthecasestud-ieswiththetheoreticalmaterial. Casestudiesof the thirdapproachcanbefound in the works of Oh and Mossé [7] andWearetal[8].Thelatterenlistdirectexperimen-tationwithanoperatingsystembyvaryingbasiccharacteristicsofthesystemandthejobmixasaneffectivemethodtostudyoperatingsystemdesign.Theyfurtherstatethat,“Itisprohibitivelyexpensive,difficultandhazardoustoallowstu-dents toperformsuchexperimentsdirectlyonafunctionalsystemalreadyallocatedforothercomputinguses”.Thesefactorshavebeenstat-edastheprimarymotivationbehinddesigningtheiroperatingsystemsimulatorbyWearetal[8]. Each of the above methods has its ownmerits. The approach of parametric optimiza-tionpresentedinthispaperprovidesahealthybalance of the advantages of each method.Moreover,muchoftheoperating-systemtheoryconcentrateson theoptimaluseofcomputing

Page 4: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 59

resources. The general outline of the courseis presented first followed by two detailed ex-amplesofusingparametricoptimizationinCPUschedulingandmemorymanagement.

3. General Outline of the Course The course described here is an imple-mentation-orientedcourseinthestructureanddesignofoperatingsystems.Theprerequisitesinclude courses in data structures and com-puterarchitectureaswellasagoodknowledgeofC++.ThestudentsarefreetouseotherhighlevellanguageslikeJavaandC#(C++isstatedasaprerequisiteas the introductoryprogram-mingcoursesuseC++ in thecurriculum).Thecourseisopentobothundergraduateandgrad-uate students with course deliverables beingmore rigorous for the graduate audience.Thestudents are proficient in programming by thetimetheytakethiscourseineithercase. Theunderlyinggoalofthecourseistopro-videpracticalexperienceforthetheoreticalcon-ceptsofthesubject.Thisisdonebywayofbothcase studies of real operating systems; andprogrammingprojectssimulating theconceptsand experimenting with them. Furthermore,laboratoriesassignmentsonbothWindowsNTandUnixenvironmentsprovidebreadth to theexperiencewithrealoperatingsystems.Theseincludetopicssuchasinter-processcommuni-cationonthetwoplatforms.Thepaperdoesnotdiscussthispartofthecourseindetailasstan-dardlabmanualsareusedforthispart.Itsuf-ficestostatethattheselabsbringinthemeritsofthesecondapproach(outlinedinsection2ofthispaper)tothecourse. The focus of this paper is the part of thecourse that integrates the first and third ap-proach (outlined in section 2 of this paper) informofprogrammingassignmentsthatsimulatecritical operating system functions and para-metricallyoptimizethem.

4. Parametric Optimization of Operating Systems Modules Inthenextthreesubsections,theessentialcomponents are elaborated upon. Section 4.1discusses the process control block, Section4.2elaboratesontheperformanceparametersandSection4.3introducesthedifferentevalua-tiontechniques.

4.1. Processes and Process Control Block

At theheartof theoperatingsystem is theprocessmix.Aprocessisaprograminexecu-tion. Asaprocessexecutes, it changes state,

whichisdefinedbythatprocess’scurrentactiv-ity.Aprocessmaybeinanew,ready,running,waiting or terminated state. Each process isrepresentedintheoperatingsystembyitsownprocesscontrolblock(PCB)[9].Figure1showstypical process mix andTable 1 illustrates aninstanceofaprocessmix.

APCBincludesthefollowingfields:• ProcessID(PID):Theuniqueidentifierused

byotherprocessesforscheduling,commu-nicationandanyotherpurpose.

• ArrivalTime:Thetimeatwhichtheprocessenters the process queue for schedulingpurposes.

• EstimatedExecutionTime:Usedbysched-uling algorithms that order processes byexecutiontime.

• Priority/ProcessType:Usedbyschedulingalgorithmsthatfollowpriority-basedcriterion.

• Size:Thesizeoftheprocessinbytes.

• Location:Thememorylocationofaprocess.

• Program Counter Value: The address ofnextinstructiontobeexecuted.

• Registers /Threads:The state of differentregistersusedbyprocesses

• Needed Resources: Indicates the quanti-ties/types of system resources needed byaprocess.

In other words, a Process Control Block is adata structure that stores certain informationabouteachprocess[9].

4.2. Performance Parameters

Quantifyingperformanceisessentialtoop-timization.Followingaresomeof thecommon

ÿ Process ID (PID)ÿ Arrival Timeÿ Execution Timeÿ Priorityÿ Sizeÿ Locationÿ Program Counter

Valueÿ Registers / Threadsÿ Needed Resources

Process ID Arrival T ime Priority E xecutionT ime

1 0 20 10

2 2 10 1

3 4 58 2

4 8 40 4

5 12 30 3

Figure 1. A Typical PCB

Table 1. A Sample Process Mix

Page 5: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 60

parametersusedtobenchmarkperformance.

• CPU Utilization:The ratio of time that theCPU is doing actual processing to the to-talCPUtimeobserved.Thisisatruemea-sureofperformancesinceitmeasurestheefficiencyof the system.An idleCPUhas0%CPUutilizationsince itoffersnullper-formanceperunitcost.ThehighertheCPUutilization, the better the efficiency of thesystem.

• Turnaround Time: The time between aprocess’s arrival into the system and itscompletion. Two related parameters thatcan be studied include the average turn-aroundtimeandmaximumturnaroundtime.The turnaround time includes the contextswitching times and execution times. Theturnaround time is inversely related to thesystemperformance, i.e. lower turnaroundtimesimplybettersystemperformance.

• WaitingTime:Waitingtimeisthesumoftheperiods spent waiting in the ready queue.The CPU scheduling algorithm does notaffect the execution time of a process butsurely determines the waiting time. Math-ematically, it is thedifferencebetween theturnaround time and execution time. Liketurnaround time, it inversely affects thesystem performance and has two relatedforms:averagewaiting timeandmaximumwaitingtime.

• Throughput: The average number of pro-cesses completed per unit time. Eventhough this is a reasonable measure ofoperating system performance, it shouldnotbethesoleperformancecriteriontakenintoaccount.Thisissobecausethroughputdoes not take into account loss of perfor-mancecausedbystarvation.Inthecaseofstarvation,theCPUmightbechurningoutcompleted processes at a very high ratebut there might be a process stuck in theschedulerwithan infinitewait time.Higherthroughput is generally considered as in-dicativeofincreasedperformance.

• Response Time: The time difference be-tween submission of the process and thefirst I/O operation. It affects performanceinversely.However,itisnotconsideredtobeagoodmeasureandisrarelyused.

4.3. Evaluation Technique

Whendevelopinganoperatingsystemorthemodulesthereof,evaluationofitsperformanceis needed before it is installed for real usage.

Evaluation provides useful clues to which al-gorithms would best serve different cases ofapplication [10]. There are several evaluationtechniques.Lucas(1971,ascitedin[10])sum-marized and compared some frequently usedtechniques, includingcycleand times, instruc-tionmixes,kernels,models,benchmarks,syn-thetic programs, simulation, and monitor. Alltechniquescanbebasicallyclassifiedintothreetypes: the analytic method, implementation inrealtimesystems,andthesimulationmethod. Intheanalyticmethod,amathematicalfor-mula is developed to represent a computingsystem.Thismethodprovidesclearandintuitiveevaluationofsystemperformance,andismostusefultoaspecificalgorithm.However,itistoosimpletoexamineacomplexandrealsystem. Another technique is to implement an op-eratingsysteminarealmachine.Thismethodproducesacompleteandaccurateevaluation.Oneof thedisadvantagesof this technique isthe dramatic cost associated with the imple-mentation.Inaddition,evaluationisdependentontheenvironmentofthemachineinwhichtheevaluationiscarriedout. Simulation isamethod thatusesprogram-ming technique to develop a model of a realsystem.Implementationofthemodelwithpre-scribedjobsshowshowthesystemworks.Fur-thermore, themodel containsanumberofal-gorithms,variables,andparameters.Bychang-ingthesefactorsinthesimulation,oneisableto know how the system performance wouldbe affected and, therefore, to predict possiblechangesintheperformanceoftherealsystem.Thismethodhasareasonablecomplexityandcost.Itwasviewedasthemostpotentiallypow-erful and flexible of the evaluation techniques(Lucas,1971ascitedin[10]). Themodel fora full simulationofanoper-ating system contains numerous parameters.Identificationofthemostimportantparametersintermsofsystemperformanceisusefulforacompleteevaluationand fora fair designofarealsystem[10]. ThefourprogrammingprojectsinthecoursesimulateandparametricallyoptimizethetasksofCPUscheduling,synchronizationanddead-lock handling, memory management and discschedulingintermsoftheinvolvedparameters.The simulation technique is used to analyzesomeofthestatedparametersintheirrespec-tivemodules:

• CPUscheduling:roundrobintimequantum,agingparameters,a-valuesandinitialexe-cutiontimeestimates,preemptionswitches,contextswitchingtime.

Page 6: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 61

• Synchronization and Deadlock Handling:totalnumberofprocesses,totalnumberofavailable resources, maximum number ofresourcesrequiredbytheprocesses,rejec-tionrateovertime.

• MemoryManagement:memorysize,RAManddiscaccesstimes,compactionthresh-olds, memory placement algorithms, pagesize, page replacement algorithms, timequantum value, fragmentation percentageintimewindowsovertime.

• Disc scheduling: disc configuration/size,disc access time, disc scheduling algo-rithms,discwritingmechanismsandalltheabove mentioned memory managementparameters.

System performance is judged by manymeasures, including:averageturnaroundtime,averagewaiting time, throughput,CPUutiliza-tion,fragmentation,responsetime,andseveralothermodulespecificperformancemeasures. Every simulated module generates a ran-domprocessmix.Assumingthat therearesixparameters inaspecificmoduleandeachpa-rametercantaketenpossiblevalues,thetotalnumberofpossiblepermutationsbecomesonemillion (10x10x10x10x10x10). Furthermore,theseonemillionpermutationsareapplicabletotheparticularprocessmixonly.Therefore,eachrun of a specific simulated module uses thesame process mix.This enables the analysisof the studied parameter versus performancemeasurestohaveauniformbaseforcompari-sons. An exhaustive study of all possible per-mutations is beyond the scope of the course.Hence, optimization of some parameters ineachmoduleisperformedtoserveasamodelexample. The independent variables in the modulesinclude thestudiedparameters ineachof theoperating system functions while the perfor-mancemeasures likepercentageCPUutiliza-tion,averageturnaroundtime,averagewaitingtime, throughput, fragmentation percentage,rejection/denialrate,percentageseektimeandpercentage latency timeconstitute thedepen-dentvariables. Thesimulation technique isused toevalu-atesystemperformanceinallthemodules.Itisspecificallyusedtoexploretheeffectofparam-eterswhoserelationwithsystemperformanceisnotproportional.Evaluationofsystemperfor-manceagainsttheseparametersisconductedby analyzing a number of sample runs of therespectivesimulatedmodules.Theparameters

arediscussedintermsoftheirinteractionwiththeoperatingsystemfunctionunderstudyandtheir resultant effect on the system perfor-mance. Sub-sections 4.4 and 4.5 present twoof the programming projects, CPU schedulingandmemorymanagement, indetailstoexem-plify the approach. Section 4.6 discusses theprogramming projects from an integrated per-spective.

4.4. CPU Scheduling

Anoperatingsystemmustselectprocesses(programs inexecution) forexecution in someorder.Theselectionprocessiscarriedoutbyanappropriateschedulingalgorithm.CPUsched-ulingdealswiththeproblemofdecidingwhichoftheprocessesinthereadyqueueistobeal-locatedtheCPU.TherearemanydifferentCPUschedulingalgorithms, forexample,firstcomefirst served, shortest job first, priority, round-robinschemes. Anotherclassofschedulingalgorithmshasbeencreatedforsituationsinwhichprocessesareeasilyclassifiedintodifferentgroups/types.A multilevel queue-scheduling algorithm (seeFigure2)partitionsthereadyqueueintoseveralseparatequeues.Theprocessesareassignedtoaqueue,generallybasedonsomepropertyoftheprocess.Eachqueuehasitsownsched-ulingalgorithm. Processesareassignedtoaqueuedepend-ing on their type, characteristics and priority.Queue1getsprocesseswithmaximumprioritysuchas system tasksandQueue4getspro-cesseswiththelowestprioritysuchasnon-criti-calaudio/visual tasks.The idea is toseparateprocesseswithdifferentCPU-burstcharacteristics. Each queue has a different schedulingalgorithm that schedules processes for thequeue. Processes in Queue 2 get CPU timeonlyifQueue1isempty.Similarly,processesinQueue3receiveCPUattentiononlyifQueue1andQueue2areemptyandsoforth.

Fi gure 2. A Mu lti-L evel F eedback Queue

Queue 1System Jobs Round Robin

Queue 2Computation Intense SJF with preemption

Queue 3Less intense calculation Priority-based

Queue 4Multimedia Tasks FIFO

Figure 2. A Multi-Level Feedback Queue

Page 7: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 62

However, if the above-described methodis implemented as is, processes in queues 2,3and4haveapotentialofstarvation incaseQueue 1 receives processes constantly. Toavoidthisproblem,agingparametersaretakenintoaccount.Agingmeans thatprocessesareupgraded to the next queue after they spendapre-determinedamountoftimeintheirorigi-nal queue. For example, a process spends apre-determined amount of time unattended inQueue4willbemovedtoQueue3.Processeskeep moving upwards until they reach Queue1 where they are guaranteed to receive CPUtime(orexecuteinotherqueuesbeforereach-ingQueue1). In general, a multilevel feedback queueschedulerisdefinedbythenumberofqueues,the scheduling algorithm for each queue, themethodusedtoassigntheenteringprocessestothequeuesandtheagingparameters. Althoughamultilevelfeedbackqueueisthemostgeneralscheme,itisalsothemostcom-plexandhasthepotentialdisadvantageofhighcontextswitchingtime. Manyof theschedulingalgorithmsuseex-ecutiontimeofaprocesstodeterminewhatjobisprocessednext.Sinceitisimpossibletoknowtheexecutiontimeofaprocessbeforeitbeginsexecution,thisvaluehastobeestimated.a,afirstdegreefilter,isusedtoestimatetheexecu-tiontimeofaprocessasfollows:zn=azn-1+(1-a)tn-1

where,zisestimatedexecutiontime tistheactualtime aisthefirstdegreefilterand0≤a≤1The following example provides a deeper un-derstandingoftheissueathand. Thus, an estimated execution time for thefirst process is assumed and then the filter isusedtomakefurtherestimations(seeTable2).However,thechoiceofthevalueofaaffectstheestimation process. Following is the scenariowhenatakestheextremevalues:

• a=0meansthatzndoesnotdependonzn-1andisequaltotn-1

• a=1meansthatzndoesnotdependontn-1andisequaltozn-1

Consequently,asymbolicvalueofaischosenasastartingpoint toobtain f (a) i.e. thesumofsquaredifference(seeTable3).Further,dif-ferentiationofthisandequatingittozerogivesthevalueofaforwhichthedifferencebetweentheactualtimeandestimatedtimeisminimum.Thefollowingexemplifiesa-updateintheaboveexample. Intheaboveexample,atthetimeofestimat-ingexecutiontimeofP3,aisupdatedasfollows.

Thesumofsquaredifferencesisgivenby,SSD=(2+4a)2+(4a2+2a-2)2=16a4+16a3+4a2+8a+8And,d/dx[SSD]=0givesus,8a3+6a2+a+1=0 (Equation1)SolvingEquation1,onegetsa=0.7916.Now,z3=az2+(1-a)t2

Substitutingvalues,onegetsz3=(0.7916)6+(1-0.7916)6=6Next,theparametersinvolvedinaCPUsched-ulerusing themultilevel feedbackqueuealgo-rithmarediscussed.

4.4.1. Parameters Involved

Parameters that influence the system perfor-manceareherebyenumerated:

• Timeslotfortheroundrobinqueue(Queue1)

• Agingtimefor transitionsfromQueue4toQueue3,Queue3toQueue2andQueue2 toQueue1, i.e. theaging thresholds forFIFO,priority-basedandSJFqueues

• a-values and initial execution time esti-matesfortheFIFO,SJFandpriority-based

Processes zn tn

P0 10 6

P1 8 4P2 6 6P3 6 4

P4 5 17P5 11 13P6 12 ….

Here,a = 0.5z0 = 10

Then by formula,z1 = a z0 + (1-a) t0

= (0.5) (10) + (1-0.5) (6) = 8

and similarly z2, z3….z6 are calculated.

zn tn Sq uare Difference

10 6

(a) 1 0 + (1-a) 6 =

6 + 4a

4 [(6+4a) – 4] 2 = (2+4a) 2

(6+4a)a + (1-a) 4

= 4a2+2a+4

6 [(4a2+2a+4) – 6]2 =

(4a2+2a-2)2

Table 2. Calculating Execution Time Estimates

Table 3. a-updating scheme

Page 8: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 63

queues.

• ChoiceofpreemptionfortheSJFandPrior-itybasedqueues.

• Contextswitchingtime

Effect of Round RobinTime Slot:The choiceoftheroundrobinqueuecanmaketheperfor-mancevarywidely.Forexample,a small timequantum results in higher context switchingtime, which in turn translates to low systemperformance in form of low CPU utilization,high turnaround timesandhighwaiting times.Ontheotherhand,abigtimequantumresultsinFIFObehaviorwitheffectiveCPUutilization,lowerturnaroundandwaitingtimesbutwiththepotentialofstarvation.Thus,findinganoptimaltime slot value becomes imperative for maxi-mum CPU utilization with lowered starvationproblem.

EffectofAgingThresholds:Avery largevaluefor the aging thresholds makes the waitingand turnaround times unacceptable. Thesearesignsofprocessesnearingstarvation.Onthe other hand, a very small value makes itequivalenttooneroundrobinqueue.Zhao[11]enumeratestheagingparametersof5,10and25fortheSJF,Priority-basedandFIFOqueuesrespectivelyastheoptimalagingthresholdsforthespecifiedprocessmix.Someoftheprocessmixspecificationsbeing:processsizevaryfrom100KBto3MB;estimatedexecutiontimerangefrom5to35ms;priorityvaluesvaryfrom1to4;memorysize is16MB;discdriveconfigurationis8surfaces,64sectorsand1000tracks.

Effectofa-valuesandinitialexecutiontimees-timates:Su [10]hasstudied theeffectof pre-diction of burst time on system performanceofasimulatedoperatingsystemaspartofherstudy.Shehasusedana update schemeaswaspreviouslydiscussed.Forherspecifiedpro-cessmix,shereportsthattheturnaroundtimeobtained from predicted burst time is signifi-cantlylowerthantheoneobtainedbyrandomlygeneratedbursttimeestimates.Theavalueisrecomputed/updatedafterafixednumberofit-erations.

Effect of choice of preemption: Preemptionundoubtedly increases the number of contextswitches, and increased number of contextswitches inverselyaffects theefficiencyof thesystem. However, preemptive scheduling hasbeenshowntodecreasewaitingandturnaroundtime measures in certain instances [1].Thereare two preemption switches involved in thismodule,onefortheSJFqueue(Queue2)andtheotherforthepriority-basequeue(Queue3).

InSJFscheduling, theadvantageofchoosingpreemptionovernon-preemptionis largelyde-pendentontheCPUbursttimepredictions,butthatisadifficultpropositioninitself.

Effect of Context SwitchingTime: An increas-ing value of context switching time inverselyaffects the system performance in an almostlinearfashion.Thecontextswitchingtimetendstoaffectsystemperformance inversely.As thecontext switching time increases, so does theaverage turnaroundandaveragewaiting time.TheincreaseofthecontextswitchingtimepullsdowntheCPUutilization.

Inkeepingwiththeabovediscussion,thesimu-lationoftheabovemoduleandtheanalysisofthe collected data focus on the optimal roundrobintimequantumandeffectof thea-updat-ingscheme.

4.4.2. Simulation Specifications and Method of Data Collection

Theimplementedmulti-levelfeedbackqueueschedulerconsistsoffourlinearqueues,thefirstisFIFO,thesecondqueueispriority-based,thethirdoneisSJFandthefourth(highestpriority)isroundrobin.Feedbackoccursthroughaging;agingparametersdiffer,i.e.,eachqueuehasadifferentagingthresholdbeforeaprocesscanmigrate to a higher priority queue. Processesareassignedtooneofthequeuesuponentry.A process can migrate between the variousschedulingqueuesbasedontheagingparam-eterofthequeueitwasinitiallyassigned. Roundrobintimequantum,thepreemptiveswitchesfortheSJFandpriority-basedqueues,aging parameters for the SJF, priority-basedandFIFOqueues,contextswitchingtime,initialexecution timeestimatesandavalues for theFIFO,SJFandpriorityqueuesaresomeoftheindependent variables in this module.To opti-mize any one of them, every other parameteriskeptfixedandthestudiedparametervaried.Optimization of the round robin time and theeffectoftheaupdateschemeisattemptedtoserve as a model.Thus, the round robin timewas the variable parameter in this case andall other parameters were fixed parameters.Thedependentvariablesofthemodulearetheperformance measures: average turnaroundtime,averagewaitingtime,CPUutilizationandthroughput. Data was collected by means of multiplesample runs.The output from the sample runindicates a timeline, i.e. at every time step, itindicateswhichprocessesarecreated(ifany),whichonesare completed (if any), processes

Page 9: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 64

which aged in different queues.The followingexcerpts from an output file (see Figure 3) il-lustratetheagingofprocess1fromtheprioritybasedqueuetotheSJFqueue(theagingpa-rameterforQueue3wassettobe3inthisrun).Figure3,part(a)showsprocessmixsnapshotat time step 1. Five processes are created atthisinstanceandthePCBparametersforpro-cessnumber1aredisplayed.Part(b)illustratesthe contents of the queue at this time step.Process 1 is assigned to the priority queue.Givenanagingparameterof3 for thepriorityqueue, process 1 should migrate to the SJFqueueat timestep4unless it finishesexecu-tionbeforethat.Snapshotsattimestep2(part(c))andtimestep3(part(d))showthatprocess2andprocess6getCPUattentionsince theyareintheroundrobinqueue(queuewithhigh-estpriority).Therefore,process1doesnotgettheopportunitytoexecuteandmigratestotheSJFqueueat timestep4(part(e)).Part(f) il-lustratesthecompletionofprocess8andinclu-sionofthesameinthedonequeue.AcompletewalkthroughofthissamplerunforthismoduleisincludedinAppendixA.

4.4.3. Simulation Results and Discussion

Table4andthecorrespondingcharts(Fig-ure 4 (a) – (d)) illustrate the effect of varyingtheroundrobinquantumtimeoverthevariousperformanceparameters.Thisparameterplaysacriticalroleas,wheneverpresent,itisthepro-cessesinthisqueuethatarebeingscheduledforexecution.

Figure 3. Snapshot of process mix at time steps 1-5

R R TimeSl ot Av.Turnaround Time Av. Waiting Time CPU Utilization Throughput2 19.75 17 66.67 % 0.0263 22.67 20 75.19 % 0.0234 43.67 41 80.00 % 0.0245 26.5 25 83.33 % 0.0176 38.5 37 86.21 % 0.017

Table 4. Effect of Round Robin Time Slot on the Performance Parameters

(a) (b)

(d)(c)

0

50

RRTimeSlot vs. Average Turnaround Time

RRTimeSlot

Av.Turnaround

Time 0

50

RRTimeSlot vs. Average Waiting

Time

RRTimeSlot

Av. Waiting

Time

0

50

100

RRTimeSlot vs. CPU Utilization

RRTimeSlot

CPU

Utilization

RRTimeSlot vs. Throughput

00.5

11.5

22.5

33.5

44.5

55.5

66.5

RRTimeSlot

Throughput

Figure 4. Charts illustrating effect of roundrobin quantum over performance measures

Figure 4. Charts illustrating effect of round robin quantum over performance measures

Page 10: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 65

ItcanbeclearlyseenfromtheTable4howthe time slot of the round robinqueueaffectsthevariousperformanceparameters.Whilethethroughputisobservedtobeinverselypropor-tional, the other three performance measuresseemtobedirectlyproportional.Inotherwords,with increasing the time slot the round robinqueuemoves towards thebehaviorofaFIFOqueuewithhighaverageturnaroundtimesandaveragewaitingtimes.Thethroughputdecreas-esbutthepercentageCPUutilizationimprovesatasteadyrate. Since the round robin is the highest prior-ity queue in the multilevel feedback queuescheduler,ithasthegreatestinfluenceovertheschedulerperformance.WithCPUutilizationof80%andthroughputof0.024,timeslotvalueof4timeunitscomesouttobetheoptimalvalueinthissimulationforthespecificprocessmix. Nexttheeffectofaupdatingonthesystemperformanceisillustrated.Table5comparestheperformance measures as the value of roundrobintimeslotisvariedwithaupdatedatregu-lar intervals.Theperformancemeasurevaluesin the bracket are the corresponding valueswhen the a updating scheme was not imple-mented. AsisevidentfromTable5,aupdatingdidnotaffectsystemperformanceinthiscase.Again,theresult isspecificfor thisparticularprocessmix. Tosummarize,itistheoptimalvalueoftheround robinquantumalongwithsmallestpos-siblecontextswitchingtimethattendstomaxi-mizeperformanceincontextofCPUschedulinginthissimulation,a-updatingdidnottendtoaf-fectperformance.

4.5. Memory Management

Memoryisanimportantresourcethatmustbecarefullymanaged.Thepartof theoperat-ing system that manages memory is calledthe memory manager. Memory managementprimarilydealswithspacemultiplexing.All theprocessesneedtobescheduledinsuchawaythatalltheusersgettheillusionthattheirpro-cesses reside on the RAM. Spooling enablesthetransferofaprocesswhileanotherprocessisinexecution.Thejobofthememorymanageristokeeptrackofwhichpartsofmemoryareinuseandwhichpartsarenotinuse,toallocatememory to processes when they need it anddeallocateitwhentheyaredone,andtoman-ageswappingbetweenmainmemoryanddiscwhenmainmemoryisnotbigenoughtoholdalltheprocesses. Three disadvantages related to memory

managementare:

• thesynchronizationproblem

• theredundancyproblem

• thefragmentationproblem

Thefirsttwoarediscussedbelowandthefrag-mentation problem is elaborated upon a littlelater. Spooling, as stated above, enables thetransferofoneormoreprocesseswhileanotherprocessisinexecution.ItaimsatpreventingtheCPUfrombeingidle,thus,managingCPUuti-lizationmoreefficiently.Theprocessesthatarebeing transferred to themainmemorycanbeofdifferentsizes.Whentryingtotransferaverybigprocess,itispossiblethatthetransfertimeexceeds the combined execution time of theprocessesintheRAM.ThisresultsintheCPUbeing idle which was the problem for whichspoolingwasinvented.Thisproblemistermedas thesynchronization problem.Thereasonbehind it is that the variance in process sizedoesnotguaranteesynchronization. Thecombinedsizeofallprocessesisusu-allymuchbiggerthantheRAMsizeandforthisveryreasonprocessesareswappedinandoutcontinuously. The issue regarding this is thetransferoftheentireprocesswhenonlypartofthecode isexecuted inagiventimeslot.Thisproblem is termed as the redundancy prob-lem. Therearemanydifferentmemorymanage-ment schemes. Memory management algo-rithms for operating systems range from thesingle user approach to paged segmentation.Someimportantconsiderationsthatshouldbeused in comparingdifferentmemorymanage-mentstrategiesincludehardwaresupport,per-formance,fragmentation,relocation,swapping,sharing and protection.The greatest determi-nantofanymethodinaparticularsystemisthehardwareprovided. Fragmentation, Compaction and Paging:Fragmentation is encountered when the freememory space is broken into little pieces as

R R TimeSl ot Av.Turnaround Time Av. Waiting Time CPU Utilization Throughput2 19.75 (19.75) 17 (17) 66.67 (66.67) % 0.026 (0.026)3 22.67 (22.67) 20 (20) 75.19 (75.19)% 0.023 (0.023)4 43.67 (43.67) 41 (41) 80.00 (80.00)% 0.024 (0.024)5 26.5 (26.5) 25 (25) 83.33 (83.33)% 0.017 (0.017)6 38.5 (38.5) 37 (37) 86.21 (86.21)% 0.017 (0.017)

Table 5. Comparing performance measures of a CPU scheduler with a-update and one with no a-update (the values for the scheduler with no a-update is in brackets)

Page 11: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 66

processesareloadedandremovedfrommem-ory.Fragmentationcanbeinternalorexternal. Consideraholeof18,464bytesasshowninFigure5.Supposethatthenextprocessre-quests 18,462 bytes. If exactly the requestedblock is allocated, one is left with a hole of 2bytes.Theoverhead tokeep trackof thisholewill besubstantially larger than thehole itself.Thegeneralapproachistoallocateverysmallholes as part of the larger request.Thus, theallocated memory may be slightly larger thentherequestedmemory.Thedifferencebetweenthesetwonumbersisinternal fragmentation–memorythatisinternaltoapartition,butisnotbeingused[1].Inotherwords,unusedmemorywithinallocatedmemoryiscalledinternalfrag-mentation[12]. External fragmentationexistswhenenoughtotalmemoryspaceexiststosatisfyarequest,but it isnotcontiguous;storage is fragmentedintoalargenumberofsmallholes.InFigure6two such cases can be observed. In part (a),thereisatotalexternalfragmentationof260K,aspacethatistoosmalltosatisfytherequestsofeitherofthetworemainingprocesses,P4andP5.Inpart(c),however,thereisatotalexternalfragmentation of 560K. This space would belargeenoughtorunprocessP5,exceptthatthisfreememoryisnotcontiguous.Itisfragmentedinto two pieces, neither one of which is largeenough,byitself,tosatisfythememoryrequestofprocessP5.Thisfragmentationproblemcanbesevere.Intheworstcase,therecouldbeablockof free (wasted)memorybetweeneverytwoprocesses. Ifall thismemorywere inonebigfreeblock,afewmoreprocessescouldberun.Dependingonthetotalamountofmemorystorageandtheaverageprocesssize,externalfragmentationmaybeeitheraminorormajorproblem. Onesolutiontotheproblemofexternalfrag-mentationiscompaction.Thegoalistoshufflethememorycontentstoplaceallfreememorytogetherinonelargeblock.Thesimplestcom-pactionalgorithm is tomoveallprocesses to-wardoneendof thememory,andallholes inthe other direction, producing one large holeof available memory. Figure 7 shows differentwaystocompactmemory.Selectinganoptimalcompactionstrategyisquitedifficult. Compactionisanexpensivescheme.Givena128MBRAMandanaccessspeedof10nsperbyteofRAM,thecompactiontimebecomestwicetheproductofthetwo,inthiscase,2.56seconds(2x10x10-9x128x106).Supposing,aroundrobinschedulingalgorithmwereusedwithatimequantumof2ms,theabovecompac-

tiontimeturnsouttobeequivalentto1280timeslots. Compactionisusuallydefinedbythefollow-ingtwothresholds:

• Memoryholesizethreshold:Ifthesizesofalltheholesareatmostapredefinedholesize, then the main memory undergoescompaction. This predefined hole size istermedas theholesize threshold.Forex-ample,iftherearetwoholesofsize‘x’andsize‘y’ respectivelyand thehole thresholdis4KB,thencompactionisdoneprovidedx<=4KBandy<=4KB.

• Total hole percentage:The total hole per-

operating sy stem

P7

P43

Figure 5. Internal fragmentation

H ole of18,464 bytes

N ext request isfor 1 8,462 bytes

400K

1000K

2000K

2300K

2560K

400K

1000K

P 2 termi na tes

2000K

2300K

2560K

OS

P1

P2

P3

OS

P1

P3

400K

1000K

all ocate P4 1700K 2000K

2300K

2560K

OS

P1

P4

P3

N OTE : P 5 of size500K cann otbe all ocateddue toex ternalfr agmentation

Figure 5. Internal fragmentation

Figure 6. External Fragmentation

Figure 7. Different ways to compact memory

Page 12: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 67

centage refers to the percentage of totalhole size over memory size. Only if it ex-ceeds the designated threshold, compac-tionisundertaken.Takingthetwoholeswithsize ‘x’ and size ‘y’ respectively, total holepercentagethresholdequalto6%,thenforaRAMsizeof32MB,compaction isdoneonlyif(x+y)>=6%of32MB.

Another possible solution to the externalfragmentation problem is to permit the physi-caladdressspaceofaprocesstobenoncon-tiguous,thusallowingaprocesstobeallocatedphysical memory wherever the latter is avail-able.Onewayof implementing thissolution isthroughtheuseofapagingscheme.Pagingisdiscussedingreaterdetailsa little later inthissection. MemoryPlacementAlgorithms:Afittingal-gorithmdeterminestheselectionofafreeholefromthesetofavailableholes.First-fit,best-fit,and worst-fit are the most common strategiesusedtoselectafreehole.

• First-fit: Allocate the first hole that is bigenough. Searching can start either at thebeginningofthesetofholesorwherethepreviousfirst-fitsearchisended.Searchingstopsassoonasalargeenoughfreeholeisfound.

• Best-fit: Allocate the smallest hole thatis big enough.The entire list needs to besearched,unlessthelistiskeptorderedbysize. This strategy produces the smallestleftoverhole.

• Worst-fit: Allocate the largest hole. Again,theentirelisthastobesearched,unlessitissortedbysize.Thisstrategyproducesthelargest leftover hole, which may be moreusefulthanthesmallerleftoverholefromabest-fitapproach.

Ifmemoryislostduetointernalfragmenta-tion,thechoiceisbetweenfirstfitandbestfit.Aworstfitstrategytrulymakesinternalfragmen-tationworse. Ifmemory is lostduetoexternalfragmentation,carefulconsiderationshouldbegiventoaworst-fitstrategy[12].

4.5.1. Continuous Memory Allocation Scheme

Thecontinuousmemoryallocationschemeentails loadingofprocesses intomemory inasequential order.When a process is removedfrommainmemory,newprocessesareloadedifthereisaholebigenoughtoholdit.Thisalgo-rithm iseasy to implement,however, itsuffersfrom the drawback of external fragmentation.

Compaction, consequently, becomes an inevi-tablepartofthescheme.

4.5.1.1. Parameters Involved

Someoftheparametersthatinfluencethesys-temperformanceintermsofmemorymanage-mentareherebyenumerated:

• Memorysize

• RAMaccesstime

• Discaccesstime

• Compactionalgorithms

• Compactionthresholds–Memoryhole-sizethresholdandtotalholepercentage

• Memoryplacementalgorithms

• Round robin time slot (in case of a pureroundrobinschedulingalgorithm)

Effect of Memory Size: As anticipated, thegreater the amount of memory available, thehigherwouldbethesystemperformance.

EffectofRAMandDiscaccesstime:Thehigherthe values of the access times, the lower thetimeitwouldtaketomoveprocessesfrommainmemorytosecondarymemoryandvice-versathus increasing theefficiencyof theoperatingsystem.Discaccesstimeiscomposedofthreepartsseektime,latencytimeandtransferrate.TheRAMaccesstimeplaysacrucialroleinthecostofcompaction.Compactionentailsaccess-ing each byte of the memory twice, thus, thefastertheRAMaccess,thelowerwouldbethecompactiontimes.

EffectofCompactionAlgorithms:Choosinganoptimalcompactionalgorithmiscriticalinmini-mizingcompactioncost.However,selectinganoptimalcompactionstrategyisquitedifficult.

EffectoftheCompactionThresholds:Theeffectof compaction thresholds on system perfor-manceisnotasstraightforwardandhasseldombeen the focusofstudies in thisfield.Optimalvaluesofholesizethresholdlargelydependonthesizeoftheprocessessinceitisthesepro-cessesthathavetobefitintheholes.Thresh-oldsthatleadtofrequentcompactioncanbringdownperformanceatanacceleratingratesincecompactionisquiteexpensiveintermsoftime.

EffectofMemoryPlacementAlgorithmsSilber-schatzandGalvin in [1]state thatsimulationshave shown that both first-fit and best-fit arebetterthanworst-fitintermsofdecreasingbothtimeandstorageutilization.Neitherfirst-fitnorbestfitisclearlybestintermsofstorageutiliza-tion,butfirst-fitisgenerallyfaster.

Page 13: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 68

EffectofRoundRobinTimeSlot:Bestchoiceforthevalueoftimeslotwouldbecorrespondingtotransfertimeforasingleprocess(seeFigure8).Forexample,ifmostoftheprocessesrequired2mstobetransferred,thenatimeslotof2mswouldbeideal.Hence,whileoneprocesscom-pletesexecution,anotherhasbeentransferred.However,thetransfertimesfortheprocessesinconsiderationareseldomanormaloruniformdistribution.Thereasonforthenon-uniformdis-tributionisthattherearemanydifferenttypesofprocessesinasystem.Thevarianceasdepict-edinFigure8istoomuchinarealsystemandmakesthechoiceoftimeslotadifficultproposi-tiontodecideupon.

In keeping with the above discussion, thesimulationoftheabovemoduleandtheanaly-sis of the collected data focus on the optimalroundrobin timequantum,thememoryplace-mentalgorithmsandfragmentationpercentageasafunctionoftime.

4.5.1.2. Simulation Specifications and Meth-od of Data Collection

Theattemptedsimulation implementsamem-orymanagersystem.Theimplementedsystemusesacontinuousmemoryallocationscheme.Thissimulationusesnoconceptofpagingwhat-soever.Roundrobinmechanismistheschemeforprocessscheduling.

Following are the details of the involved inde-pendentvariables:Fixedparameters:

• MemorySize(32MB)• Disc access time (1ms (estimate for la-

tency and seek times) + (job size (inbytes)/500000)ms)

• Compactionthreshold(6%andholesize=50KB)

• RAMAccessTime(14ns) Variableparameters:• Fitting algorithm (a variable parameter

–FirstFit,BestFit,WorstFit)• RoundRobinTimeSlot(avariableparam-

eter,multipleof1ms)

In addition to the above enumerated pa-rameters, the process sizes range from 20KBto 2MB (multiple of 10KB) and the processexecutiontimesvaryfrombetween2msto10ms(multipleof1ms).Thediscsizeistakenas500MBandishalffilledwithjobsatthebegin-ningofthesimulation. In context of memory management, com-paction is thesolution for fragmentation.How-ever,compactioncomesatitsowncost.Movingallholestooneendisanexpensiveoperation.

Toquantifythisparameter,percentageofcom-pactiontimeagainsttotaltimeisaperformancemeasure thathasbeenadded in thismodule.This measure along with all the other perfor-mance measures constitutes the dependentvariablesinthismodule. Data was collected by means of multiplesampleruns.AwalkthroughofasamplerunforthismoduleisincludedinAppendixB.

Ideal Process Si ze Graph R ealistic Process Si ze Graph

Time slot corresponding to this size transfer time

Figure 8. Ideal Process Size Graph and Realistic Process Size Graph

Process size Process size

Numb er of processes Numb er of processes

Figure 8. Ideal Process Size Graph and Realistic Process Size Graph

Page 14: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 69

4.5.1.3. Simulation Results and Discussion

Theroundrobintimequantumisoneofthetwovariableparametersstudiedinthissimulation. Table6andFigure9 illustrate theeffectofvaryingtheroundrobinquantumtimeoverthevarious performance parameters in context ofthefirstfitalgorithm. The trends of increasing throughput andincreasing turnaround and waiting times arein keeping with round robin scheduling mov-ingtowardsFIFObehaviorwithincreasedtimequantum.However,oneobservesthattheCPUutilizationisdecliningwithincreaseintimeslotvalues.Thiscanbeattributedtotheexpenseofcompaction. Analyzing the fragmentation per-centage,itlookslikeatimeslotvalueof2timeunitsisparticularlyfavorabletothesame.

Thesimulationdatacollectedtocomparethethreememoryplacementalgorithmsbystudy-ingtheeffectofvaryingroundrobintimeslotovertheperformancemeasuresforeachofthealgorithmsisgiveninTable7andFigure10((a)to(e)). Forthisparticularprocessmix,best-fitandworst-fit memory placement algorithms gaveidenticalresults.Noneofthememoryplacementalgorithmsemergedasaclearwinner.However,best-fitandworst-fitalgorithmsseemedtogivemore stable fragmentation percentage in thesimulations.The aspect of first-fit being fasterdidnotsurfaceintheresultsduetothenatureoftheimplementation.Intheimplementation,theworst-fit and best-fit algorithms scan the holelist in one simulated time unit itself. In reality,however,scanningentireholelistbybest-fitandworst-fit would make them slower that first-fit,whichneedstoscantheholelistonlyasfarasittakestofindthefirstholethatislargeenough. Fragmentation percentage in a given timewindowovertheentirelengthofthesimulationwasalsostudied.Theentiresimulationwasdi-vided into twentyequal timewindowsand thefragmentationpercentagecomputedforeachof

ever,asisillustratedlater,pagingrequiresmore

Effect of Round Robin Time Quantum over

Performance Measures

0

2

4

6

8

10

12

14

16

18

2 3 4 5

Time Slot

Average Waiting

Time

Average

Turnaround Time

CPU Utilization

Throughput

Memory

Fragmentation

Percentage

T ime

Sl ot

Average

WaitingT ime

Average

T urnaroundT ime

CPU

Utilization

T hroughput

Measure

Memory

fragmentationpercentage

2 3 4 5% 5 29%

3 4 4 2% 8 74%

4 5 6 3% 12 74%

5 12 12 1% 17 90%

Avera ge Turnar ound

Time

Avera ge W aiting Tim e CP U Utilizat ion Throughput Fragme ntation%RR

Time

Slot First

fit

Bes t

fit

Wors

t fi t

First

fit

Bes t

fit

W ors

t fit

First

fit

Bes t

fit

W orst

fit

First

fit

Bes t

fit

W orst

fit

First

fit

Bes t

fit

W ors

t fi t

2 4 3 3 3 2 2 1% 1% 1% 5 5 5 82 74 74

3 4 4 4 4 4 4 2% 2% 2% 8 8 8 74 74 74

4 6 6 6 5 6 6 3% 2% 2% 12 11 11 74 74 74

5 12 6 6 12 5 5 1% 2% 2% 17 14 14 90 79 79

Figure 9. Effect of Round Robin Time Quantum over Performance Measures

Table 7. Comparing Memory Placement Algorithms

Table 6. Round Robin Time Quantum vs. Performance Measures

Page 15: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 70

% Fragmentation vs. Round Robin Time Slot for three memory placement

algorithms

0%

20%

40%

60%

80%

100%

1 2 3 4

Round Robin Time Slot

%Fragmentation

Fragmentation% First-fit

Fragmentation% Best-fitFragmentation% Worst-fit

2 3 4 5

CPU utilization vs. Round Robin Slot for three memory placement algorithms

0%

1%

1%

2%

2%

3%

3%

4%

1 2 3 4Round Robin Time Slot

CPU utilizationCPU utilizationFirst-fit

CPU utilizationBest-fitCPU utilizationWorst-fit2 3 4 5

Throughput vs. Round Robin Time Slot for three memory placement algorithms

0

5

10

15

20

1 2 3 4

Round Robin Time Slot

Throughput

ThroughputFirst-fit

ThroughputBest-fit

ThroughputWorst-fit

2 3 4 5

Average Turnaround Time vs. Round Robin Time slot for three memory

placement algorithms

02468

101214

1 2 3 4

Round Robin Time Slot

Average Turnaround

Time

AverageTurnaroundTime First-fit

AverageTurnaroundTime Best-fit

AverageTurnaroundTime Worst-fit

2 3 4 5

Average Waiting Time vs. Round Robin Time Slot for three memory placement

algorithms

02

468

10

1214

1 2 3 4

Round Robin Time Slot

Average Waiting Time

AverageWaiting TimeFirst-fitAverageWaiting TimeBest-fit

AverageWaiting TimeWorst-fit2 3 4 5

Figure 10. Comparing MemoryPlacement Algorithms

(a) Avera ge Turnaroundtime

(b) Avera ge Waiting Time(c) CPU utilization(d) Throughput(e) % Fragmentation

%Fragmentation

Time Window Time Slot = 2 Time Slot = 3 Time Slot = 4 Time Slot = 5

1 0.34 0.30 0.27 0.27

2 0.79 0.45 0.45 0.41

3 3.70 0.85 0.73 0.45

4 4.00 3.00 1.90 0.79

5 8.90 5.20 3.60 2.40

6 8.10 7.70 7.70 4.40

7 8.30 6.40 7.70 9.10

8 8.30 3.60 5.60 2.20

9 9.00 3.60 3.60 3.60

10 8.40 3.60 3.60 5.50

11 8.40 3.60 3.60 6.70

12 8.40 3.60 3.60 6.70

13 8.40 3.60 3.60 7.20

14 8.40 3.60 3.60 7.10

15 8.40 3.60 3.60 10.00

16 8.40 3.60 3.60 11.00

17 8.40 3.60 3.60 10.00

18 8.40 3.60 3.60 9.50

19 8.40 3.60 3.60 7.30

20 8.40 3.60 3.60 7.30

Figure 10. Comparing Memory Placement Algorithms

Table 8. Fragmentation percentage over time

thetimewindows.Thetrendwasstudiedforfourdifferentvaluesof roundrobin timeslot.Sincethe total hole size percentage threshold wasspecified as 6%, time frames with fragmenta-tion percentage values higher than that werecandidatesforcompaction[seeTable8andFig-ure11].However,compactionwasundertakeninanyoftheabovecandidateframesonlyiftheholesizethresholdspecificationwasalsomet. LookingatFigure11,onecansaythatwhilecompaction (if done) for time slot values of 3and4wasdoneintimeframes6and7,thatfortimeslotvalueof5wasundertakeninthelatterhalfofthesimulation. To summarize, two time units emerged astheoptimaltimequantumvaluebutnoneofthememoryplacementalgorithmscouldbetermedasoptimal.Studyingthefragmentationpercent-ageover timegaveus theprobable timewin-dowswherecompactionwasundertaken.

4.5.2. Paging Scheme

Pagingentailsdivisionofphysicalmemoryinto many small equal-sized frames. Logicalmemoryisalsobrokenintoblocksofthesamesizecalledpages.Whenaprocessistobeex-ecuted,itspagesareloadedintoanyavailablememory frames. Inapagingscheme,externalfragmentation can be totally eliminated. How-

Page 16: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 71

than one memory access to get to the data.Also, there is theoverheadofstoringandup-datingpagetables. Inpaging,everyaddressgeneratedby theCPUisdivided into twoparts:apagenumberandapageoffset.Thepagenumberisusedasanindexintoapagetable.Thepagetablecon-tainsthebaseaddressofeachpageinphysicalmemory.This base address is combined withmemory address.Two of the more significantparametersinapagingschemeare:pagesizeandpagereplacementalgorithms. Hereby, a paging example with a 64MBRAM and 2KB page size is discussed. 64MB(226) memory size can be represented by 26bits.Likewise,a2KBpagecanberepresentedby11bits.Thus,forthepagetable[seeFigure12], 15 bits are needed for the page numberand11bitsforthepageoffset.Sincethereare215pages,thereshallbe215entriesinthepagetable.Therefore,

Sizeofpagetable=215x30bits≈123KBIn the above example, if the page size were1KB, then a 16 bit page number and 10 bitoffset would be needed to address the 64MBRAM.Inthiscase,Sizeofpagetable=216x32bits=256KB

Consequently,itcanbesaidthatasmallerpagesizeresultsinlargersizedpagetablesandthepagetablesizebecomesanoverheaditself. Fragmentation, synchronizationand redun-dancy as discussed in the previous sectionarethreeproblemsthatneedtobeaddressedinamemorymanagementsetting.Inapagingscheme, there is no external fragmentation.However,internalfragmentationexists.Suppos-ingthepagesizeis2KBandthereexistsapro-cesswithsize72,700bytes.Then,theprocessneeds35pagesand1020bytes.Itisallocated36pageswithaninternalfragmentationof1028bytes(2048–1020).Ifthepagesizewere1KB,the same process would need 70 pages and1020bytes.Inthiscase,theprocessisallocat-ed71pageswithaninternalfragmentationof4bytes(1024–1020).Thus,asmallerpagesizeismorefavorableforreducedinternalfragmen-tation. Intheworstcasescenario,aprocessneeds‘n’pagesand1byte,whichresultsinaninternalfragmentationofalmostanentireframe.Ifpro-cesssizeisindependentofpagesize,then Averageinternalfragmentation=½xpagesizexnumberofprocesses Hence,itcanbeobservedthatalargepagesizecausesalotof internalfragmentation.Onthe other hand, a small page size requires a

large amount of memory space to be allocat-ed forpage tables.Onesimplesolution to theproblem of large size page tables is to dividethepagetableintosmallerpieces.Onewayistouseatwo-levelpagingscheme,inwhichthepagetableitselfisalsopaged.However,multi-levelpagingcomeswithitsowncost–anaddedmemoryaccessforeachaddedlevelofpaging. Anticipation and page replacement dealswith algorithms to determine the logic behindreplacingpagesinmainmemory.Agoodpagereplacement algorithm has a low page-faultrate. Some common page replacement algo-rithmsareasfollows.

TimeStampAlgorithms• FIFO:AFIFOreplacementalgorithmasso-

ciateswitheachpage the timewhen thatpage was brought into memory. When apagemustbereplaced,theoldestischosen.

• LRU:LeastRecentlyUsed(LRU)algorithmassociateswitheachpagethetimeofthatpage’s lastuse.Whenapagemustbere-placed,LRUchoosesthepagethathasnotbeenusedforthelongesttime.

CountbasedAlgorithms• LFU: The least frequently used (LFU) al-

gorithm requires that the page with thesmallestcountbereplaced.Thereasonforthisselectionisthatanactivelyusedpageshouldhavealargereferencecount.

• MFU:Themost frequentlyused (MFU)al-gorithmrequiresthatthepagewiththelarg-estcountbe replaced.The reason for thisselectionisthatthepagewiththesmallestcountwasprobablyjustbroughtinandhasyettobeused.

Fragmentation percentage over time

0.00

5.00

10.00

15.00

1 4 7 10 13 16 19Time window

% Fragmentation

Time Slot = 2

Time Slot = 3

Time Slot = 4

Time Slot = 5

Figure 12. A Page Table

15bits 15bits

215

entries

000…0 0......111…1 1

Figure 11. Fragmentation percentage over time

Figure 12. A Page Table

ever,asisillustratedlater,pagingrequiresmore

Page 17: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 72

Continuous Memory Allocation versus PagingAllocation

Table 9 gives a comparison between the twostudiedmemorymanagementschemes.

4.5.2.1. Parameters Involved

Thenewparametersinvolvedinthismemo-rymanagementschemeare:

• PageSize

• PageReplacementAlgorithms

EffectofPageSize:A largepagesizecausesalotofinternalfragmentation.Thismeansthat,with a large page size, the paging schemetends to degenerate to a continuous memoryallocationscheme.Ontheotherhand,asmallpage size requires large amounts of memoryspace tobeallocated forpage tables.Findinganoptimalpagesizeforasystemisnoteasyasit isverysubjectivedependentontheprocessmixandthepatternofaccess.

EffectofPageReplacementAlgorithms:Least-recently used, first-in-first-out, least-frequentlyusedand randomreplacementare fourof themorecommonschemesinuse.TheLRUisof-tenusedasapage-replacementalgorithmandis considered to be quite good. However, anLRU page-replacement algorithm may requiresubstantialhardwareassistance.To study the effects of the above parameterson system performance, a new performancemeasure, namely replacement ratio percent-age, isadded to theusual listofperformancemeasures. The replacement ratio percentagequantifiespagereplacements. It is the ratioofthenumberof page replacements to the totalnumberofpageaccesses.

3.3.2.2. Implementation Specifics

Though paging was not attempted as partof this study, the implementation specifics ofZhao’sstudy[11]areincludedheretoillustrateonesampleimplementation. Zhao, in his study, simulated an operatingsystemwithamultilevelfeedbackqueuesched-uler,demandpagingschemeformemoryman-agementandadiscscheduler.Asetofgenericprocesseswascreatedbyarandomgenerator.Rangeswere set for variousPCBparametersasfollows:

• Processsize:100KBto3MB

• Estimatedexecutiontime:5to35ms

• Priority:1to4

Asinglelevelpagingschemewasimplemented.

Continuous Memory A llocation Scheme Paged A llocation Scheme

Advantages:

• An easy algorithm for implementationpurposes.

Advantages:

• No external fragmentation, therefore,no compaction scheme is required.

Disadvantages:• Fragmentation problem makes

compaction an i nevitable part.Compaction in itself is an e xpensive

proposition in terms of time.

Disadvantages:• Storage for page tables.• Addressing a memory location in

paging scheme needs more than one

access depending on the levels ofpaging.

Amemory sizeof 16MBwaschosenand thediscdriverconfiguration:8surfaces,64sectorsand1000trackswasused. Four page replacement algorithms: LRU,LFU,FIFO,randomreplacementandpagesizewere chosen as the independent variables incontexttopaging.Thedependentvariablesforthestudywereaverageturnaroundtimeandre-placementpercentage.

4.5.2.3. Implementation Results

The data in Table 10 (taken from Zhao’sstudy[11])showtheeffectofreplacementalgo-rithmsonthereplacementratio. After having found the optimal values ofallstudiedparametersexceptpagesize inhiswork,Zhaousedthoseoptimalvaluesfor1000simulations each for a page size of 4KB and8KB.Thelatteremergedasabetterchoice. Inhiswork,Zhaoconcludesthat8KBpagesizeandtheLRUreplacementalgorithmscon-stitutetheparametricoptimizationincontexttopaging parameters for the specified processmix.

4.6. Integrated Perspective

Thefirstprogrammingprojectinthecoursestarts with CPU scheduling, as it is the mostelementaryandclosest to theconceptofpro-cess and process-mix. Next, the topic of pro-

Scheme FIFO L RU L FU R andom

R eplacement R atio % 31 30 37 31

Table 9. Comparing continuous memory allocation scheme with paged allocation

Table 10. Page Replacement Scheme vs. Replacement Ratio percentage

Page 18: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 73

cess synchronization and deadlock handlingis undertaken.The class then implements thememorymanagementmodule,wherethesimu-lationintegratesCPUschedulingwithmemorymanagement. The CPU scheduling algorithmchosen, however, is round robin algorithm in-stead of the multi-level feedback queue. Thefinalprogrammingprojectisbuiltontheimple-mentationofmemorymanagementmodulebyintegrating disc scheduling into the same. Inotherwords,theimplementationunderthediscscheduling module can also be viewed as anoperating system that uses round robin algo-rithmforCPUscheduling,continuousmemoryallocation scheme for memory managementandhasadiscschedulingmechanism.

Theparametersof this integratedsystemare,hereby,enumerated:

• Timeslotfortheroundrobinqueue

• Agingtimefor transitionsfromQueue4toQueue3,Queue3toQueue2andQueue2 to Queue 1 i.e. the aging thresholds forFIFO,priority-basedandSJFqueues

• a-values and initial execution time esti-matesfortheFIFO,SJFandpriority-basedqueues.

• ChoiceofpreemptionfortheSJFandPrior-itybasedqueues.

• Contextswitchingtime

• Memorysize

• RAMaccesstime

• Compactionalgorithm

• Compactionthresholds–Memoryhole-sizethresholdandtotalholepercentage

• Memory placement algorithms – first-fit,best-fit,worst-fit

• Disc access time (seek time, latency timeandtransfertime)

• Discconfiguration

• Disc scheduling algorithm – FIFO, SSTF,LOOK,C-LOOK,SCAN,C-SCAN

• Discwritingmechanism

Nextcomestheissueofoptimizingthesys-temandcomingupwiththerightpermutationofdesignparameterstoachieveexcellentperfor-mancemeasures.Aswasdiscussedearlier inthepaper, even if sixof theabovementionedparameters have ten possible values, then amillionpermutationsarepossible.Furthermore,the results obtained from these permutationsareapplicabletooneparticularprocessmixonly.

Thus,onlytheoptimalvaluesfortheparam-eters thathavebeenstudiedasvariable inde-pendent parameters in the individualmodulesare enumerated. Such a set would include:round robin time – 4ms, a-updating scheme–noeffect,memoryplacementalgorithm–bestfitfromthetwomodulespresentedhereaswellasoptimalvaluesfordiscschedulingalgorithm,average seek time, average latency time andsector size from the disc scheduling module.Thevaluesofthefixedindependentvariablesofthefourmodulesare:RAMsize–32MB,Com-pactionthresholds–6%andholesize=50KB,RAMaccesstime–14ns,Discconfiguration–8surfaces,300 tracks/surface,discaccess time– (seek+ latency+ jobsize (inbytes)/50000)ms.Theabovestatedoptimalvaluesareperti-nenttoaparticularprocessmixonly.

5. Conclusion The format of teaching operating systemsdescribedinthispaperhasbeenfollowedinthedepartment for several yearsnow.Whilestan-dardlabexercisesenablestudentstogainex-periencewithWindowsNTandUNIXsystems,parametricoptimizationofmajoroperatingsys-tem functionsprovide implementation-orientedanalyticinsightintooperatingsystemessentialssuch as CPU scheduling, deadlock handling,memorymanagementanddiscscheduling.

6. References1. Silberschatz,A.,Galvin,P.B.(1999).Oper-

atingSystemConcepts(5thed.).NewYork:JohnWiley&Sons,Inc.

2. O’Gorman, J., Teaching Operating Sys-tems,SIGCSEBulletin,Vol.30,June1998,No.2,pp.61-63.

3. Yun-Lin, S., OnTeaching Operating Sys-tems,SIGCSEBulletin,Vol.21,Sept1989,No.3,pp.11-14.

4. Leach, R., An Advanced Operating Sys-temsProjectUsingConcurrency,SIGCSEBulletin,Vol.22,Sept1990,No.3,pp.39-44.

5. Krishnamoorthy,S.,AnExperienceTeach-ingOperatingSystemsCourseWithAPro-gramming Project, Journal of ComputingSciences in Colleges,Vol. 17, May 2002,No.6,pp.25-38.

6. Tanenbaum, A.S. (1987). Operating Sys-tems Design and Implementation. NewJersey:Prentice-Hall,Inc.

Page 19: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 74

7. Oh, J. C. and Mossé, D., Teaching RealTime OSs with DORITOS, SIGCSE Bul-letin,Vol.31,Mar1999,No.1,pp.68-72.

8. Wear,L.,Vayda,T.P.,MacKenzie,K.andYakulis, R., An Operating System Model,InProceedingsofthe14thconferenceonWinterSimulationVol.1,SanDiego,Cali-fornia,1982,pp.323-327.

9. Batra, P. (2000). Parametric optimizationof critical Operating System processes.Bridgeport, CT: University of Bridgeport,DepartmentofComputerScienceandEn-gineering.

10.Su, N. (1998). Simulations of an Operat-ing System and Major Affecting Factors.Bridgeport, CT: University of Bridgeport,DepartmentofComputerScienceandEn-gineering.

11.Zhao,W.(1998).Non-PlatformBasedOp-erating System Optimization. Bridgeport,CT: University of Bridgeport, DepartmentofComputerScienceandEngineering.

12.Folk,M.J.,Zoellick,B.,Riccardi,G.(1998).File Structures: An Object-Oriented Ap-proach with C++. USA: Addison WesleyInc.

TAREK M. SOBH received the B.Sc. in Engineering degree with honors in Computer Science and Automatic Control from the Faculty of Engineering, Alexandria University, Egypt in 1988, and M.S. and Ph.D. degrees in Computer and Information Science from the School of Engineering, University of Pennsylvania in 1989 and 1991, respectively. He is currently the Dean of the School of Engineering and Vice Provost for Graduate Studies and Research at the University of Bridgeport, Connecticut; the Founding Director of the Interdisciplinary Robotics, Intelligent Sensing, and Control (RISC) laboratory; and a Professor of Computer Science and Computer Engineering.

ABHILASHA TIBREWAL received her B.Sc. and M.Sc. in Home Science with honors in Textile and Clothing from Lady Irwin College, Delhi University, India in 1993 and 1995, respectively, and M.S. in Education and M.S. in Computer Sci-ence from University of Bridgeport, CT, USA, in 2000 and 2001 respectively. She is currently employed as Lecturer of Com-puter Science and Engineering at University of Bridgeport. She is member of ACM, ASEE and the honor societies of Phi Kappa Phi and Upsilon Pi Epsilon.

Page 20: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 75

7. Appendices

APPENDIX A

NOTE: Simulation time of 7 has been chosen to show the functioning of aging parameters especially as also other parameters. A simulation time of 7 means that the CPU works for those 7ms and the number of context switches are kept track of separately. This is used when CPU utilization and throughput are calculated where these performance parameters are calculated not on simulation time but simulation time plus total context switches.

INITIALIZINGSCHEDULERPleaseenterthefollowing:Totalsimulationtime:7Maximumallowableprocesses:5Maximumallowableprocessexecutiontime:3Maximumallowableprocesspriority:5SETTINGAGINGPARAMETERSPleaseenteragingparametersforeachQtype:SJFQ:1PriorityQ:2FifoQ:2SETTINGPREEMPTIONFLAGSPleasesetthepreemptionflagsforeachQtype:SJFQ(1/0):0PriorityQ(1/0):0SETTINGALPHAPARAMETERSEnteralphavaluesforthefollowing:SJFQ:1PriorityQ:1FifoQ:1SETTINGINITIALTIMEESTIMATESEnterexecutiontimeestimatesforthefollowing:SJFQ:2PriorityQ:3FifoQ:5SETTINGQUANTUMTIMEFORROUNDROBINQ:Enterquantumtimeslotforrrq:1SETTINGCONTEXTSWITCH:Entercontextswitch:1SETTINGMODE:StepthroughEachProcessorjustOutput[1/0]:1

SCHEDULING STARTEDSchedulingStarted

TotalProcessCreated=5

ProcessNumber=1QueueNumber=2ExecutionTime=1Priority=3ArrivalTime=1

ProcessNumber=2QueueNumber=4ExecutionTime=3Priority=1ArrivalTime=1

ProcessNumber=3QueueNumber=3ExecutionTime=3Priority=4ArrivalTime=1

ProcessNumber=4QueueNumber=2ExecutionTime=1Priority=3ArrivalTime=1

ProcessNumber=5QueueNumber=1ExecutionTime=3Priority=5

Page 21: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 76

QueueNumber=4ExecutionTime=2Priority=4ArrivalTime=3

FifoQ Content : 5 7 9PriorityQ Content : 1 4SJFQ Content :RRQ Content : 6 8 2 3 10DoneQ Content :Process# 6 is executing.

TotalProcessCreated=4ProcessNumber=11QueueNumber=2ExecutionTime=2Priority=2ArrivalTime=4

ProcessNumber=12QueueNumber=4ExecutionTime=1Priority=1ArrivalTime=4

ProcessNumber=13QueueNumber=2ExecutionTime=1Priority=2ArrivalTime=4

ProcessNumber=14QueueNumber=1ExecutionTime=1Priority=4ArrivalTime=4

FifoQ Content : 7 9 14PriorityQ Content : 5 11 13SJFQ Content : 1 4RRQ Content : 8 2 3 10 6 12DoneQ Content :Process# 8 is executing.

ArrivalTime=1

FifoQ Content : 5PriorityQ Content : 1 4SJFQ Content : 3RRQ Content : 2DoneQ Content :Process# 2 is executing.

TotalProcessCreated=3ProcessNumber=6QueueNumber=4ExecutionTime=3Priority=1ArrivalTime=2

ProcessNumber=7QueueNumber=1ExecutionTime=3Priority=4ArrivalTime=2

ProcessNumber=8QueueNumber=4ExecutionTime=1Priority=1ArrivalTime=2

FifoQ Content : 5 7PriorityQ Content : 1 4SJFQ Content : 3RRQ Content : 2 6 8DoneQ Content :Process# 2 is executing.

TotalProcessCreated=2ProcessNumber=9QueueNumber=1ExecutionTime=2Priority=3ArrivalTime=3

ProcessNumber=10

Page 22: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 77

FifoQ Content : 14 19PriorityQ Content : 5 11 13 7 15 9 16 17SJFQ Content : 1 4RRQ Content : 3 10 6 12 18DoneQ Content : 8 2Process# 3 is executing.

TotalProcessCreated=0FifoQ Content : 19PriorityQ Content : 5 11 13 7 15 9 16 17 14SJFQ Content : 1 4RRQ Content : 10 6 12 18 3DoneQ Content : 8 2Process# 10 is executing.

SCHEDULING FINISHEDTotal Processes Created in the system: 19Total Processes Finished Execution in system: 2Total Context Switches: 5Maximum TurnAround Time in the system: 5Maximum Waiting Time in the system: 2TotalWaitingTime:4Average Waiting Time in the system: 2TotalTurnaroundTime:8Average TurnAround Time in the system: 4CPU Throughput for this sample run: 0.1667CPU Utilization for this sample run: 58.33%

Number of Processes Executed from Round Robin Queue: 2Number of Processes Executed from Shortest Job Queue: 0Number of Processes Executed from Priority Queue: 0

TotalProcessCreated=1ProcessNumber=15QueueNumber=2ExecutionTime=2Priority=2ArrivalTime=5

FifoQ Content : 9 14PriorityQ Content : 5 11 13 7 15SJFQ Content : 1 4RRQ Content : 2 3 10 6 12DoneQ Content : 8Process# 2 is executing.

TotalProcessCreated=4ProcessNumber=16QueueNumber=2ExecutionTime=2Priority=1ArrivalTime=6

ProcessNumber=17QueueNumber=2ExecutionTime=1Priority=4ArrivalTime=6

ProcessNumber=18QueueNumber=4ExecutionTime=1Priority=4ArrivalTime=6

ProcessNumber=19QueueNumber=1ExecutionTime=3Priority=2ArrivalTime=6

Page 23: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 78

APPENDIX B

Walkthroughasamplerunofmemorymanagermodulesimulation

1. Settingvariableparameters

2. InitialHardDiscConfiguration

3. InitialRAMConfiguration

Page 24: Journal of STEM Education: Innovations and Research · Framework for Organization and Control of Capstone Design ... The Journal of STEM Education: Innovations and Research ... formance

Journal of STEM Education Volume 7 • Issue 3 & 4 July-December 2006 79

4. Inthemidstofexecution.Thefirstcolumnshowssimulatedtimeinstance,thesecondoneshowstheactionintheCPUatthatinstanceandthethirdoneshowstheactionintheMemoryatthatinstance.Inadditionthetotalholesizeisoutputateachinstance.

5. CompactionScenarioThefirstsetshowstheprocessesintheRAMpriortocompactionandthesecondoneshowstheprocessesin theRAMaftercompaction.Theformatis:Processnumber(startingaddress)(endaddress).

Notethataftercompactionthefirstprocesshasastartingaddressofoneandeachsubsequentprocesshasastartingaddressconsecutivetothepreviousprocess’sendaddress.Inotherwords,alltheholesarecompactedtoalargeoneattheendoftheRAM.

6. FinalPerformanceMeasuresForTheRun