an introduction to operating systems cits2002 systems

16
CITS2002 Systems Programming 1 next CITS2002 CITS2002 schedule An Introduction to Operating Systems What is an operating system? A piece of systems software that provides a convenient, efficient environment for the execution of user programs. It's probably the largest and most complex program you'll ever run! Why do we need an operating system? The user's viewpoint: to provide the user interface, command interpreter, and directory structure, and to execute application programs (word processor, email client, web browser, MP3 player). The programming environment viewpoint: to enhance the bare machine, to provide utility programs (such as compilers, editors, filters), to provide high-level input and output (I/O), to structure information into files, and to improve access to memory (size, protection, sharing). The efficiency viewpoint: to replace the (long departed) human operator, to schedule tasks, to efficiently store and retrieve data, and to invoke and share programs. The economic viewpoint: to allow simultaneous use and scheduling of resources, including disk-bound data and expensive peripherals. Traditionally, we would summarize an operating system's goals as making "the system" convenient to use and scheduling its resources efficiently and fairly. In addition, it must support hardware and software not yet developed. CITS2002 Systems Programming, Lecture 3, p1, 2nd August 2021.

Upload: others

Post on 04-Nov-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

1 next→ CITS2002 CITS2002schedule

AnIntroductiontoOperatingSystemsWhatisanoperatingsystem?

Apieceofsystemssoftwarethatprovidesaconvenient,efficientenvironmentfortheexecutionofuserprograms.

It'sprobablythelargestandmostcomplexprogramyou'lleverrun!

Whydoweneedanoperatingsystem?

Theuser'sviewpoint:toprovidetheuserinterface,commandinterpreter,anddirectorystructure,andtoexecuteapplicationprograms(wordprocessor,emailclient,webbrowser,MP3player).

Theprogrammingenvironmentviewpoint:toenhancethebaremachine,toprovideutilityprograms(suchascompilers,editors,filters),toprovidehigh-levelinputandoutput(I/O),tostructureinformationintofiles,andtoimproveaccesstomemory(size,protection,sharing).

Theefficiencyviewpoint:toreplacethe(longdeparted)humanoperator,toscheduletasks,toefficientlystoreandretrievedata,andtoinvokeandshareprograms.

Theeconomicviewpoint:toallowsimultaneoususeandschedulingofresources,includingdisk-bounddataandexpensiveperipherals.

Traditionally,wewouldsummarizeanoperatingsystem'sgoalsasmaking"thesystem"convenienttouseandschedulingitsresourcesefficientlyandfairly.

Inaddition,itmustsupporthardwareandsoftwarenotyetdeveloped.

CITS2002SystemsProgramming,Lecture3,p1,2ndAugust2021.

Page 2: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 2 next→ CITS2002 CITS2002schedule

OperatingSystem≠User/ComputerInterfaceAnoperatingsystemisoftensimplyseenanddescribedastheuser/computerinterface.

Weoften(mistakenly)claimtounderstand,andlikeordislike,an"operatingsystem"basedonitsinterface.

Suchaninterfaceprovidesuswith:

programcreation(editors,compilers,debuggers,linkers)programexecution(characterandgraphical)accesstoI/Odevices(bothfixedandremovable)constrainedaccesstofilesofmediaconstrainedaccessto"internal"resourceserrordetection,response,reporting,andaccountingandmonitoring.

Whetherornotacertaininterfacerunsonaparticularhardwareoroperatingsystemplatformisusuallydictatedbyeconomics,marketing,andpolitics-nottechnology.

CITS2002SystemsProgramming,Lecture3,p2,2ndAugust2021.

Page 3: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 3 next→ CITS2002 CITS2002schedule

OperatingSystem≡ResourceManagerAnoperatingsystemisbetterconsideredasbeingincontrolofitshardwareandsoftwareresources.

Betterstill,becausethe"controls"areoftentemporalorexternaltotheoperatingsystemitself,let'sconsidertheoperatingsystemasaresourcemanager.

Anoperatingsystemisjustanotherprogramrunningontheavailablehardware.

Mostofthetime,theoperatingsystemrelinquishescontroltotheuserprocessesuntilthehardwareagaindispatchesthecontrol.

CITS2002SystemsProgramming,Lecture3,p3,2ndAugust2021.

Page 4: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 4 next→ CITS2002 CITS2002schedule

OperatingSystemsMustBeExtensibleOfimportanceisanoperatingsystem'sabilitytoevolvetomeetnewhardwareandsoftwaredemands:

Newhardwareisconstantlyintroduced-addingmorememorypresentslittledifficulty;newtypesofdisks,videocards,etc,aremoreproblematic.Newapplicationprograms,tools,andsystemservicesareadded.Fixesandpatchesarereleasedtocorrectoperatingsystemdeficiencies.

Allofthissuggeststhattheoperatingsystem,asaprogram,needstobeextensible-amodulardesignseemsessential.Considerthefollowingfigure:

Aviewofoperatingsystemservices

Ofcourse,theabovediagramprovidesaverysimplifiedrepresentationofoperatingsystemsandtheirservices.Inpractice,therelationshipsbetweenthemodularcomponentsbecomeverycomplex-LinuxandWindows-10.

CITS2002SystemsProgramming,Lecture3,p4,2ndAugust2021.

Page 5: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 5 next→ CITS2002 CITS2002schedule

TraditionalOperatingSystemServices

CPUscheduling:distributeorapportioncomputingtimeamongseveralprocesses(ortasks)whichappeartoexecutesimultaneously.

Memorymanagement:divideandsharephysicalmemoryamongseveralprocesses.

Swapping:moveprocessesandtheirdatabetweenmainmemoryanddisktopresenttheillusionofabiggermachine.

I/Odevicesupport:providespecializedcodetooptimallysupportdevicerequirements.

Filesystem:organizemassstorage(ondisk)intofilesanddirectories.

CITS2002SystemsProgramming,Lecture3,p5,2ndAugust2021.

Page 6: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 6 next→ CITS2002 CITS2002schedule

TraditionalOperatingSystemServices,continued

Utilityprograms:accounting,setting/constrainingsystemresourceaccess,manipulatingthefilesystem.

Acommandinterface:textualorgraphical,toenableinteractiveinterrogationandmanipulationofoperatingsystemfeatures.

Systemcalls:allowconstrainedaccesstotheinterioroftherunningoperatingsystem(asaprogram).

Protection:keepprocessesfrominterferingwitheachother,theirdata,and"thesystem",whilstpermittingsharingwhenrequested.

Communication:allowusersandprocessestocommunicatewithinasinglemachine(inter-processcommunication),andacrossnetworks.

CITS2002SystemsProgramming,Lecture3,p6,2ndAugust2021.

Page 7: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 7 next→ CITS2002 CITS2002schedule

AWhirlwindHistoryofOperatingSystemsTounderstandthewaymodernoperatingsystemsarethewaytheyare,itisusefultoexaminetheirevolutionoverthelastsixtyyearsorso.

Advancesinoperatingsystemsoftenaccompaniedadvancesinhardware,fallingprices,and"exploding"capacities.

ThefirsttruedigitalcomputerwasdesignedbyEnglishmathematicianCharlesBabbage(1792-1871).

AlthoughBabbagespentmostofhisworkinglifeandfortunebuildinghis"analyticalengine",itsmechanicaldesignandthewoodentechnologyofthedaycouldnotprovidetherequiredprecision.

Needlesstosay,theanalyticalenginedidnothaveanoperatingsystem.

CITS2002SystemsProgramming,Lecture3,p7,2ndAugust2021.

Everythingthatcanbeinventedhasbeeninvented.— CharlesH.Duell,Commissioner,U.S.OfficeofPatents,1899.“

Page 8: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 8 next→ CITS2002 CITS2002schedule

1945-55:VacuumTubesandPlugboardsUntilWorldWarII,littleprogresswasmadeinconstructingdigitalcomputers.Sixsignificantgroupscanreasonablyclaimthefirstelectricalcomputers:

TommyFlowersandMaxNewman,BletchleyPark,England,HowardAitken,Harvard,JohnvonNeumann,InstituteofAdvanceStudies,Princeton,TomKilburnandFreddieWilliams,Manchester,J.P.EckertandW.Mauchley,UniversityofPennsylvania,andKonranZuse,Germany.

Asinglegroupofpeopledesigned,built,programmed,operatedandmaintainedeachmachine.Althoughfillingsmallwarehouses,withtensofthousandsofvacuumtubes,theywerenomatchfortoday'scheapesthomecomputers.

Programswereloadedmanuallyusingconsoleswitches,ormorelikelybydirectreconfigurationofwiring;indicationofaprogram'sexecutionanddebuggingreturnedthroughconsolelights.

Advantages:Interactive,anduserreceivedimmediateresponse.

Disadvantages:Expensivemachinewasidlemostofthetime,becausepeople'sreactions(andthinking)wereslow.Programminganddebuggingweretedious;hardwarewasveryunreliable.Eachprogramwasselfcontained,includingitsowncodeformathematicalfunctionsandI/Odevicesupport.

CITS2002SystemsProgramming,Lecture3,p8,2ndAugust2021.

Ithinkthereisaworldmarketformaybefivecomputers.— ThomasWatson(1874-1956),ChairmanofIBM,1943.“

Page 9: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 9 next→ CITS2002 CITS2002schedule

1955-65:TransistorsandBatchSystemsProgramminglanguagesandoperatingsystems(asweknowthemtoday)stillunheardof.Collectionsofsubroutines(procedures)todriveperipheralsandtoevaluatetrigonometricfunctionswerethefirstexamplesofoperatingsystemsservices.Themid-1950ssawtheuser(stillastheprogrammer)submittingadeckofpunchedHollerithcardsdescribingajobtobeexecuted.

Giventhehighcostofcomputers,waystoincreasetheirutilitywerequicklysought.Thegeneralsolutionwasthebatchsystem.

Similar/relatedprograms,perhapseachrequiringtheFORTRAN(FORmulaTRANslation)compiler,orasetofmathematicalroutines,werebatchedtogethersothattherequiredroutinesneedonlybephysicallyloadedonce.

Programswerefirstwrittenonpapertape,intheemergingFORTRANlanguageorinassemblylanguage,andthencopiedtopunchedcards.Suchdecksofcardsincludedjobcontrolcards,theprogramitself,andoftentheprogram'sdata.

Jobssubmittedbydifferentusersweresequencedautomaticallybytheoperatingsystem'sresidentmonitor.Earlyperipherals,suchaslargemagnetictapedrives,wereusedtobatchinput(jobsanddata)andspool(fromSimultaneousPeripheralOperationOnLine)output.

CITS2002SystemsProgramming,Lecture3,p9,2ndAugust2021.

Page 10: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 10 next→ CITS2002 CITS2002schedule

1955-65:TransistorsandBatchSystems,continuedGenerally,aninexpensivecomputer,suchasanIBM1401,wasusedforreadingcardsandprintingfromoutputtapes.Theexpensivemachine,suchasanIBM7094,wasusedsolelyforthemathematicalcomputations.

Advantages:

The(true,computational)computerwaskeptbusier.

Disadvantages:

Thecomputerwasnolongerinteractive.Jobsexperiencedalongerturnaroundtime.TheCPUwasstillidlemuchofthetimeforjobs.Otherjobsremainedqueuedforexecution.

Thesignificantoperatingsysteminnovationatthistimewastheintroductionofacommandinterpreter(ajobcontrollanguage-JCL)todescribe,order,andcommenceexecutionofjobs.

Theresidentmonitorwasalsoprotectedfromtheuserprograms,andmanagedtheautomatedloadingoftheprogramsafterthemonitor.

CITS2002SystemsProgramming,Lecture3,p10,2ndAugust2021.

Page 11: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 11 next→ CITS2002 CITS2002schedule

1965-1980:IntegratedCircuitsandMultiprogrammingIntheearly1960s,computermanufacturerstypicallymadetwotypesofcomputers-word-oriented,largescalescientificcomputers(suchastheIBM-7094),andcharacter-orientedcommercialcomputers(suchastheIBM-1401),whichwerereallybettersuitedforI/O.

Incompatibilityandalackofanupgradepathweretheproblemsoftheday.

IBMattemptedtoaddressbothproblemswiththereleaseoftheirSystem/360,afamilyofsoftwarecompatiblemachinesdifferingonlyincapacity,priceandperformance.Themachineshadthesamearchitectureandinstructionset.

WithheavyCPU-boundscientificcalculations,I/Oisinfrequent,sothetimespent(wasted)waitingwasnotsignificant.However,commercialprocessingprogramsintheemergingCOBOL(ComputerOrientedBusinessOrganizationalLanguage)oftenspent80-90%ofitstimewaitingforI/Otocomplete.

TheadventofseparateI/OprocessorsmadesimultaneousI/OandCPUexecutionpossible.

TheCPUwasmultiplexed(shared),oremployedmultiprogramming,amongstanumberofjobs-whileonejobwaswaitingforI/OfromcomparativelyslowI/Odevices(suchasakeyboardortape),anotherjobcouldusetheCPU.

JobswouldrununtiltheircompletionoruntiltheymadeanI/Orequest.

Advantages:

Interactivitywasrestored.TheCPUwaskeptbusyifenoughjobswerereadytorun.

Disadvantages:

Thecomputerhardwareandtheoperatingsystemsoftwarebecamesignificantlymorecomplex(andtherehasbeennolookingbacksince!).

CITS2002SystemsProgramming,Lecture3,p11,2ndAugust2021.

Page 12: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 12 next→ CITS2002 CITS2002schedule

1965-1980:IntegratedCircuitsandMultiprogramming,continuedStill,thedesireforquickerresponsetimesinspiredavariantofmultiprogramminginwhicheachusercommunicateddirectlywithoneofamultitudeofI/Odevices.

Theintroductionoftimesharingintroducedpre-emptivescheduling.Jobswouldexecuteforatmostpre-definedtimeinterval,afterwhichitwasanotherjob'sturntousetheCPU.

Thefirstserioustimesharingsystem(CTSS,fromMIT1962)lackedadequatememoryprotection.

Most(modern)operatingsystemcomplexitywasfirstintroducedwiththesupportofmultiprogramming-schedulingalgorithms,deadlockprevention,memoryprotection,andmemorymanagement.

Theworld'sfirstcommerciallyavailabletime-sharingcomputer,theDECPDP-6,wasinstalledinUWA'sPhysicsBuildingin1965-cf.Cyberhistory,byKeithFalloon,UWAMScthesis,2001,andpdp6-serials.

CITS2002SystemsProgramming,Lecture3,p12,2ndAugust2021.

Page 13: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 13 next→ CITS2002 CITS2002schedule

EarlyOperatingSystemSecurity

Veryearlyoperatingsystems,onone-user-at-a-timecomputersystems,assistedtheusertoloadtheirprogramsandcommencetheirexecution.

Therewaslittletoprotectand,ifanerrantprogrammodifiedtheexecutiveprogram,thenonlythecurrentuserwasaffected.Asmoreofacourtesy,theexecutivemightclearmemorysegmentsandcheckitselfbeforeacceptingthenextprogram.

Asmulti-taskingoperatingsystemsemerged,accountabilityofresourceusebecamenecessary,andoperatingsystemmonitorsoversawtheexecutionofprograms.

Aswithmodernoperatingsystems,therewastheneedto:

protecttheoperatingsystemfromtheprogram,protectprogramsfromthemselves,protectprogramsfromeachother,andconstraindataaccesstothecorrectprogram(s).

Untilsystemresourcesbecamemoreplentiful(andcheaper)attemptsweremadetomaximizeresourcesharing-securitywasaconsequent,notaninitial,goal.

e.g.processschedulingpoliciesweredominatedbyalreadyrunningprocessesrequestingresources(suchaslibrariesandtapes)thatwerealreadyinuse.

Atthislevel,computersecurityismoreconcernedwithreliabilityandcorrectness,thanaboutdeliberateattacksonprograms,data,andthesystem.

CITS2002SystemsProgramming,Lecture3,p13,2ndAugust2021.

Page 14: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 14 next→ CITS2002 CITS2002schedule

1970s:MinicomputersandMicrocomputers

Anothermajordevelopmentoccurringinparallelwasthephenomenalgrowthinminicomputers,startingwiththeDEC(DigitalEquipmentCorporation)PDP-1(ProgrammedDataProcessor)in1961.ThePDP-1,with4Kof18-bitwordscostonlyUS$120,000-5%oftheIBM7094.

Thetrendwastowardsmanysmallmid-rangepersonalcomputers,ratherthanasinglemainframe.

Earlyminicomputersandmicrocomputersweresimpleintheirhardwarearchitectures,andsotherewassomeregressiontoearlieroperatingsystemideas(singleuser,nopre-emption,nomultiprogramming).

Forexample,MS-DOSonanIBM-PC(circa.1975)wasessentiallyintroducedasabatchsystem,similartothoseofthe1960s,withafewmodernadditions,suchasahierarchicalfilesystem.

Withsomenotableexceptions,thetrendquicklymovedtowardssupportofallmodernoperatingsystemfacilitiesonmicrocomputers.

Perhapsmostsignificanthasbeentheevolution,andimportance,ofoperatingsystems'userinterfaces.

Inparticular,thegraphicaldesktopmetaphorhasremainedforsometime.

CITS2002SystemsProgramming,Lecture3,p14,2ndAugust2021.

ThereareonlytwothingstocomeoutofBerkeley,UnixandLSD,andIdon'tthinkthisisacoincidence.— JeremyS.Anderson.

Thereisnoreasonanyonewouldwantacomputerintheirhome.— KenOlsen,DECFounderandChairman,1977.“

Page 15: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 15 next→ CITS2002 CITS2002schedule

1980-90s:PersonalComputersandNetworking

Thedecentralizationofcomputingresources,nowdataandnotthehardware,requiredmoresupportforinter-operatingsystemcommunication-bothphysicalsupportandapplicationprogramsupport.

Asminicomputersshrunkinsize,butexplodedincapacity,thepowerfulcomputerworkstationwasborn.CompaniessuchasSunMicrosystems(SUN)andSiliconGraphics(SGI)rodethiswaveofsuccess.

Local-areanetworks(primarilyEthernetandtoken-ring)connectedworkstations,whilewide-areanetworksconnectedminicomputers.

Operatingsystemdevelopmentsincludedthedevelopmentoffastandefficientnetworkcommunicationprotocols,dataencryption(ofnetworksandfilesystems),security,reliability,andconsistencyofdistributeddata.

CITS2002SystemsProgramming,Lecture3,p15,2ndAugust2021.

640Koughttobeenoughforanybody.— BillGates(1955-),in1981.“

Page 16: An Introduction to Operating Systems CITS2002 Systems

CITS2002SystemsProgramming

←prev 16 CITS2002 CITS2002schedule

2000sandBeyond:Speeds,Capacities,Mobility,andUbiquityThedesktopmetaphorforcomputerinterfacesbecomesonlyaninstanceofthewiderwebmetaphor.

Hardwarepricesdrop,andcapacitiesexplode.-42YearsofMicroprocessorTrendData-AmazingFactsandFiguresAbouttheEvolutionofHardDiskDrives-FlashBecomesCheaperthanHDDby2026

Highspeed,longdistancecommunicationlinksencouragegraphicalandaudiocommunication(surpassingtext).-TVandVideoWillTripleAverageHomeMonthlyInternetUsagetoBeyond1TBBy2025

Computersbecomeportableandincreasinglyubiquitous.-IntheFightforYourHearts,TabletsandDesktopsLosetoLaptops-DesktopvsMobilevsTabletMarketShareWorldwide

AsCPUperformancenolongerkeepspacewithMoore'sLaw,andcomputingbecomesincreasinglymobile,focusshiftstobatterylifeandmetricsofperformance/Watt.-PerformanceperWattIstheNewMoore'sLaw-WhatIsThePowerConsumptionOfDesktopComputers?

CITS2002SystemsProgramming,Lecture3,p16,2ndAugust2021.

Foryears,wethoughtthatamillionmonkeyssittingatamillionkeyboardswouldproducethecompleteworksofShakespeare.Today,thankstotheInternet,weknowthat'snottrue.— Anon.