Vous êtes sur la page 1sur 43

Operating

System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

1. WhatdoestheCPUdowhentherearenoprogramstorun?(2)(NovDec12)
Ans TheCPUwillalwaysdoprocessing.Eventhoughtherearenoapplicationprogramsrunning,
the operating system is still running and the CPU will still have to process many system
processesduringtheoperationofthecomputer.
2. List5ServicesProvidedbyOS.Explainhoweachprovidesconveniencetotheusers.Explainin
whichcaseitwouldbeimpossibleforuserlevelprogramstoprovidetheseservices.(7)(Nov
Dec12)
Ans i). Programexecution.Theoperatingsystemloadsthecontents(orsections)ofaleinto
memory and begins its execution. A user level program could not be trusted to
properlyallocateCPUtime.
ii). I/Ooperations.Disks,tapes,seriallines,andotherdevicesmustbecommunicated
withataverylowlevel.Theuserneedonlyspecifythedeviceandtheoperationto
perform on it, while the system converts that request into device or controller
speciccommands.Userlevelprogramscannotbetrustedtoaccessonlydevicesthey
shouldhaveaccesstoandtoaccessthemonlywhentheyareotherwiseunused.
iii). Filesystemmanipulation.Therearemanydetailsinlecreation,deletion,allocation,
andnamingthatusersshouldnothavetoperform.Blocksofdiskspaceareusedby
lesandmustbetracked.Deletingalerequiresremovingthenameleinformation
andfreeingtheallocatedblocks.Protectionsmustalsobecheckedtoassureproper
leaccess.Userprogramscouldneitherensureadherencetoprotectionmethodsnor
betrustedtoallocateonlyfreeblocksanddeallocateblocksonledeletion.
iv). Communications.Messagepassingbetweensystemsrequiresmessagestobeturned
into packets of information, sent to the network controller, transmitted across a
communications medium, and reassembled by the destination system. Packet
ordering and data correction must take place. Again, user programs might not
coordinateaccesstothenetworkdevice,ortheymightreceivepacketsdestinedfor
otherprocesses.
v). Errordetection.Errordetectionoccursatboththehardwareandsoftwarelevels.At
thehardwarelevel,alldatatransfersmustbeinspectedtoensurethatdatahavenot
beencorruptedintransit.Alldataonmediamustbecheckedtobesuretheyhave
notchangedsincetheywerewrittentothemedia.Atthesoftwarelevel,mediamust
becheckedfordataconsistency;forinstance,whetherthenumberofallocatedand
unallocatedblocksofstoragematchthetotalnumberonthedevice.There,errorsare
frequentlyprocessindependent(forinstance,thecorruptionofdataonadisk),so
theremustbeaglobalprogram(theoperatingsystem)thathandlesalltypesoferrors.
Also,byhavingerrorsprocessedbytheoperatingsystem,processesneednotcontain
codetocatchandcorrectalltheerrorspossibleonasystem.
3. Whatarethedifferencebetweenatrapandaninterrupt?Whatistheuseofeachfunction.(7)
(NovDec12)
Ans Trap:Incomputingandoperatingsystems,atrapisatypeofsynchronousinterrupttypically
causedbyanexceptionalcondition(e.g.divisionbyzeroorinvalidmemoryaccess)inauser
process. A trap usually results in a switch to kernel mode, wherein the operating system
performssomeactionbeforereturningcontroltotheoriginatingprocess.Insomeusages,the
termtraprefersspecificallytoaninterruptintendedtoinitiateacontextswitchtoamonitor
programordebugger.
Interrupt:Asignalinformingaprogramthataneventhasoccurred.Whenaprogramreceives
aninterruptsignal,ittakesaspecifiedaction(whichcanbetoignorethesignal).Interrupt
signalscancauseaprogramtosuspenditselftemporarilytoservicetheinterrupt.

Interruptsignalscancomefromavarietyofsources.Forexample,everykeystrokegenerates
aninterruptsignal.Interruptscanalsobegeneratedbyotherdevices,suchasaprinter,to

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

indicatethatsomeeventhasoccurred.Thesearecalledhardwareinterrupts.Interruptsignals
initiatedbyprogramsarecalledsoftwareinterrupts.

PCs support 256 types of software interrupts and 15 hardware interrupts. Each type of
softwareinterruptisassociatedwithaninterrupthandleraroutinethattakescontrolwhen
theinterrupt occurs. For example,when youpressakey on your keyboard,this triggers a
specificinterrupthandler.Thecompletelistofinterruptsandassociatedinterrupthandlersis
storedinatablecalledtheinterruptvectortable,whichresidesinthefirst1Kofaddressable
memory.
InterruptsallowdevicestonotifytheCPUwhentheyhavedatatotransferorwhen
an operation is complete, allowing the CPU to perform other duties when no I/O
transfersneeditsimmediateattention.
TheCPUhasaninterruptrequestlinethatissensedaftereveryinstruction.
o Adevice'scontrollerraisesaninterruptbyassertingasignalontheinterrupt
requestline.
o TheCPUthenperformsastatesave,andtransferscontroltotheinterrupt
handlerroutineatafixedaddressinmemory.(TheCPUcatchestheinterrupt
anddispatchestheinterrupthandler.)
o The interrupthandlerdeterminesthe causeof the interrupt, performsthe
necessaryprocessing,performsastaterestore,andexecutesareturnfrom
interruptinstruction to return control to the CPU. (The interrupt
handlerclearstheinterruptbyservicingthedevice.)
(Notethatthestaterestoreddoesnotneedtobethesamestateas
theonethatwassavedwhentheinterruptwentoff.Seebelowfor
anexampleinvolvingtimeslicing.)
FigureillustratestheinterruptdrivenI/Oprocedure:

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

4. WriteShortnoteson:(7)Withexample
i) BatchProcessing
ii) TimeSharing(AprilMay10,NovDec12,NovDec11)
iii) Systemstructure(NovDec12)
iv) Realtime(AprilMay10)
v) Multiprogramming(AprilMay10,NovDec11)
vi) Interactive
vii) Distributed
viii) ParallelComputation
Ans i) BatchProcessing
Theusersofbatchoperatingsystemdonotinteractwiththecomputerdirectly.
Eachuserprepareshisjobonanofflinedevicelikepunchcardsandsubmitsitto
the computer operator. To speed up processing, jobs with similar needs are
batchedtogetherandrunasagroup.Thus,theprogrammerslefttheirprograms
withthe operator.Theoperator then sorts programs into batches with similar
requirements.
TheproblemswithBatchSystemsarefollowing.
Lackofinteractionbetweentheuserandjob.
CPUisoftenidle,becausethespeedsofthemechanicalI/Odevices
isslowerthanCPU.
Difficulttoprovidethedesiredpriority.
ii) TimeSharing(AprilMay10,NovDec12,NovDec11)
Timesharingoperatingsystems:Timesharingisatechniquewhichenablesmany
people,locatedatvariousterminals,touseaparticularcomputersystematthe
same time. Timesharing or multitasking is a logical extension of
multiprogramming. Processor's time which is shared among multiple users
simultaneously is termed as timesharing. The main difference between
Multiprogrammed Batch Systems and TimeSharing Systems is that in case of
Multiprogrammed batch systems, objective is to maximize processor use,
whereasinTimeSharingSystemsobjectiveistominimizeresponsetime.
Multiple jobs are executed by the CPU by switching between them, but the
switchesoccursofrequently.Thus,theusercanreceivesanimmediateresponse.
Forexample,inatransactionprocessing,processorexecuteeachuserprogramin
ashortburstorquantumofcomputation.Thatisifnusersarepresent,eachuser
cangettimequantum.Whentheusersubmitsthecommand,theresponsetime
isinfewsecondsatmost.
Operating system uses CPU schedulingand multiprogramming toprovide each
user with a small portion of a time. Computer systems that were designed
primarilyasbatchsystemshavebeenmodifiedtotimesharingsystems.

AdvantagesofTimesharingoperatingsystemsarefollowing
Provideadvantageofquickresponse.
Avoidsduplicationofsoftware.
ReducesCPUidletime.
DisadvantagesofTimesharingoperatingsystemsarefollowing.
Problemofreliability.
Questionofsecurityandintegrityofuserprogramsanddata.
Problemofdatacommunication.
iii) Realtime(AprilMay10)
Realtimesystemisdefinedasadataprocessingsysteminwhichthetimeinterval
required to process and respond to inputs is so small that it controls the
environment.Realtimeprocessingisalwaysonlinewhereasonlinesystemneed

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

notberealtime.Thetimetakenbythesystemtorespondtoaninputanddisplay
ofrequiredupdatedinformationistermedasresponsetime.Sointhismethod
responsetimeisverylessascomparedtotheonlineprocessing.

Realtime systems are used when there are rigid time requirements on the
operationofaprocessorortheflowofdataandrealtimesystemscanbeusedas
acontroldeviceinadedicatedapplication.Realtimeoperatingsystemhaswell
defined,fixedtimeconstraintsotherwisesystemwillfail.Forexample,Scientific
experiments, medical imaging systems, industrial control systems, weapon
systems,robots,andhomeappliancecontrollers,Airtrafficcontrolsystemetc.
Therearetwotypesofrealtimeoperatingsystems.
Hard realtime systems: Hard realtime systems guarantee that critical tasks
complete on time. In hard realtime systems secondary storage is limited or
missingwithdatastoredinROM.Inthesesystemsvirtualmemoryisalmostnever
found.
Softrealtimesystems:Softrealtimesystemsarelessrestrictive.Criticalrealtime
taskgetspriorityoverothertasksandretainsthepriorityuntilitcompletes.Soft
realtimesystemshavelimitedutilitythanhardrealtimesystems.Forexample,
Multimedia,virtualreality,AdvancedScientificProjectslikeunderseaexploration
andplanetaryroversetc.
iv) Interactive:(AprilMay10,NovDec11)
An interactive operating system is one that allows the user to directly
interact with the operating system whilst one or more programs are
running. There will be an user interface in place to allow this to happen. It
could be a command line style of interface or it could be a graphical
interface.
v) NetworkoperatingSystem
NetworkOperatingSystemrunsonaserverandandprovidesserverthecapability
to manage data, users, groups, security, applications, and other networking
functions. The primary purpose of the network operating system is to allow
sharedfileandprinteraccessamongmultiplecomputersinanetwork,typicallya
localareanetwork(LAN),aprivatenetworkortoothernetworks.Examplesof
network operating systems are Microsoft Windows Server 2003, Microsoft
WindowsServer2008,UNIX,Linux,MacOSX,NovellNetWare,andBSD.
Theadvantagesofnetworkoperatingsystemsarefollowing.
Centralizedserversarehighlystable.
Securityisservermanaged.
Upgrades to new technologies and hardwares can be easily integrated
intothesystem.
Remoteaccesstoserversispossiblefromdifferentlocationsandtypesof
systems.
Thedisadvantagesofnetworkoperatingsystemsarefollowing.
Highcostofbuyingandrunningaserver.
Dependencyonacentrallocationformostoperations.
Regularmaintenanceandupdatesarerequired.

vi) Distributed operating System: Distributed systems use multiple central
processors to serve multiple real time application and multiple users. Data
processingjobsaredistributedamongtheprocessorsaccordinglytowhichone
canperformeachjobmostefficiently.
Theprocessorscommunicatewithoneanotherthroughvariouscommunication
lines(suchashighspeedbusesortelephonelines).Thesearereferredasloosely

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

coupledsystemsordistributedsystems.Processorsinadistributedsystemmay
varyinsizeandfunction.Theseprocessorsarereferredassites,nodes,computers
andsoon.
Theadvantagesofdistributedsystemsarefollowing.
Withresourcesharingfacilityuseratonesitemaybeabletousethe
resourcesavailableatanother.
Speeduptheexchangeofdatawithoneanotherviaelectronicmail.
If one site fails in a distributed system, the remaining sites can
potentiallycontinueoperating.
Betterservicetothecustomers.
Reductionoftheloadonthehostcomputer.
Reductionofdelaysindataprocessing.
vi). ParallelComputation
Parallel computing is a type of computation in which many calculations are
carried out simultaneously, operating on the principle that large problems can often
be divided into smaller ones, which are then solved at the same time.
SerialComputing:
Traditionally,softwarehasbeenwrittenforserialcomputation:
o Aproblemisbrokenintoadiscreteseriesofinstructions
o Instructionsareexecutedsequentiallyoneafteranother
o Executedonasingleprocessor
o Onlyoneinstructionmayexecuteatanymomentintime


Forexample:


ParallelComputing:
In the simplest sense,parallel computingis the simultaneous use of multiple
computeresourcestosolveacomputationalproblem:
o Aproblemisbrokenintodiscretepartsthatcanbesolvedconcurrently
o Eachpartisfurtherbrokendowntoaseriesofinstructions
o Instructionsfromeachpartexecutesimultaneouslyondifferentprocessors

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

o Anoverallcontrol/coordinationmechanismisemployed

Forexample:


Thecomputationalproblemshouldbeableto:
o Be broken apart into discrete pieces of work that can be solved
simultaneously;
o Executemultipleprograminstructionsatanymomentintime;
o Be solved in less time with multiple compute resources than with a single
computeresource.
Thecomputeresourcesaretypically:
o Asinglecomputerwithmultipleprocessors/cores
o Anarbitrarynumberofsuchcomputersconnectedbyanetwork

5. WhatisfullformofSPOOLand,WindowsNT.(2)(AprilMay10)
Ans Incomputing,SPOOLisanacronymforsimultaneousperipheraloperationsonline.Itisatype
ofbuffering.Themostcommonspoolingapplicationisprintspooling,whichplacesatask(or
'printjob')intoaqueueforextendedorlaterprocessing.
WindowsNTisafamilyofoperatingsystemsproducedbyMicrosoft,thefirstversionofwhich
was released in July 1993. It was a powerful highlevellanguagebased, processor
independent,multiprocessing,multiuseroperatingsystemwithfeaturescomparabletoUnix.
"NT"wasexpandedto"NewTechnology"formarketingpurposesbutnolongercarriesany

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

specificmeaning.ItwasintendedtocomplementconsumerversionsofWindowsthatwere
basedonMSDOS.NTwasthefirstfully32bitversionofWindows,whereasitsconsumer
orientedcounterparts,Windows3.1xandWindows9x,were16bit/32bithybrids.Windows
2000,WindowsXP,WindowsServer2003,WindowsVista,WindowsHomeServer,Windows
Server2008,Windows7,WindowsServer2008R2,Windows8,WindowsPhone8,Windows
RTandWindowsServer2012aremembersoftheWindowsNTfamily,althoughtheyarenot
brandedusingthename"WindowsNT".
6. WhatdoyoumeanbyOS(2)(NovDec11,May13,Dec13,Dec10,Dec09,May09,May
08)
DefineOS.
WhatisOS.
Ans Anoperatingsystemisaprogramthatactsasaninterfacebetweentheuserandthecomputer
hardwareandcontrolstheexecutionofallkindsofprograms.



7. Foreachofthefollowingtransitionbetweenprocessstates,indicatewhetherthetransitionis
possible,ifyesgiveanexampleofonethingthatwouldcauseit.(7)(AprilMay10)
Ans Seein2ndUnit
8. DrawthefigureofOSstructure.(7)(AprilMay10,12,08)
DiscussOSStructure.
ShortnotesonSystemstructure(NovDec12)
Ans OperatingSystemStructure
For efficient performance and implementation an OS should be partitioned into separate
subsystems, each with carefully defined tasks, inputs, outputs, and performance
characteristics. These subsystems can then be arranged in various architectural
configurations:
SimpleStructure
WhenDOSwasoriginallywrittenitsdevelopershadnoideahowbigandimportantitwould
eventuallybecome.Itwaswrittenbyafewprogrammersinarelativelyshortamountoftime,
without the benefit of modern software engineering techniques, and then gradually grew
overtimetoexceeditsoriginalexpectations.Itdoesnotbreakthesystemintosubsystems,
andhasnodistinctionbetweenuserandkernelmodes,allowingallprogramsdirectaccessto
theunderlyinghardware.(Notethatuserversuskernelmodewasnotsupportedbythe8088
chipsetanyway,sothatreallywasn'tanoptionbackthen.)

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi


MSDOSlayerstructure
TheoriginalUNIXOSusedasimplelayeredapproach,butalmostalltheOSwasinonebig
layer,notreallybreakingtheOSdownintolayeredsubsystems:


TraditionalUNIXsystemstructure
LayeredApproach


Alayeredoperatingsystem

AnotherapproachistobreaktheOSintoanumberofsmallerlayers,eachofwhich
restsonthelayerbelowit,andreliessolelyontheservicesprovidedbythenextlower
layer.
Thisapproachallowseachlayertobedevelopedanddebuggedindependently,with
theassumptionthatalllowerlayershavealreadybeendebuggedandaretrustedto
deliverproperservices.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Theproblemisdecidingwhatorderinwhichtoplacethelayers,asnolayercancall
upontheservicesofanyhigherlayer,andsomanychickenandeggsituationsmay
arise.
Layeredapproachescanalsobelessefficient,asarequestforservicefromahigher
layer has to filter through all lower layers before it reaches the HW, possibly with
significantprocessingateachstep.
Microkernels
Thebasicideabehindmicrokernelsistoremoveallnonessentialservicesfromthe
kernel, and implement them as system applications instead, thereby making the
kernelassmallandefficientaspossible.
Most microkernels provide basic process and memory management, and message
passingbetweenotherservices,andnotmuchmore.
Security and protection can be enhanced, as most services are performed in user
mode,notkernelmode.
Systemexpansioncanalsobeeasier,becauseitonlyinvolvesaddingmoresystem
applications,notrebuildinganewkernel.
Mach was the first and most widely known microkernel, and now forms a major
componentofMacOSX.
Windows NT was originally microkernel, but suffered from performance problems
relativetoWindows95.NT4.0improvedperformancebymovingmoreservicesinto
thekernel,andnowXPisbacktobeingmoremonolithic.
AnothermicrokernelexampleisQNX,arealtimeOSforembeddedsystems.


Architectureofatypicalmicrokernel



Modules
ModernOSdevelopmentisobjectoriented,witharelativelysmallcorekernelanda
set ofmoduleswhich can be linked in dynamically. See for example the Solaris
structure,asshowninFigure2.13below.
Modules aresimilartolayers inthateachsubsystemhasclearlydefinedtasksand
interfaces, but any module is free to contact any other module, eliminating the
problemsofgoingthroughmultipleintermediarylayers,aswellasthechickenand
eggproblems.
The kernel is relatively small in this architecture, similar to microkernels, but the
kerneldoesnothavetoimplementmessagepassingsincemodulesarefreetocontact
eachotherdirectly.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi


Solarisloadablemodules
HybridSystems[MacOSX,iOS,Android]
MostOSestodaydonotstrictlyadheretoonearchitecture,butarehybridsofseveral.
MacOSX
The Max OSX architecture relies on the Mach microkernel for basic system
managementservices,andtheBSDkernelforadditionalservices.Applicationservices
anddynamically loadablemodules(kernelextensions)provide therestofthe OS
functionality:


TheMacOSXstructure
iOS
TheiOSoperatingsystemwasdevelopedbyAppleforiPhonesandiPads.Itrunswith
lessmemoryandcomputingpowerneedsthanMaxOSX,andsupportstouchscreen
interfaceandgraphicsforsmallscreens:


ArchitectureofApple'siOS.
Android
The Android OS was developed for Android smartphones and tablets by the Open
HandsetAlliance,primarilyGoogle.
AndroidisanopensourceOS,asopposedtoiOS,whichhasleadtoitspopularity.
AndroidincludesversionsofLinuxandaJavavirtualmachinebothoptimizedforsmall
platforms.
Android apps are developed using a special JavaforAndroid development
environment.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi


ArchitectureofGoogle'sAndroid
9. ExplainOSasResourcemanager(7)(NovDec11)
Ans Moderncomputersconsistofprocessors,memories,timers,disks,mice,networkinterfaces,
printers,andawidevarietyofotherdevices.Inthealternativeview,thejoboftheoperating
systemistoprovideforanorderlyandcontrolledallocationoftheprocessors,memories,and
input/outputdevicesamongthevariousprogramscompetingforthem.
Whenacomputer(ornetwork)hasmultipleusers,theneedformanagingandprotectingthe
memory, input/output devices, and other resources is even greater, since the users might
otherwise interface with one another. In addition, users often need to share not only
hardware,butinformation(files,databases,etc.)aswell.Inshort,thisviewoftheoperating
system holds that its primary task is to keep track of which programs are using which
resources, to grant resource requests, to account for usage, and to mediate conflicting
requestsfromdifferentprogramsandusers.
Resourcemanagementincludesmultiplexing(sharing)resourcesintwodifferentways:
1. TimeMultiplexing
2. SpaceMultiplexing
1.TimeMultiplexing
Whentheresourceistimemultiplexed,differentprogramsoruserstaketurnsusingit.First
oneofthemgetstousetheresource,thenanother,andsoon.
Forexample:
With only one CPU and multiple programs that want to run on it, operating system first
allocatestheCPUtoonelongenough,anotheronegetstousetheCPU,thenanotherandten
eventuallythefirstoneagain.
Determininghowtheresourceistimemultiplexedwhogoesnextandforhowlongisthe
taskoftheoperatingsystem.
2.SpaceMultiplexing
In space multiplexing, instead of the customers taking turns, each one gets part of the
resource.
Forexample:
Mainmemoryisnormallydividedupamongseveralrunningprograms,soeachonecanbe
residentatthesametime(forexample,inordertotaketurnsusingtheCPU).Assumingthere
isenoughmemorytoholdmultipleprograms,itismoreefficienttoholdseveralprogramsin

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

memoryatonceratherthangiveoneofthemallofit,especiallyifitonlyneedsasmallfraction
ofthetotal.Ofcourse,thisraisesissuesoffairness,protection,andsoon,anditisuptothe
operatingsystemtosolvethem.
10. Explainlayeredarchitecturewithexample.(7)(NovDec11)
Explainlayeredapproachtosystemdesign.(7)(AprMay11)
Ans LayeredArchitectureofoperatingsystem:ThelayeredArchitectureofoperatingsystemwas
developedin60sinthisapproach;theoperatingsystemisbrokenupintonumberoflayers.
Thebottomlayer(layer0)isthehardwarelayerandthehighestlayer(layern)istheuser
interfacelayerasshowninthefigure.


layeredarchitecture
Thelayeredareselectedsuchthateachusesfunctionsandservicesofonlylowerlevellayer.
Thefirstlayercanbedebuggedwithoutanyconcernfortherestofthesystem.Itusesbasic
hardwaretoimplementthisfunctiononcethefirstlayerisdebugged.,itscorrectfunctioning
canbeassumedwhilethesecondlayerisdebugged&soon.Ifanerrorisfoundduringthe
debugged of particular layer, the layer must be on that layer, because the layer below it
alreadydebugged.Becauseofthisdesignofthesystemissimplifiedwhenoperatingsystem
isbrokenupintolayer.Os/2operatingsystemisexampleoflayeredarchitectureofoperating
system another example is earlier version of Windows NT. The main disadvantage of this
architecture is that it requires an appropriate definition of the various layers & a careful
planningoftheproperplacementofthelayer.
Thisapproachbreaksuptheoperatingsystemintodifferentlayers.
Thisallowsimplementerstochangetheinnerworkings,andincreasesmodularity.
Aslongastheexternalinterfaceoftheroutinesdontchange,developershavemore
freedomtochangetheinnerworkingsoftheroutines.
Withthelayeredapproach,thebottomlayeristhehardware,whilethehighestlayer
istheuserinterface.
o Themainadvantageissimplicityofconstructionanddebugging.
o Themaindifficultyisdefiningthevariouslayers.
o The maindisadvantageis that the OS tends to be less efficient than other
implementations.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

TheMicrosoftWindowsNTOperating System.The lowest level is amonolithickernel,but


manyOScomponentsareatahigherlevel,butstillpartoftheOS.
11. Explaindualmodeinoperatingsystem(2) (AprMay11)
Ans DualModeandMultimodeOperation
Usermodewhenexecutingharmlesscodeinuserapplications
Kernel mode (a.k.a. system mode, supervisor mode, privileged mode ) when
executingpotentiallydangerouscodeinthesystemkernel.
Certainmachineinstructions(privilegedinstructions)canonlybeexecutedinkernel
mode.
Kernelmodecanonlybeenteredbymakingsystemcalls.Usercodecannotflipthe
modeswitch.
Moderncomputerssupportdualmodeoperationinhardware,andthereforemost
modernOSessupportdualmodeoperation.


Transitionfromusertokernelmode
The concept of modes can be extended beyond two, requiring more than a single
modebit
CPUs that support virtualization use one of these extra bits to indicate when the
virtual machine manager, VMM, is in control of the system. The VMM has more
privilegesthanordinaryuserprograms,butnotsomanyasthefullkernel.
System calls are typically implemented in the form of software interrupts, which
causesthehardware'sinterrupthandlertotransfercontrolovertoanappropriate
interrupthandler,whichispartoftheoperatingsystem,switchingthemodebitto
kernelmodeintheprocess.Theinterrupthandlerchecksexactlywhichinterruptwas
generated, checks additional parameters ( generally passed through registers ) if
appropriate, and then calls the appropriate kernel service routine to handle the
servicerequestedbythesystemcall.
Userprograms'attemptstoexecuteillegalinstructions(privilegedornonexistent
instructions ), or to access forbidden memory areas, also generate software
interrupts,whicharetrappedbytheinterrupthandlerandcontrolistransferredto
theOS,whichissuesanappropriateerrormessage,possiblydumpsdatatoalog(
core)fileforlateranalysis,andthenterminatestheoffendingprogram.

12. WriteShortnotesonOSServices.(7) (AprMay11)
Ans OperatingSystemServices
OSesprovideenvironmentsinwhichprogramsrun,andservicesfortheusersofthesystem,
including:
User Interfaces Means by which users can issue commands to the system.
Dependingonthesystemthesemaybeacommandlineinterface(e.g.sh,csh,ksh,
tcsh,etc.),aGUIinterface(e.g.Windows,XWindows,KDE,Gnome,etc.),orabatch
commandsystems.Thelatteraregenerallyoldersystemsusingpunchcardsofjob
controllanguage,JCL,butmaystillbeusedtodayforspecialtysystemsdesignedfora
singlepurpose.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Program Execution The OS must be able to load a program into RAM, run the
program,andterminatetheprogram,eithernormallyorabnormally.
I/OOperationsTheOSisresponsiblefortransferringdatatoandfromI/Odevices,
includingkeyboards,terminals,printers,andstoragedevices.
FileSystemManipulationInadditiontorawdatastorage,theOSisalsoresponsible
formaintainingdirectoryandsubdirectorystructures,mappingfilenamestospecific
blocksofdatastorage,andprovidingtoolsfornavigatingandutilizingthefilesystem.
Communications Interprocess communications, IPC, either between processes
runningonthesameprocessor,orbetweenprocessesrunningonseparateprocessors
or separate machines. May be implemented as either shared memory or message
passing,(orsomesystemsmayofferboth.)
ErrorDetectionBothhardwareandsoftwareerrorsmustbedetectedandhandled
appropriately,withaminimumofharmfulrepercussions.Somesystemsmayinclude
complex error avoidance or recovery systems, including backups, RAID drives, and
other redundant systems. Debugging and diagnostic tools aid users and
administratorsintracingdownthecauseofproblems.


Aviewofoperatingsystemservices

OthersystemsaidintheefficientoperationoftheOSitself:
ResourceAllocationE.g.CPUcycles,mainmemory,storagespace,andperipheral
devices. Some resources are managed with generic systems and others with very
carefullydesignedandspeciallytunedsystems,customizedforaparticularresource
andoperatingenvironment.
AccountingKeepingtrackofsystemactivityandresourceusage,eitherfor billing
purposes or for statistical record keeping that can be used to optimize future
performance.
Protection and Security Preventing harm to the system and to resources, either
through wayward internal processes or malicious outsiders. Authentication,
ownership, and restricted access are obvious parts of this system. Highly secure
systems may log all process activity down to excruciating detail, and security
regulationdictatethestorageofthoserecordsonpermanentnonerasablemedium
forextendedtimesinsecure(offsite)facilities.
13. Explaindifferenttypesofsystemcall,withexample.(7)(AprMay11)
Ans Systemcallsprovideameansforuserorapplicationprogramstocallupontheservicesofthe
operatingsystem.GenerallywritteninCorC++,althoughsomearewritteninassemblyfor
optimalperformance.
Thesystemcallprovidesaninterfacetotheoperatingsystemservices.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Applicationdevelopersoftendonothavedirectaccesstothesystemcalls,butcanaccess
themthroughanapplicationprogramminginterface(API).Thefunctionsthatareincludedin
theAPIinvoketheactualsystemcalls.ByusingtheAPI,certainbenefitscanbegained:

Portability:aslongasystemsupportsanAPI,anyprogramusingthatAPIcancompileandrun.
EaseofUse:usingtheAPIcanbesignificantlyeasierthenusingtheactualsystemcall.


SystemCallParameters
ThreegeneralmethodsexistforpassingparameterstotheOS:
1. Parameterscanbepassedinregisters.
2. Whentherearemoreparametersthanregisters,parameterscanbestoredinablock
andtheblockaddresscanbepassedasaparametertoaregister.
3. Parameterscanalsobepushedonorpoppedoffthestackbytheoperatingsystem.


Example:Figureillustratesthesequenceofsystemcallsrequiredtocopyafile:

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Thereare5differentcategoriesofsystemcalls:
process control, file manipulation, device manipulation, information maintenance and
communication.
ProcessControl
1. end,abort.
2. load,execute.
3. createprocess,terminateprocess.
4. getprocessattributes,setprocessattributes.
5. waitfortime.
6. waitevent,signalevent.
7. allocateandfreememory.

FileManagement
1. createfile,deletefile.
2. open,close.
3. read,write,reposition.
4. getfileattributes,setfileattributes.
DeviceManagement
1. requestdevice,releasedevice.
2. read,write,reposition.
3. getdeviceattributes,setdeviceattributes.
4. logicallyattachordetachdevices.
InformationMaintenance
1. gettimeordate,settimeordate.
2. getsystemdata,setsystemdata.
3. getprocess,file,ordeviceattributes.
4. setprocess,file,ordeviceattributes.
Communications
1. create,deletecommunicationconnection.
2. send,receivemessages.
3. transferstatusinformation.
4. attachordetachremotedevices.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

1. Whatisthepurposeofsystemcalls?
Systemcallsallowuserlevelprocessestorequestservicesoftheoperatingsystem.
2. Whatisthepurposeofsystemprograms?
Systemprogramscanbethoughtofasbundlesofusefulsystemcalls.Theyprovidebasic
functionality to users so that users do not need to write their own programs to solve
commonproblems.
3. Whatsystemcallshavetobeexecutedbyacommandinterpreterorshellinordertostart
anewprocess?
InUNIXsystems,aforksystemcallfollowedbyanexecsystemcallneedtobeperformed
tostartanewprocess.Theforkcallclonesthecurrentlyexecutingprocess,whiletheexec
calloverlaysanewprocessbasedonadifferentexecutableoverthecallingprocess.
4. WhyuseAPIsratherthansystemcalls?
An application programmer designing a program using an API can expect his
programtocompileandrunonanysystemthatsupportsthesameAPI.
ActualsystemcallscanoftenbemoredetailedanddifficulttoworkwiththeAPI
availabletoanapplicationprogram
14. ExplainvariousfunctionsofanOS.(May13,May12,May09,May08,Dec08)
WriteandExplainwithneatdiagram,variousfunctionsofanOS.
DiscussvariousfunctionsofanOS.
TheservicesandfunctionsprovidedbyanOScan bedividedinto2maincategory,
brieflydescribe.
Ans


FunctionsofOperatingSystem
Operatingsystemsperformthefollowingimportantfunctions:
1. ProcessorManagement:Itmeansassigningprocessortodifferenttaskswhich
hastobeperformedbythecomputersystem.
2. MemoryManagement:Itmeansallocationofmainmemoryandsecondary
storageareastothesystemprogrammes,aswellasuserprogrammesand
data.
3. Input and Output Management: It means coordination and assignment of
thedifferentoutputandinputdeviceswhileoneormoreprogrammesare
beingexecuted.
4. File System Management: Operating system is also responsible for
maintenanceofafilesystem,inwhichtheusersareallowedtocreate,delete
andmovefiles.
5. EstablishmentandEnforcementofaPrioritySystem:Itmeanstheoperating
systemdeterminesandmaintainstheorderinwhichjobsaretobeexecuted
inthecomputersystem.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

6. Assignmentofsystemresources,bothsoftwareandhardwaretothevarious
usersofthesystem.
Anoperatingsystemhasthreemainresponsibilities:
1. Perform basic tasks, such as recognizing input from the keyboard, sending
outputtothedisplayscreen,keepingtrackoffilesanddirectoriesonthedisk
andcontrollingperipheraldevicessuchasdiskdrivesandprinters.
2. Ensurethatdifferentprogramsandusersrunningatthesametimedonot
interferewitheachother.
3. Provideasoftwareplatformontopofwhichotherprograms(i.e.,application
software)canrun.
Thefirsttworesponsibilitiesaddresstheneedformanagingthecomputerhardwareandthe
applicationprogramsthatusethehardware.Thethirdresponsibilityfocusesonprovidingan
interface between application software and hardware so that application software can be
efficiently developed. Since the operating system is already responsible for managing the
hardware,itshouldprovideaprogramminginterfaceforapplicationdevelopers.
15. Whatare5majoractivitiesofanOSwrtfilemanagement.(Dec08)
Ans Afileisacollectedofrelatedinformationdefinedbyitscreator.Computercanstorefileson
the disk (secondary storage), which provide long term storage. Some examples of storage
mediaaremagnetictape,magneticdisk andopticaldisk.Eachofthesemediahasitsown
propertieslikespeed,capacity,datatransferrateandaccessmethods.
A filesystemsnormallyorganizedintodirectoriestoeasetheiruse.These directoriesmay
containfilesandotherdirections.
Thefivemainmajoractivitiesofanoperatingsysteminregardtofilemanagementare
1. Thecreationanddeletionoffiles.
2. Thecreationanddeletionofdirections.
3. Thesupportofprimitivesformanipulatingfilesanddirections.
4. Themappingoffilesontosecondarystorage.
5. Thebackupoffilesonstablestoragemedia.

16. ExplainOSasResourcemanager.(Dec11)
Ans Moderncomputersconsistofprocessors,memories,timers,disks,mice,networkinterfaces,
printers,andawidevarietyofotherdevices.Inthealternativeview,thejoboftheoperating
systemistoprovideforanorderlyandcontrolledallocationoftheprocessors,memories,and
input/outputdevicesamongthevariousprogramscompetingforthem.
Whenacomputer(ornetwork)hasmultipleusers,theneedformanagingandprotectingthe
memory, input/output devices, and other resources is even greater, since the users might
otherwise interface with one another. In addition, users often need to share not only
hardware,butinformation(files,databases,etc.)aswell.Inshort,thisviewoftheoperating
system holds that its primary task is to keep track of which programs are using which
resources, to grant resource requests, to account for usage, and to mediate conflicting
requestsfromdifferentprogramsandusers.
Resourcemanagementincludesmultiplexing(sharing)resourcesintwodifferentways:
TimeMultiplexing
SpaceMultiplexing
1.TimeMultiplexing
Whentheresourceistimemultiplexed,differentprogramsoruserstaketurnsusingit.First
oneofthemgetstousetheresource,thenanother,andsoon.
Forexample:
WithonlyoneCPUandmultipleprogramsthatwanttorunonit,operatingsystem
firstallocatestheCPUtoonelongenough,anotheronegetstousetheCPU,then
anotherandteneventuallythefirstoneagain.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Determininghowtheresourceistimemultiplexedwhogoesnextandforhowlongisthe
taskoftheoperatingsystem.
2.SpaceMultiplexing
In space multiplexing, instead of the customers taking turns, each one gets part of the
resource.
Forexample:
Mainmemoryisnormallydividedupamongseveralrunningprograms,soeachone
canberesidentatthesametime(forexample,inordertotaketurnsusingtheCPU).
Assumingthereisenoughmemorytoholdmultipleprograms,itismoreefficientto
hold several programs in memory at once rather than give one of them all of it,
especiallyifitonlyneedsasmallfractionofthetotal.Ofcourse,thisraisesissuesof
fairness,protection,andsoon,anditisuptotheoperatingsystemtosolvethem.
17. WhatarethemainpurposeofanOS?(Dec07,Dec08)
WhatarethemainfunctionofanOS?
Ans ExplaintheVariousfunctionsofoperatingsystem.
Answer:
FunctionsofOperatingSystem
Operatingsystemsperformthefollowingimportantfunctions:
i) ProcessorManagement:Itmeansassigningprocessortodifferenttaskswhichhas
tobeperformedbythecomputersystem.
ii) Memory Management: It means allocation of main memory and secondary
storageareastothesystemprogrammes,aswellasuserprogrammesanddata.
iii) Input and Output Management:It meanscoordination and assignment ofthe
different output and input devices while one or more programmes are being
executed.
iv) FileSystemManagement:Operatingsystemisalsoresponsibleformaintenance
ofafilesystem,inwhichtheusersareallowedtocreate,deleteandmovefiles.
v) Establishment and Enforcement of a Priority System: It means the operating
systemdeterminesandmaintainstheorderinwhichjobsaretobeexecutedin
thecomputersystem.
vi) Assignmentofsystemresources,bothsoftwareandhardwaretothevarioususers
ofthesystem.
Anoperatingsystemhasthreemainresponsibilities:
1. Performbasictasks,suchasrecognizinginputfromthekeyboard,sendingoutputto
thedisplayscreen,keepingtrackoffilesanddirectoriesonthediskandcontrolling
peripheraldevicessuchasdiskdrivesandprinters.
2. Ensurethatdifferentprogramsandusersrunningatthesametimedonotinterfere
witheachother.
3. Provide a software platform on top of which other programs (i.e., application
software)canrun.
Thefirsttworesponsibilitiesaddresstheneedformanagingthecomputerhardware
andtheapplicationprogramsthatusethehardware.Thethirdresponsibilityfocuses
on providing an interface between application software and hardware so that
application software can be efficiently developed. Since the operating system is
already responsible for managing the hardware, it should provide a programming
interfaceforapplicationdevelopers.
18. WriteanoteonevolutionofOS.(May14,May08)
Ans Operatingsystemevolution

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

The first computers usedbatchoperating systems, in


whichthecomputerranbatchesofjobswithoutstop.
Programs were punched into cards that were usually
copied to tape for processing. When the computer

finished one job, it would immediately start the next


oneonthetape.
Professional operators, not the users, interacted with
themachine.Usersdroppedjobsoff,thenreturnedto
pick up the results after their jobs had run. This was
inconvenientfortheusers,buttheexpensivecomputer
waskeptbusywithasteadystreamofjobs.

In the 1960s,timeshared operating systems began


replacingbatchsystems.Usersinteracteddirectlywith
the computer via a printing terminal like the Western
ElectricTeletypeshownhere.
Several users shared the computer at the same time,
and it spent a fraction of a second on each one's job

before moving on to the next. A fast computer could


work on many user's jobs at the same time, while
creating the illusion that they were receiving its full
attention.
Printing terminals required that programs
hadcharacterorcommandlineuserinterfaces(CLI),in
which the user typed responses topromptsor typed
commands. The interaction scrolled down a roll of
paper.

Printing terminals were later replaced by video


terminalsthatcouldonlydisplayfixedsizecharacters.
Somecouldbeusedtocreateformsonthescreen,but
manysimplyscrolledlikea"glassTeletype."

Personal computers became affordable in the mid


1970s. TheAltair8800, shown here, was the first
commercially viable personal computer marketed to
individuals. Beginning in January 1975, the Altair was
soldtohobbyistsinkitform.TheAltairdidnothavean
operatingsystem,sinceithadonlytoggleswitchesand

lightemittingdiodesforinputandoutput.
peoplesoonconnectedterminalsandfloppydiskdrives
to Altairs. In 1976, Digital Research introduced
theCP/MoperatingsystemfortheAltairandcomputers
likeit.CP/MandlaterDOShadCLIsthatweresimilarto
those of the timeshared operating systems, but the
computerwasdedicatedtoasingleuser,notshared.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

As hardware prices fell, personal computers with bit


mappeddisplays that could control
individualpixelsweredeveloped.Thesemadepersonal
computer withgraphical user interfaces(GUIs)
possible.
ThefirstcommercialsuccesswastheAppleMacintosh
which was introduced in 1984. The initial Macintosh
pushedthestateofthehardwareart,andwasrestricted

toasmall,monochromedisplay.
As hardware continued to evolve, larger, color Macs
were developed and Microsoft introduced Windows,
theirGUIoperatingsystem.

TheMacintoshoperatingsystemwasbasedondecades
ofresearchongraphicallyorientedpersonalcomputer
operatingsystemsandapplications.
This photo of shows Ivan Sutherland's pioneering
programSketchpadin the early 1960s. Sketchpad
foreshadowedmanyofthecharacteristicsofamodern
GUI,butthehardwarecostmillionsofdollarsandfilled

aroom.Aftermanygenerationsofresearchprojectson
large computers and improvement in hardware, the
Macintoshbecameeconomicallyfeasible.
Research prototypes like Sketchpad are still being
developedatuniversitiesandinresearchlabs.Theywill
formthebasisoffutureproducts.

Evolution of Operating Systems


The evolution of operating systems is directly dependent to the development of computer
systems and how users use them. Here is a quick tour of computing systems through the
past fifty years in the timeline.

Early Evolution
1945: ENIAC, Moore School of Engineering, University of Pennsylvania.
1949: EDSAC and EDVAC
1949 BINAC a successor to the ENIAC
1951: UNIVAC by Remington
1952: IBM 701
1956: The interrupt
19541957: FORTRAN was developed

Operating Systems by the late 1950s


By the late 1950s Operating systems were well improved and started supporting following
usages :
It was able to Single stream batch processing
It could use Common, standardized, input/output routines for device access
Program transition capabilities to reduce the overhead of starting a new job was
added
Error recovery to clean up after a job terminated abnormally was added.
Job control languages that allowed users to specify the job definition and resource
requirements were made possible.

Operating Systems In 1960s


1961: The dawn of minicomputers

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

1962 Compatible Time-Sharing System (CTSS) from MIT


1963 Burroughs Master Control Program (MCP) for the B5000 system
1964: IBM System/360
1960s: Disks become mainstream
1966: Minicomputers get cheaper, more powerful, and really useful
19671968: The mouse
1964 and onward: Multics
1969: The UNIX Time-Sharing System from Bell Telephone Laboratories

Supported OS Features by 1970s


Multi User and Multi tasking was introduced.
Dynamic address translation hardware and Virtual machines came into picture.
Modular architectures came into existence.
Personal, interactive systems came into existence.

Accomplishments after 1970


1971: Intel announces the microprocessor
1972: IBM comes out with VM: the Virtual Machine Operating System
1973: UNIX 4th Edition is published
1973: Ethernet
1974 The Personal Computer Age begins
1974: Gates and Allen wrote BASIC for the Altair
1976: Apple II
August 12, 1981: IBM introduces the IBM PC
1983 Microsoft begins work on MS-Windows
1984 Apple Macintosh comes out
1990 Microsoft Windows 3.0 comes out
1991 GNU/Linux
1992 The first Windows virus comes out
1993 Windows NT
2007: iOS
2008: Android OS
2009: Windows 7
2013: Windows 8
2015: Windows 10
And the research and development work still goes on, with new operating systems being
developed and existing ones being improved to enhance the overall user experience while
making operating systems fast and efficient like they have never been before.

19. DescribethemaindevelopmentsofOSthatoccurredateachcomputergeneration.(Dec2013)
Ans Generationsofoperatingsystems
Operating systems, like computer hardware, have undergone a series of revolutionary
changescalledgenerations.Incomputerhardware,generationshavebeenmarkedbymajor
advances in componentry from vacuum tubes (first generation), to transistors (second
generation), to integrated circuitry (third generation), to largescale and very largescale
integratedcircuitry(forthgeneration).Thesuccessivehardwaregenerationshaveeachbeen
accompaniedbydramaticreductionsincosts,size,heatemission,andenergyconsumption,
andbydramaticincreasesinspeedandstoragecapacity.

(1)thezerothgeneration(1940s)
Early computing systems had no operating system. Users had complete access to the
machinelanguage.Theyhandcodedallinstructions.
(2)thefirstgeneration(1950s)
Theoperatingsystemsofthe1950sweredesignedtosmooththetransitionbetweenjobs.
Beforethesystemsweredeveloped,agreatdealoftimewaslostbetweenthecompletionof
onejobandtheinitiationofthenext.Thiswasthebeginningofbatchprocessingsystemsin

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

whichjobsweregatheredingroupsorbatches.Onceajobwasrunning,ithadtotalcontrol
ofthemachine.Aseachjobterminated(eithernormallyorabnormally),controlwasreturned
totheoperatinsystemthat"cleanedupafterthejob"andreadinandinitiatedthenextjob.

(3)Thesecondgeneration(early1960s)
The second generation of operating systems was characterized by the development of
shared systems with multiprogramming and beginnings of multiprocessing. In
multiprogramming systems several user programs are in main storage at once and the
processor is switched rapidly between the jobs. In multiprocessing systems, several
processorsareused on a singlecomputersystem to increasetheprocessing power ofthe
machine.
Deviceindependencebegantoappear.Infirstgenerationsystems,auserwishingtowrite
data on tape had to reference a particular tape drive specifically. In second generation
systems,theuserprogramspecifiedonlythatafilewastobewrittenonatapedrivewitha
certainnumberoftracksandacertaindensity.Theoperatingsystemlocatedanavailable
tapedrivewiththedesiredcharacteristicsandinstructedtheoperatortomountatapeon
thatdrive.
Timesharingsystemsweredevelopedinwhichusercouldinterfacedirectlywiththecomputer
through typewriterlike terminals. Time sharing systems operate in an interactive or
conversationalmodewith users. The usertypes arequest to thecomputer, the computer
processestherequestassoonasitcan(oftenwithinasecondorless),andaresponse(ifany)
istypedontheuser'sterminal.Conversationalcomputingmadepossiblegreatstridesinthe
programdevelopmentprocess.Atimesharingusercouldlocateandcorrecterrorsinseconds
or minutes, rather than suffering the delays, often hours or days, in batch processing
environments.
Realtime systems emerged in which computers were used to control industrial processes
suchasgasolinerefining.Militaryrealtimesystemsweredevelopedtomonitorthousandsof
points at once for possible enemy air attacks. Realtime systems are characterized by
supplying immediate response. For example, a measurement from a gasoline refinery
indicatingthattemperaturesaregettingtoohighmightdemandimmediateattentiontoavert
anexplosion.Realtimesystemsareoftenheavilyunderutilizeditisfarmoreimportantfor
suchsystemtobeavailablewhenneededandtorespondquicklythanitisforthemtobebusy
alargeportionofthetime.Thisfacthelpsexplaintheirgreatcost.

(4)Thethirdgeneration(Mid1960stoMid1970s)
Thethirdgenerationofoperatingsystemseffectivelybeganwiththeintroductionofthe
IBMsystem/360familyofcomputersin1964.thirdgenerationcomputersweredesignedto
begeneralpurposesystems.Theywerelarge,oftenponderous,systemspurportingtobeall
thingstoallpeople.Theconceptsoldalotofcomputers,butittookitstoll.Usersrunning
particularapplicationsthatdidnotrequirethiskindofpowerpayedheavilyinincreasedrun
timeoverhead,learningtime,debuggingtime,maintenance,etc.
Thirdgenerationoperatingsystemsweremultimodesystems.Someofthemsimultaneously
supported batch processing, time sharing, realtime processing, and multiprocessing. They
werelargeandexpensive.Nothinglikethemhadeverbeenconstructedbefore,andmany
ofthedevelopmenteffortsfinishedwelloverbudgetandlongafterscheduledcompletion.
These systems introduced to computer environments a greater complexity to which users
were,atfirst,unaccustomed.Thesystemsinterposedasoftwarelayerbetweentheuserand
thehardware.Thissoftwarelayerwasoftensothickthatauserlostsightofthehardware
andsoonlytheviewcreatedbythesoftware.Togetoneofthesesystemstoperformthe
simplest useful task, users had to become familiar with complex job control languages to
specifythejobstheirresourcerequirements.Thirdgenerationoperatingsystemsrepresented
agreatstepforward,butapainfuloneformanyusers.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

(5)Thefourthgeneration(Mid1970stopresent)
Fourthgenerationsystemsarethecurrentstateoftheart.Manydesignersandusersare
stillsmartingfromtheirexperienceswiththirdgenerationoperatingsystemsandarecareful
beforegettinginvolvedwithcomplexoperatingsystems.
Withthewidespreaduseofcomputernetworkingandonlineprocessing,usergainaccessto
networks of geographically dispersed computers through various type of terminals. The
microprocessorhas made possible the developmentof thepersonal computer,one ofthe
mostimportantdevelopmentsofsocialconsequenceinthelastseveraldecades.Nowmany
usershavededicatedcomputersystemsavailablefortheirownuseatanytimeofthedayor
night.Computerpowerthatcosthundredsofthousandsofdollarsintheearly1960sisnow
availableforlessthanathousanddollars.
Personalcomputersareoftenequippedwithdatacommunicationsinterface,andalsoserve
asterminals.Theuserofafourthgenerationsystemisnolongerconfinedtocommunicating
with a single computer in a timeshared mode. Rather the user may communicate with
geographicallydispersedsystems.Securityproblemshaveincreasedgreatlywithinformation
nowpassingovervarioustypesofvulnerablecommunicationslines.Encryptionisreceiving
muchattentionithasbecomenecessarytoencodehighlyproprietaryorpersonaldatasotat,
evenifthedataiscompromised,itisofnousetoanyoneotherthantheintendedreceivers.
Thepercentageofthepopulationwithaccesstocomputersinthe1980sisfargraterthan
everbeforeandgrowingrapidly.Itiscommontohearthetermuserfriendlydenotingsystems
thatgiveusersofaverageintelligenceeasyaccesstocomputerpower.Thehighlysymbolic,
mnemonic,acronymorienteduserenvironmentsofthe1960sand1970sarebeingreplaced
inthe1980sbymenudrivensystemsthatguidetheuserthroughvariousoptionsexpressed
insimpleEnglish.
Theconceptofvirtualmachineshasbecomewidelyused.Theuserisnolongerconcerned
withthephysicaldetailsofthecomputersystems(ornetwork)beingaccessed.Insteadthe
user sees aviewcalled avirtualmachinecreated bytheoperatingsystem.Today'suseris
moreconcernedwithaccomplishingworkwithacomputer.Andisgenerallynotinterestedin
theinternalfunctioningofthemachine.
Databasesystemshavegainedcentralimportance.Oursisaninformationorientedsociety,
andthejobofdatabasesystemsistomakeinformationconvenientlyaccessibleinacontrolled
fashiontothosewhohavearighttoaccessit.Thousandsofonlinedatabasehavebecome
availableforaccessviaterminalsovercommunicationsnetworks.
The concept of distributed data processing has become firmly entrenched. We are now
concernedwithbringingthecomputerpowertothesiteatwhichitisneeded,ratherthan
bringingthedatatosomecentralcomputerinstallationforprocessing.

2ndAnswer

AHistoryofOperatingSystems

ThefirsttruedigitalcomputerwasdesignedbytheEnglishmathematicianCharlesBabbage
(17921871). Although Babbage spent most of his life and fortune trying to build his
''analyticalengine,''henevergotitworkingproperlybecauseitwaspurelymechanical,and
thetechnologyofhisdaycouldnotproducetherequiredwheels,gears,andcogstothehigh
precisionthatheneeded.Needlesstosay,theanalyticalenginedidnothaveanoperating
system.
As an interesting historical aside, Babbage realized that he would need software for his
analyticalengine,sohehiredayoungwomannamedAdaLovelace,whowasthedaughterof
the famed British poet Lord Byron, as the world's first programmer. The programming
languageAdaisnamedafterher.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi


1.TheFirstGeneration(194555)VacuumTubesandPlugboards
After Babbage's unsuccessful efforts, little progress was made in constructing digital
computers until World War II. Around the mid1940s, Howard Aiken at Harvard, John von
Neumann at the Institute for Advanced Study in Princeton, J. Presper Eckert and William
MauchleyattheUniversityofPennsylvania,andKonradZuseinGermany,amongothers,all
succeededinbuildingcalculatingengines.Thefirstonesusedmechanicalrelaysbutwerevery
slow, with cycle times measured in seconds. Relays were later replaced by vacuum tubes.
Thesemachineswereenormous,fillingupentireroomswithtensofthousandsofvacuum
tubes,buttheywerestillmillionsoftimesslowerthaneventhecheapestpersonalcomputers
availabletoday.

In these early days, a single group of people designed, built, programmed, operated, and
maintainedeachmachine.Allprogrammingwasdoneinabsolutemachinelanguage,oftenby
wiringupplugboardstocontrolthemachine'sbasicfunctions.Programminglanguageswere
unknown(evenassemblylanguagewasunknown).Operatingsystemswereunheardof.The
usualmodeofoperationwasfortheprogrammertosignupforablockoftimeonthesignup
sheetonthewall,thencomedowntothemachineroom,inserthisorherplugboardintothe
computer,andspendthenextfewhourshopingthatnoneofthe20,000orsovacuumtubes
would burn out during the run. Virtually all the problems were straightforward numerical
calculations,suchasgrindingouttablesofsines,cosines,andlogarithms.

Bytheearly1950s,theroutinehadimprovedsomewhatwiththeintroductionofpunched
cards. It was now possible to write programs on cards and read them in instead of using
plugboards;otherwise,theprocedurewasthesame.

1.2.2TheSecondGeneration(195565)TransistorsandBatchSystems
Theintroductionofthetransistorinthemid1950schangedthepictureradically.Computers
becamereliableenoughthattheycouldbemanufacturedandsoldtopayingcustomerswith
theexpectationthattheywouldcontinuetofunctionlongenoughtogetsomeusefulwork
done.Forthefirsttime,therewasaclearseparationbetweendesigners,builders,operators,
programmers,andmaintenancepersonnel.

These machines, now called mainframes, were locked away in specially air conditioned
computerrooms,withstaffsofprofessionaloperatorstorunthem.Onlybigcorporationsor
majorgovernmentagenciesoruniversitiescouldaffordthemultimilliondollarpricetag.To
runajob(i.e.,aprogramorsetofprograms),aprogrammerwouldfirstwritetheprogramon
paper(inFORTRANorassembler),thenpunchitoncards.Hewouldthenbringthecarddeck
downtotheinputroomandhandittooneoftheoperatorsandgodrinkcoffeeuntilthe
outputwasready.

Whenthecomputerfinishedwhatever jobitwascurrentlyrunning, anoperatorwouldgo
overtotheprinterandtearofftheoutputandcarryitovertotheoutputroom,sothatthe
programmercouldcollectitlater.Thenhewouldtakeoneofthecarddecksthathadbeen
brought from the input room and read it in. If the FORTRAN compiler was needed, the
operatorwouldhavetogetitfroma filecabinetandread itin.Muchcomputertimewas
wastedwhileoperatorswerewalkingaroundthemachineroom.

Giventhehighcostoftheequipment,itisnotsurprisingthatpeoplequicklylookedforways
toreducethewastedtime.Thesolutiongenerallyadoptedwasthebatchsystem.Theidea
behind it was to collect a tray full of jobs in the input room and then read them onto a
magnetictapeusingasmall(relatively)inexpensivecomputer,suchastheIBM1401,which

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

wasvery good atreading cards, copying tapes, and printingoutput,but notat allgood at
numericalcalculations.Other,muchmoreexpensivemachines,suchastheIBM7094,were
usedfortherealcomputing.ThissituationisshowninFig.


Figure:Anearlybatchsystem.(a)Programmersbringcardsto1401.(b)1401readsbatchof
jobs onto tape. (c) Operator carries input tape to 7094. (d) 7094 does computing. (e)
Operatorcarriesoutputtapeto1401.(f)1401printsoutput.
Afteraboutanhourofcollectingabatchofjobs,thetapewasrewoundandbroughtintothe
machineroom,whereitwasmountedonatapedrive.Theoperatorthenloadedaspecial
program(theancestoroftoday'soperatingsystem),whichreadthefirstjobfromtapeand
ranit.Theoutputwaswrittenontoasecondtape,insteadofbeingprinted.Aftereachjob
finished, the operating system automatically read the next job from the tape and began
running it. When the whole batch was done, the operator removed the input and output
tapes,replacedtheinputtapewiththenextbatch,andbroughttheoutputtapetoa1401for
printingoffline(i.e.,notconnectedtothemaincomputer).


Figure12StructureofatypicalFMSjob.

ThestructureofatypicalinputjobisshowninFig.Itstartedoutwitha$JOBcard,specifying
themaximumruntimeinminutes,theaccountnumbertobecharged,andtheprogrammer's
name. Then came a $FORTRAN card, telling the operating system to load the FORTRAN
compilerfromthesystemtape.Itwasfollowedbytheprogramtobecompiled,andthena
$LOAD card, directing the operating system to load the object program just compiled.
(Compiledprogramswereoftenwrittenonscratchtapesandhadtobeloadedexplicitly.)Next
camethe$RUNcard,tellingtheoperatingsystemtoruntheprogramwiththedatafollowing
it.Finally,the$ENDcardmarkedtheendofthejob.Theseprimitivecontrolcardswerethe
forerunnersofmodernjobcontrollanguagesandcommandinterpreters.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Large secondgeneration computers were used mostly for scientific and engineering
calculations,suchassolvingthepartialdifferentialequationsthatoftenoccurinphysicsand
engineering. They were largely programmed in FORTRAN and assembly language. Typical
operatingsystemswereFMS(theFortranMonitorSystem)andIBSYS,IBM'soperatingsystem
forthe7094.

TheThirdGeneration(19651980)ICsandMultiprogramming
Bytheearly1960s,mostcomputermanufacturershadtwodistinct,andtotallyincompatible,
product lines. On the one hand there were the wordoriented, largescale scientific
computers, such as the 7094, which were used for numerical calculations in science and
engineering.Ontheotherhand,therewerethecharacteroriented,commercialcomputers,
suchasthe1401,whichwerewidelyusedfortapesortingandprintingbybanksandinsurance
companies.

Developing and maintaining two completely different product lines was an expensive
proposition for the manufacturers. In addition, many new computer customers initially
neededasmallmachinebutlateroutgrewitandwantedabiggermachinethatwouldrunall
theiroldprograms,butfaster.

IBM attempted to solve both of these problems at a single stroke by introducing the
System/360.The360wasaseriesofsoftwarecompatiblemachinesrangingfrom1401sized
tomuchmorepowerfulthanthe7094.Themachinesdifferedonlyinpriceandperformance
(maximummemory,processorspeed,numberofI/Odevicespermitted,andsoforth).Since
all the machines had the same architecture and instruction set, programs written for one
machinecouldrunonalltheothers,atleastintheory.Furthermore,the360wasdesignedto
handle both scientific (i.e., numerical) and commercial computing. Thus a single family of
machinescouldsatisfytheneedsofallcustomers.Insubsequentyears,IBMhascomeout
withcompatiblesuccessorstothe360line,usingmoremoderntechnology,knownasthe370,
4300,3080,and3090series.

The360wasthefirstmajorcomputerlinetouse(smallscale)IntegratedCircuits(ICs),thus
providingamajorprice/performanceadvantageoverthesecondgenerationmachines,which
werebuiltupfromindividualtransistors.Itwasanimmediatesuccess,andtheideaofafamily
of compatible computers was soon adopted by all the other major manufacturers. The
descendantsofthesemachinesarestillinuseatcomputercenterstoday.Nowadaystheyare
oftenusedformanaginghugedatabases(e.g.,forairlinereservationsystems)orasservers
forWorldWideWebsitesthatmustprocessthousandsofrequestspersecond.

Thegreateststrengthofthe''onefamily''ideawassimultaneouslyitsgreatestweakness.The
intentionwasthatallsoftware,includingtheoperatingsystem,OS/360hadtoworkonall
models.Ithadtorunonsmallsystems,whichoftenjustreplaced1401sforcopyingcardsto
tape,andonverylargesystems,whichoftenreplaced7094sfordoingweatherforecasting
andotherheavycomputing.Ithadtobegoodonsystemswithfewperipheralsandonsystems
with many peripherals. It had to work in commercial environments and in scientific
environments.Aboveall,ithadtobeefficientforallofthesedifferentuses.

TherewasnowaythatIBM(oranybodyelse)couldwriteapieceofsoftwaretomeetallthose
conflictingrequirements.Theresultwasanenormousandextraordinarilycomplexoperating
system,probablytwotothreeordersofmagnitudelargerthanFMS.Itconsistedofmillions
oflinesofassemblylanguagewrittenbythousandsofprogrammers,andcontainedthousands
upon thousands of bugs, which necessitated a continuous stream of new releases in an

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

attempttocorrectthem.Eachnewreleasefixedsomebugsandintroducednewones,sothe
numberofbugsprobablyremainedconstantintime.

OneofthedesignersofOS/360,FredBrooks,subsequentlywroteawittyandincisivebook
(Brooks, 1996) describing his experiences with OS/360. While it would be impossible to
summarizethebookhere,sufficeittosaythatthecovershowsaherdofprehistoricbeasts
stuckinatarpit.ThecoverofSilberschatzetal.(2000)makesasimilarpointaboutoperating
systemsbeingdinosaurs.

Despiteitsenormoussizeandproblems,OS/360andthesimilarthirdgenerationoperating
systems produced by other computer manufacturers actually satisfied most of their
customersreasonablywell.Theyalsopopularizedseveralkeytechniquesabsentinsecond
generationoperatingsystems.Probablythemostimportantofthesewasmultiprogramming.
On the 7094, when the current job paused to wait for a tape or other I/O operation to
complete,theCPU simplysatidleuntiltheI/Ofinished.WithheavilyCPUboundscientific
calculations,I/Oisinfrequent,sothiswastedtimeisnotsignificant.Withcommercialdata
processing,theI/Owaittimecanoftenbe80or90percentofthetotaltime,sosomething
hadtobedonetoavoidhavingthe(expensive)CPUbeidlesomuch.


Amultiprogrammingsystemwiththreejobsinmemory.

Thesolutionthatevolvedwastopartitionmemoryintoseveralpieces,withadifferentjobin
eachpartition,asshowninFig.WhileonejobwaswaitingforI/Otocomplete,anotherjob
couldbeusingtheCPU.Ifenoughjobscouldbeheldinmainmemoryatonce,theCPUcould
bekeptbusynearly100percentofthetime.Havingmultiplejobssafelyinmemoryatonce
requires special hardware to protect each job against snooping and mischief by the other
ones,butthe360andotherthirdgenerationsystemswereequippedwiththishardware.
Anothermajorfeaturepresentinthirdgenerationoperatingsystemswastheabilitytoread
jobsfromcardsontothediskassoonastheywerebroughttothecomputerroom.Then,
wheneverarunningjobfinished,theoperatingsystemcouldloadanewjobfromthediskinto
the nowempty partition and run it. This technique is called spooling (from Simultaneous
PeripheralOperationOnLine)andwasalsousedforoutput.Withspooling,the1401swere
nolongerneeded,andmuchcarryingoftapesdisappeared.

Althoughthirdgenerationoperatingsystemswerewellsuitedforbigscientificcalculations
andmassivecommercialdataprocessingruns,theywerestillbasicallybatchsystems.Many
programmerspinedforthefirstgenerationdayswhentheyhadthemachinealltothemselves
forafewhours,sotheycoulddebugtheirprogramsquickly.Withthirdgenerationsystems,
thetimebetweensubmittingajobandgettingbacktheoutputwasoftenseveralhours,soa
singlemisplacedcommacouldcauseacompilationtofail,andtheprogrammertowastehalf
aday.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

This desire for quick response time paved the way for timesharing, a variant of
multiprogramming,inwhicheachuserhasanonlineterminal.Inatimesharingsystem,if20
usersareloggedinand17ofthemarethinkingortalkingordrinkingcoffee,theCPUcanbe
allocatedinturntothethreejobsthatwantservice.Sincepeopledebuggingprogramsusually
issueshortcommands(e.g.,compileafivepageprocedure)ratherthanlongones(e.g.,sort
amillionrecordfile),thecomputercanprovidefast,interactiveservicetoanumberofusers
andperhapsalsoworkonbigbatchjobsinthebackgroundwhentheCPUisotherwiseidle.
Thefirstserioustimesharingsystem,CTSS(CompatibleTimeSharingSystem),wasdeveloped
atM.I.T.onaspeciallymodified7094(Corbato´etal.,1962).However,timesharingdid
not really become popular until the necessary protection hardware became widespread
duringthethirdgeneration.

After the success of the CTSS system, MIT, Bell Labs, and General Electric (then a major
computermanufacturer)decidedtoembarkonthedevelopmentofa''computerutility,''a
machinethatwouldsupporthundredsofsimultaneoustimesharingusers.Theirmodelwas
theelectricitydistributionsystemwhenyouneedelectricpower,youjuststickapluginthe
wall, and within reason, as much power as you need will be there. The designers of this
system,knownasMULTICS(MULTiplexedInformationandComputingService),envisioned
onehugemachineprovidingcomputingpowerforeveryoneintheBostonarea.Theideathat
machines far more powerful than their GE645 mainframe would be sold for a thousand
dollarsbythemillionsonly 30yearslaterwaspuresciencefiction.Sortof likethe ideaof
supersonictransAtlanticunderseatrainsnow.

We will use the terms ''procedure,'' ''subroutine,'' and ''function'' interchangeably in this
book.

MULTICSwasamixedsuccess.Itwasdesignedtosupporthundredsofusersonamachine
only slightly more powerful than an Intel 386based PC, although it had much more I/O
capacity.Thisisnotquiteascrazyasitsounds,sincepeopleknewhowtowritesmall,efficient
programsinthosedays,askillthathassubsequentlybeenlost.Thereweremanyreasonsthat
MULTICSdidnottakeovertheworld,nottheleastofwhichisthatitwaswritteninPL/I,and
thePL/Icompilerwasyearslateandbarelyworkedatallwhenitfinallyarrived.Inaddition,
MULTICS was enormously ambitious for its time, much like Charles Babbage's analytical
engineinthenineteenthcentury.

To make a long story short, MULTICS introduced many seminal ideas into the computer
literature, but turning it into a serious product and a major commercial success was a lot
harderthananyonehadexpected.BellLabsdroppedoutoftheproject,andGeneralElectric
quitthecomputerbusinessaltogether.However,M.I.T.persistedandeventuallygotMULTICS
working.Itwasultimatelysoldasacommercialproductbythe companythatboughtGE's
computerbusiness(Honeywell)andinstalledbyabout80majorcompaniesanduniversities
worldwide. While their numbers were small, MULTICS users were fiercely loyal. General
Motors, Ford, and the U.S. National Security Agency, for example, only shut down their
MULTICSsystemsinthelate1990s,30yearsafterMULTICSwasreleased.

Forthemoment,theconceptofacomputerutilityhasfizzledoutbutitmaywellcomeback
intheformofmassivecentralizedInternetserverstowhichrelativelydumbusermachines
areattached,withmostoftheworkhappeningon thebigservers.The motivationhereis
likelytobethatmostpeopledonotwanttoadministrateanincreasinglycomplexandfinicky
computersystemandwouldprefertohavethatworkdonebyateamofprofessionalsworking
forthecompanyrunningtheserver.Ecommerceisalreadyevolvinginthisdirection,with

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

variouscompaniesrunningemallsonmultiprocessorserverstowhichsimpleclientmachines
connect,verymuchinthespiritoftheMULTICSdesign.

Despite its lack of commercial success, MULTICS had a huge influence on subsequent
operatingsystems.Itisdescribedin(Corbatoetal.,1972;CorbatoandVyssotsky,1965;Daley
and Dennis, 1968; Organick, 1972; and Saltzer, 1974). It also has a stillactive Web site,
http://www.multicians.org,withagreatdealofinformationaboutthesystem,itsdesigners,
anditsusers.

Another major development during the third generation was the phenomenal growth of
minicomputers,startingwiththeDECPDP1in1961.ThePDP1hadonly4Kof18bitwords,
butat$120,000permachine(lessthan5percentofthepriceofa7094),itsoldlikehotcakes.
Forcertainkindsofnonnumericalwork,itwasalmostasfastasthe7094andgavebirthtoa
wholenewindustry.ItwasquicklyfollowedbyaseriesofotherPDPs(unlikeIBM'sfamily,all
incompatible)culminatinginthePDP11.

Oneofthecomputerscientists atBell LabswhohadworkedontheMULTICSproject,Ken
Thompson,subsequentlyfoundasmallPDP7minicomputerthatnoonewasusingandset
outtowriteastrippeddown,oneuserversionofMULTICS.Thisworklaterdevelopedinto
theUNIXoperatingsystem,whichbecamepopularintheacademicworld,withgovernment
agencies,andwithmanycompanies.

ThehistoryofUNIXhasbeentoldelsewhere(e.g.,Salus,1994).Partofthatstorywillbegiven
inChap.10. Fornow,suffice ittosay, thatbecausethe sourcecodewaswidelyavailable,
variousorganizationsdevelopedtheirown(incompatible)versions,whichledtochaos.Two
majorversionsdeveloped,SystemV,fromAT&T,andBSD,(BerkeleySoftwareDistribution)
fromtheUniversityofCaliforniaatBerkeley.Thesehadminorvariantsaswell.Tomakeit
possibletowriteprogramsthatcouldrunonanyUNIXsystem,IEEEdevelopedastandardfor
UNIX,calledPOSIX,thatmostversionsofUNIXnowsupport.POSIXdefinesaminimalsystem
call interface that conformant UNIX systems must support. In fact, some other operating
systemsnowalsosupportthePOSIXinterface.

Asanaside,itisworthmentioningthatin1987,theauthorreleasedasmallcloneofUNIX,
calledMINIX,foreducationalpurposes.Functionally,MINIXisverysimilartoUNIX,including
POSIX support. A book describing its internal operation and listing the source code in an
appendix is also available (Tanenbaum and Woodhull, 1997). MINIX is available for free
(includingallthesourcecode)overtheInternetatURLhttp://www.cs.vu.nl/~ast/minix.html.

Thedesireforafreeproduction(asopposedtoeducational)versionofMINIXledaFinnish
student,LinusTorvalds,towriteLinux.ThissystemwasdevelopedonMINIXandoriginally
supportedvariousMINIXfeatures(e.g.,theMINIXfilesystem).Ithassincebeenextendedin
manywaysbutstillretainsalargeamountofunderlyingstructurecommontoMINIX,andto
UNIX(uponwhichtheformerwasbased).MostofwhatwillbesaidaboutUNIXinthisbook
thusappliestoSystemV,BSD,MINIX,Linux,andotherversionsandclonesofUNIXaswell.

TheFourthGeneration(1980Present)PersonalComputers
WiththedevelopmentofLSI(LargeScaleIntegration)circuits,chipscontainingthousandsof
transistorsonasquarecentimeterofsilicon,theageofthepersonalcomputerdawned.In
termsofarchitecture,personalcomputers(initiallycalledmicrocomputers)werenotallthat
differentfromminicomputersofthePDP11class,butintermsofpricetheycertainlywere
different. Where the minicomputer made it possible for a department in a company or

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

universitytohaveitsowncomputer,themicroprocessorchipmadeitpossibleforasingle
individualtohavehisorherownpersonalcomputer.

In1974,whenIntelcameoutwiththe8080,thefirstgeneralpurpose8bitCPU,itwantedan
operatingsystemforthe8080,inparttobeabletotestit.Intelaskedoneofitsconsultants,
GaryKildall,towriteone.Kildallandafriendfirstbuiltacontrollerforthenewlyreleased
Shugart Associates 8inch floppy disk and hooked the floppy disk up to the 8080, thus
producing the first microcomputer with a disk. Kildall then wrote a diskbased operating
systemcalledCP/M(ControlProgramforMicrocomputers)forit.SinceInteldidnotthinkthat
diskbasedmicrocomputershadmuchofafuture,whenKildallaskedfortherightstoCP/M,
Intelgrantedhisrequest.Kildallthenformedacompany,DigitalResearch,tofurtherdevelop
andsellCP/M.

In 1977, Digital Research rewrote CP/M to make it suitable for running on the many
microcomputersusingthe8080,ZilogZ80,andotherCPUchips.Manyapplicationprograms
were written to run on CP/M, allowing it to completely dominate the world of
microcomputingforabout5years.

Intheearly1980s,IBMdesignedtheIBMPCandlookedaroundforsoftwaretorunonit.
PeoplefromIBMcontactedBillGatestolicensehisBASICinterpreter.Theyalsoaskedhimif
heknewofanoperatingsystemtorunonthePC.GatessuggestedthatIBMcontactDigital
Research,thentheworld'sdominantoperatingsystemscompany.Makingwhatwassurely
theworstbusinessdecisioninrecordedhistory,KildallrefusedtomeetwithIBM,sendinga
subordinate instead. To make matters worse, his lawyer even refused to sign IBM's
nondisclosureagreementcoveringthenotyetannouncedPC.Consequently,IBMwentback
toGatesaskingifhecouldprovidethemwithanoperatingsystem.

WhenIBMcameback,Gatesrealizedthatalocalcomputermanufacturer,SeattleComputer
Products,hadasuitableoperatingsystem,DOS(DiskOperatingSystem).Heapproachedthem
andaskedtobuyit(allegedlyfor$50,000),whichtheyreadilyaccepted.Gatesthenoffered
IBMaDOS/BASICpackage,whichIBMaccepted.IBMwantedcertainmodifications,soGates
hiredthepersonwhowroteDOS,TimPaterson,asanemployeeofGates'fledglingcompany,
Microsoft, to make them. The revised system was renamed MSDOS (MicroSoft Disk
OperatingSystem)andquicklycametodominatetheIBMPCmarket.Akeyfactorherewas
Gates' (in retrospect, extremely wise) decision to sell MSDOS to computer companies for
bundlingwiththeirhardware,comparedtoKildall'sattempttosellCP/Mtoendusersoneat
atime(atleastinitially).

BythetimetheIBMPC/ATcameoutin1983withtheIntel80286CPU,MSDOSwasfirmly
entrenchedandCP/Mwasonitslastlegs.MSDOSwaslaterwidelyusedonthe80386and
80486. Although the initial version of MSDOS was fairly primitive, subsequent versions
included more advanced features, including many taken from UNIX. (Microsoft was well
awareofUNIX,evensellingamicrocomputerversionofitcalledXENIXduringthecompany's
earlyyears.)CP/M,MSDOS,andotheroperatingsystemsforearlymicrocomputerswereall
based on users typing in commands from the keyboard. That eventually changed due to
research done by Doug Engelbart at Stanford Research Institute in the 1960s. Engelbart
inventedtheGUI(GraphicalUserInterface),pronounced''gooey,''completewithwindows,
icons, menus, and mouse. These ideas were adopted by researchers at Xerox PARC and
incorporatedintomachinestheybuilt.

Oneday,SteveJobs,whocoinventedtheApplecomputerinhisgarage,visitedPARC,sawa
GUI,andinstantlyrealizeditspotentialvalue,somethingXeroxmanagementfamouslydidnot

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

(Smith and Alexander, 1988). Jobs then embarked on building an Apple with a GUI. This
project led to the Lisa, which was too expensive and failed commercially. Jobs' second
attempt,theAppleMacintosh,wasahugesuccess,notonlybecauseitwasmuchcheaper
thantheLisa,butalsobecauseitwasuserfriendly,meaningthatitwasintendedforusers
whonotonlyknewnothingaboutcomputersbutfurthermorehadabsolutelynointention
whatsoeveroflearning.

WhenMicrosoftdecidedtobuildasuccessortoMSDOS,itwasstronglyinfluencedbythe
successoftheMacintosh.ItproducedaGUIbasedsystemcalledWindows,whichoriginally
ranontopofMSDOS(i.e.,itwasmorelikeashellthanatrueoperatingsystem).Forabout
10years,from1985to1995,WindowswasjustagraphicalenvironmentontopofMSDOS.
However,startingin1995afreestandingversionofWindows,Windows95,wasreleasedthat
incorporatedmanyoperatingsystemfeaturesintoit,usingtheunderlyingMSDOSsystem
onlyforbootingandrunningoldMSDOSprograms.In1998,aslightlymodifiedversionofthis
system,calledWindows98wasreleased.Nevertheless,bothWindows95andWindows98
stillcontainalargeamountof16bitIntelassemblylanguage.

AnotherMicrosoftoperatingsystemisWindowsNT(NTstandsforNewTechnology),whichis
compatiblewithWindows95atacertainlevel,butacompleterewritefromscratchinternally.
Itisafull32bitsystem.TheleaddesignerforWindowsNTwasDavidCutler,whowasalso
oneofthedesignersoftheVAXVMSoperatingsystem,sosomeideasfromVMSarepresent
in NT. Microsoft expected that the first version of NT would kill off MSDOS and all other
versionsofWindowssinceitwasavastlysuperiorsystem,butitfizzled.OnlywithWindows
NT 4.0 did it finally catch on in a big way, especially on corporate networks. Version 5 of
WindowsNTwasrenamedWindows2000inearly1999.Itwasintendedtobethesuccessor
tobothWindows98andWindowsNT4.0.Thatdidnotquiteworkouteither,soMicrosoft
cameoutwithyetanotherversionofWindows98calledWindowsMe(Millenniumedition).

The other major contender in the personal computer world is UNIX (and its various
derivatives). UNIX is strongest on workstations and other highend computers, such as
network servers. It is especially popular on machines powered by highperformance RISC
chips.OnPentiumbasedcomputers,LinuxisbecomingapopularalternativetoWindowsfor
studentsandincreasinglymanycorporateusers.(Asanaside,throughoutthisbookwewill
use the term ''Pentium'' to mean the Pentium I, II, III, and 4.) Although many UNIX users,
especiallyexperiencedprogrammers,preferacommandbasedinterfacetoaGUI,nearlyall
UNIXsystemssupportawindowingsystemcalledtheXWindowssystemproducedatM.I.T.
Thissystemhandlesthebasicwindowmanagement,allowinguserstocreate,delete,move,
andresizewindowsusingamouse.OftenacompleteGUI,suchasMotif,isavailabletorun
ontopoftheXWindowssystemgivingUNIXalookandfeelsomethingliketheMacintoshor
MicrosoftWindows,forthoseUNIXuserswhowantsuchathing.

Aninterestingdevelopmentthatbegantakingplaceduringthemid1980sisthegrowthof
networks of personal computers running network operating systems and distributed
operating systems (Tanenbaum andVan Steen, 2002). In a network operating system, the
usersareawareoftheexistenceofmultiplecomputersandcanlogintoremotemachines
andcopyfilesfromonemachinetoanother.Eachmachinerunsitsownlocaloperatingsystem
andhasitsownlocaluser(orusers).

Networkoperatingsystemsarenotfundamentallydifferentfromsingleprocessoroperating
systems.Theyobviouslyneedanetworkinterfacecontrollerandsomelowlevelsoftwareto
drive it, as well as programs to achieve remote login and remote file access, but these
additionsdonotchangetheessentialstructureoftheoperatingsystem.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi


Adistributedoperatingsystem,incontrast,isonethatappearstoitsusersasatraditional
uniprocessorsystem,eventhoughitisactuallycomposedofmultipleprocessors.Theusers
shouldnotbeawareofwheretheirprogramsarebeingrunorwheretheirfilesarelocated;
thatshouldallbehandledautomaticallyandefficientlybytheoperatingsystem.

True distributed operating systems require more than just adding a little code to a
uniprocessoroperatingsystem,becausedistributedandcentralizedsystemsdifferincritical
ways.Distributedsystems,forexample,oftenallowapplicationstorunonseveralprocessors
atthesametime,thusrequiringmorecomplexprocessorschedulingalgorithmsinorderto
optimizetheamountofparallelism.

Communicationdelayswithinthenetworkoftenmeanthatthese(andother)algorithmsmust
run with incomplete, outdated, or even incorrect information. This situation is radically
different from a singleprocessor system in which the operating system has complete
informationaboutthesystemstate.

OntogenyRecapitulatesPhylogeny
AfterCharlesDarwin'sbookTheOriginoftheSpecieswaspublished,theGermanzoologist
Ernst Haeckel stated that ''Ontogeny Recapitulates Phylogeny.'' By this he meant that the
development of an embryo (ontogeny) repeats (i.e., recapitulates) the evolution of the
species(phylogeny).Inotherwords,afterfertilization,ahumanegggoesthroughstagesof
beingafish,apig,andsoonbeforeturningintoahumanbaby.Modernbiologistsregardthis
asagrosssimplification,butitstillhasakerneloftruthinit.

Somethinganalogoushashappenedinthecomputerindustry.Eachnewspecies(mainframe,
minicomputer, personal computer, embedded computer, smart card, etc.) seems to go
through the development that its ancestors did. The first mainframes were programmed
entirelyinassemblylanguage.Evencomplexprograms,likecompilersandoperatingsystems,
were written in assembler. By the time minicomputers appeared on the scene, FORTRAN,
COBOL, and other highlevel languages were common on mainframes, but the new
minicomputers were nevertheless programmed in assembler (for lack of memory). When
microcomputers(earlypersonalcomputers)wereinvented,they,too,wereprogrammedin
assembler, even though by then minicomputers were also programmed in highlevel
languages.Palmtopcomputersalsostartedwithassemblycodebutquicklymovedontohigh
levellanguages(mostlybecausethedevelopmentworkwasdoneonbiggermachines).The
sameistrueforsmartcards.

Now let us look at operating systems. The first mainframes initially had no protection
hardwareandnosupportformultiprogramming,sotheyransimpleoperatingsystemsthat
handled one manuallyloaded program at a time. Later they acquired the hardware and
operating system support to handle multiple programs at once, and then full timesharing
capabilities.

When minicomputers first appeared, they also had no protection hardware and ran one
manuallyloadedprogramatatime,eventhoughmultiprogrammingwaswellestablishedin
themainframeworldbythen.Gradually,theyacquiredprotectionhardwareandtheability
toruntwoormoreprogramsatonce.Thefirstmicrocomputerswerealsocapableofrunning
only one program at a time, but later acquired the ability to multiprogram. Palmtops and
smartcardswentthesameroute.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi


Disksfirstappearedonlargemainframes,thenonminicomputers,microcomputers,andso
ondowntheline.Evennow,smartcardsdonothaveharddisks,butwiththeadventofflash
ROM,theywillsoonhavetheequivalentofit.Whendisksfirstappeared,primitivefilesystems
sprungup.OntheCDC6600,easilythemostpowerfulmainframeintheworldduringmuch
ofthe1960s,thefilesystemconsistedofusershavingtheabilitytocreateafileandthen
declareittobepermanent,meaningitstayedonthediskevenafterthecreatingprogram
exited.Toaccesssuchafilelater,aprogramhadtoattachitwithaspecialcommandandgive
its password (supplied when the file was made permanent). In effect, there was a single
directory shared by all users. It was up to the users to avoid file name conflicts. Early
minicomputer file systems had a single directory shared by all users and so did early
microcomputerfilesystems.

Virtualmemory(theabilitytorunprogramslargerthanthephysicalmemory)hadasimilar
development.Itfirstappearedinmainframes,minicomputers,microcomputersandgradually
workeditswaydowntosmallerandsmallersystems.Networkinghadasimilarhistory.

In all cases, the software development was dictated by the technology. The first
microcomputers, for example, had something like 4 KB of memory and no protection
hardware.Highlevellanguagesandmultiprogrammingweresimplytoomuchforsuchatiny
system to handle. As the microcomputers evolved into modern personal computers, they
acquiredthenecessaryhardwareandthenthenecessarysoftwaretohandlemoreadvanced
features.Itislikelythatthisdevelopmentwillcontinueforyearstocome.Otherfieldsmay
alsohavethiswheelofreincarnation,butinthecomputerindustryitseemstospinfaster.
20. ExplainmonolithicarchitectureofOSdesign?(May13,Dec13)
Ans A monolithic kernel is an operating system architecture where the
entire operating system is working in kernel space and is alone in supervisor mode.
MostprimitiveformoftheOS
Practicallynostructure
Characterizedbyacollectionofproceduresthatcancallanyotherprocedure
Allproceduresmusthaveawelldefinedinterface
Doesnotallowinformationhiding(privatefunctionsforprocedures)
Services provided by putting parameters in welldefined places and executing
asupervisorycall
Basicstructure
o Mainprogramthatinvokesrequestedserviceprocedures
o Setofserviceprocedurestocarryoutsystemcalls
o Setofutilityprocedurestohelptheserviceprocedures

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Userprogramexecutesuntil
o programterminates
o programmakesaservicerequest
o atimeoutsignaloccurs
o anexternalinterruptoccurs
Problemswithmonolithicstructure
o Difficulttomaintain
o Difficulttotakecareofconcurrencyduetomultipleusers/jobs


Amonolithickernel,suchasLinuxandotherUnixsystems.

21. Differentiatebetweenmonolithicandmicrokernelarchitecture?
Ans MonolithicKernel Microkernel
AllthepartsofakernelliketheScheduler, OnlytheveryimportantpartslikeIPC(Inter
File System, Memory Management, process Communication), basic scheduler,
NetworkingStacks,DeviceDrivers,etc.,are basicmemoryhandling,basicI/Oprimitives
maintainedinoneunitwithinthekernelin etc., are put into the kernel.
MonolithicKernel Communication happen via message
passing. Others are maintained as server
processesinUserSpace
Fasterprocessing CrashResistant,Portable,SmallerSize
CrashInsecurePortingInflexibilityKernel Slower Processing due to additional
Sizeexplosion MessagePassing
MSDOS,Unix,Linux WindowsNT
1)MonolithickernelismucholderthanMicrokernel,theideawasconceivedattheend
ofthe1980's.

2)MonolithickernelsareusedinUnixandLinux.MicrokernelsareusedinQNX,L4and
HURD.ItwasinitiallyusedinMach(notMacOSX)butlaterconvertedintoahybridkernel.
EvenMinixisnotapurekernelbecausedevicedriversarecompiledaspartofthekernel.

3)Monolithickernelsarefasterthanmicrokernels.ThefirstmicrokernelMachwas50%
slowerthanMonolithickernel,whilelaterversionlikeL4wereonly2%or4%slowerthan
theMonolithickernel.

4)Monolithickernelsgenerallyarebulky.ApureMicrokernelhastobesmallinsize,tofit
intotheprocessor'sL1cache(firstgenerationmicrokernel).

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

5) In Monolithic kernels, the device drivers reside in the kernel space while in the
Microkernelthedevicedriversresideintheuserspace.

6 ) Since the device driver resides in the kernel space, it makes monolithic kernel less
securethanmicrokernel,andfailureinthedrivermayleadtocrash.Microkernelsaremore
securethanthemonolithickernel,henceusedinsomemilitarydevices.

7)MonolithickernelsusesignalsandsocketstoensureIPC,microkernelapproachuses
messagequeues.1stgenmicrokernelspoorlyimplementedIPCsowereslowoncontext
switches.

8 ) Adding a new feature to a monolithic system means recompiling the whole kernel,
whereaswithmicrokernelsyoucanaddnewfeaturesorpatcheswithoutrecompiling.
Introduction
Computeroperatingsystemshavebeenaroundformorethanhalfacenturysothereis
not much to add to the definition. Whether you are in the software industry or the
academia,IassumeyouknowwhatanoperatingsystemmeansbutinfewwordsanOSis
thepieceofsoftwarethatsitsbetweencomputinghardwareanduserapplications.Inthis
article,Iamgoingtosummarizeandcontrastsomeofthemostpopularoperatingsystems
architecturesfromahighlevelperspective.
Generallyspeaking,anoperatingsystemconsistsoftwoparts:aprivilegedmodecalled
kernelspaceandunprivilegedmodecalleduserspace.Theseparationisaneedratherthan
an option otherwise process protection cannot be achieved. Depending on which
processes run in what space, we can classify operating systems into three main
architectures: Monolithic kernel, Microkernel and Hybrid or modular kernel operating
systems.Letusnowexplorethesearchitecturesandseethegoodandbadabouteachone
ofthem.
MonolithicKernel
YoucanthinkofamonolithickernelOSasasinglelargestaticbinaryfileprocessrunning
entirelyinasingleaddressspace.BasicOSservicessuchasprocessmanagement,memory
management, interrupt handling, IO communication, file system, device drivers,
networking,etcallruninkernelspace.Entireservicesareloadedonbootupandresidein
memoryandworkisdoneusingsystemcalls.Linuxisanexampleonamonolithickernel
basedOS.
MonolithicKernelAdvantages
GenerallyspeakingamonolithicOSkernelisfasterduetosmallsourceandcompiledcode
size.Lesscodemeansalsolessbugsandsecurityissues.
MonolithicKerneldisadvantages
Monolithic OS being a single big pile of code has disadvantages. For example, making
changesisnoteasyandtestingtakesmoretime.Itishardtomaintain,patchorextend.
Bugfixingoraddingnewfeaturesrequiresthecompilationofthewholesourcecodewhich
isatimeandresourceconsumingprocess.
Microkernel
The idea behind microkernel OS is to reduce the kernel to only basic process
communicationandIOcontrolandletothersystemservicesruninuserspacejustlikeany
othernormalprocesses.Theseservicesarecalledserversandkeptseparateandrunin
differentaddressspaces.ContrarytomonolithicOSwhereservicesaredirectlyinvoked,
communication in a microkernel is done via message passing (inter process
communication IPC). Mac OS and WinNT are two examples on microkernel OS
architecture.
MicrokernelAdvantages
HeresomeadvantagestothemicrokernelOSarchitecture

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

1. Service separation has the advantage that if one service (called a server) fails
otherscanstillworksoreliabilityistheprimaryfeature.Forexampleifadevice
drivercrashesdoesnotcausetheentiresystemtocrash.Onlythatdriverneedto
be restarted rather than having the entire system die. This means more
persistence as one server can be substituted with another. It also means
maintenanceiseasier.
2. Differentservicesarebuiltintospecialmoduleswhichcanbeloadedorunloaded
whenneeded.Patchescanbetestedseparatelythenswappedtotakeoverona
productioninstance.
3. Messagepassingallowsindependentcommunicationandallowsextensibility
4. The fact that there is no need to reboot the kernel implies rapid test and
development.
5. Easyandfasterintegrationwith3dpartymodules.
MicrokernelDisadvantages
Herearesomedisadvantagestothemicrokernelapproach
1. Memoryfootprintislarge
2. Potentialperformanceloss(moresoftwareinterfacesduetomessagepassing)
3. Messagepassingbugsarenoteasytofix

4. Processmanagementiscomplex
22. Whatisresidentmonitor?HowitworksinbatchOS?(Dec13)
Ans Aresidentmonitorwasapieceofsystemsoftwareinmanyearlycomputersfromthe1950s
to1970s.Itcanbeconsideredaprimitiveprecursortotheoperatingsystem.Onageneral
usecomputerusingpunchedcardinputtheresidentmonitorgovernedthemachinebefore
andaftereachjobcontrolcardwasexecuted,loadedandinterpretedeachcontrolcard,and
acted as a job sequencer for batch processing operations. Similar very primitive system
software layers were typically in use in the early days of the later minicomputers and
microcomputersbeforetheygainedthepowertosupportfulloperatingsystems.
23. ExplainSpoolinganditsadvantagesinbatchOS.(Dec07,09,May12)
Ans Spooling is an acronym for simultaneous peripheral operations on line. Spooling refers to
puttingdataofvariousI/Ojobsinabuffer.Thisbufferisaspecialareainmemoryorharddisk
whichisaccessibletoI/Odevices.Operatingsystemdoesthefollowingactivitesrelatedto
distributedenvironment.
OShandlesI/Odevicedataspoolingasdeviceshavedifferentdataaccessrates.
OSmaintainsthespoolingbufferwhichprovidesawaitingstationwheredatacanrest
whiletheslowerdevicecatchesup.
OSmaintainsparallelcomputation because of spooling process as a computer can
performI/Oinparallelfashion.Itbecomespossibletohavethecomputerreaddata
fromatape,writedatatodiskandtowriteouttoatapeprinterwhileitisdoingits
computingtask.


Advantages
Thespoolingoperationusesadiskasaverylargebuffer.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Spooling is capable of overlapping I/O operation for one job with processor
operationsforanotherjob.

24. Explainprotection?(Dec2007)
Ans ProtectionandSecurity
Protectioninvolvesensuringthatnoprocessaccessorinterferewithresourcestowhichthey
are not entitled, either by design or by accident. ( E.g. "protection faults" when pointer
variablesaremisused.)
Securityinvolvesprotectingthesystemfromdeliberateattacks,eitherfromlegitimateusers
ofthe systemattemptingtogain unauthorized accessandprivileges,orexternalattackers
attemptingtoaccessordamagethesystem.
25. ExplainI/otrends?
Ans


Management of I/O devices is a very important part of the operating system so
important and so varied that entire I/O subsystems are devoted to its operation.
(Considertherangeofdevicesonamoderncomputer,frommice,keyboards,disk
drives, display adapters, USB devices, network connections, audio I/O, printers,
specialdevicesforthehandicapped,andmanyspecialpurposeperipherals.)
I/OSubsystemsmustcontendwithtwo(conflicting?)trends:
The gravitationtowards standard interfaces for a wide range of devices, making it
easiertoaddnewlydevelopeddevicestoexistingsystems,and
the development of entirely new types of devices, for which the existing standard
interfacesarenotalwayseasytoapply.
Device driversare modules that can be plugged into an OS to handle a particular
deviceorcategoryofsimilardevices.
I/Odevicescanberoughlycategorizedasstorage,communications,userinterface,
andother
Devicescommunicatewiththecomputerviasignalssentoverwiresorthroughthe
air.
Devicesconnectwiththecomputerviaports,e.g.aserialorparallelport.
Acommonsetofwiresconnectingmultipledevicesistermedabus.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Busesincluderigidprotocolsforthetypesofmessagesthatcanbesentacrossthe
busandtheproceduresforresolvingcontentionissues.
FigurebelowillustratesthreeofthefourbustypescommonlyfoundinamodernPC:

1. ThePCI busconnects highspeed highbandwidth devices to the memory
subsystem(andtheCPU.)
2. Theexpansion busconnects slower lowbandwidth devices, which typically
deliverdataonecharacteratatime(withbuffering.)
3. TheSCSIbusconnectsanumberofSCSIdevicestoacommonSCSIcontroller.
4. Adaisychainbus,(notshown)iswhenastringofdevicesisconnectedtoeach
otherlikebeadsonachain,andonlyoneofthedevicesisdirectlyconnectedto
thehost.
One way of communicating with devices is through registers associated with each port.
Registers may be one to four bytes in size, and may typically include ( a subset of ) the
followingfour:
i). Thedatainregisterisreadbythehosttogetinputfromthedevice.
ii). Thedataoutregisteriswrittenbythehosttosendoutput.
iii). Thestatusregisterhasbitsreadbythehosttoascertainthestatusofthedevice,such
asidle,readyforinput,busy,error,transactioncomplete,etc.
iv). The control register has bits written by the host to issue commands or to change
settingsofthedevicesuchasparitychecking,wordlength,orfullversushalfduplex
operation.
FigureshowssomeofthemostcommonI/Oportaddressranges.

DeviceI/OportlocationsonPCs(partial).

AnothertechniqueforcommunicatingwithdevicesismemorymappedI/O.
Inthiscaseacertainportionoftheprocessor'saddressspaceismappedtothedevice,
and communications occur by reading and writing directly to/from those memory
areas.
MemorymappedI/Oissuitablefordeviceswhichmustmovelargequantitiesofdata
quickly,suchasgraphicscards.
MemorymappedI/Ocanbeusedeitherinsteadoformoreoftenincombinationwith
traditional registers. For example, graphics cards still use registers for control
informationsuchassettingthevideomode.
ApotentialproblemexistswithmemorymappedI/O,ifaprocessisallowedtowrite
directlytotheaddressspaceusedbyamemorymappedI/Odevice.
(Note:MemorymappedI/Oisnotthesamethingasdirectmemoryaccess,DMA.)

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

BlockingandNonblockingI/O
WithblockingI/OaprocessismovedtothewaitqueuewhenanI/Orequestismade,
and moved back to the ready queue when the request completes, allowing other
processestoruninthemeantime.
WithnonblockingI/OtheI/Orequestreturnsimmediately,whethertherequested
I/Ooperationhas(completely)occurredornot.Thisallowstheprocesstocheckfor
availabledatawithoutgettinghungcompletelyifitisnotthere.
One approach forprogrammers to implementnonblockingI/O istohave a multi
threaded application, in whichone thread makes blockingI/O calls( sayto read a
keyboardormouse),whileotherthreadscontinuetoupdatethescreenorperform
othertasks.
AsubtlevariationofthenonblockingI/OistheasynchronousI/O,inwhichtheI/O
requestreturns immediatelyallowingtheprocesstocontinueonwithothertasks,
and then the process is notified ( via changing a process variable, or a software
interrupt,oracallbackfunction)whentheI/Ooperationhascompletedandthedata
isavailableforuse.(TheregularnonblockingI/Oreturnsimmediatelywithwhatever
results are available, but does not complete the operation and notify the process
later.)


TwoI/Omethods:(a)synchronousand(b)asynchronous.
26. ExplainKeyarchitecturetrends?
Seelayeredarchitecture.
27. ExplaindifferentkindsofOS.
Batchprocessing


BatchprocessingisatechniqueinwhichOperatingSystemcollectsoneprogramsanddata
togetherinabatchbeforeprocessingstarts.Operatingsystemdoesthefollowingactivities
relatedtobatchprocessing.
OSdefinesajobwhichhaspredefinedsequenceofcommands,programsanddataas
asingleunit.
OS keeps a number a jobs in memory and executes them without any manual
information.
Jobsareprocessedintheorderofsubmissioni.efirstcomefirstservedfashion.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Whenjobcompletesitsexecution,itsmemoryisreleasedandtheoutputforthejob
getscopiedintoanoutputspoolforlaterprintingorprocessing.

Advantages
Batchprocessingtakesmuchoftheworkoftheoperatortothecomputer.
Increasedperformanceasanewjobgetstartedassoonasthepreviousjobfinished
withoutanymanualintervention.
Disadvantages
Difficulttodebugprogram.
Ajobcouldenteraninfiniteloop.
Duetolackofprotectionscheme,onebatchjobcanaffectpendingjobs.
Multitasking
MultitaskingreferstotermwheremultiplejobsareexecutedbytheCPUsimultaneouslyby
switchingbetweenthem.Switchesoccursofrequentlythattheusersmayinteractwitheach
program while it is running. Operating system does the following activities related to
multitasking.
The user gives instructions to the operating system or to a program directly, and
receivesanimmediateresponse.
Operating System handles multitasking in the way that it can handle multiple
operations/executesmultipleprogramsatatime.
MultitaskingOperatingSystemsarealsoknownasTimesharingsystems.
TheseOperatingSystemsweredevelopedtoprovideinteractiveuseofacomputer
systematareasonablecost.
A timeshared operating system uses concept of CPU scheduling and
multiprogrammingtoprovideeachuserwithasmallportionofatimesharedCPU.
Eachuserhasatleastoneseparateprograminmemory.


Aprogramthatisloadedintomemoryandisexecutingiscommonlyreferredtoasa
process.
When a process executes, it typically executesfor only avery shorttimebefore it
eitherfinishesorneedstoperformI/O.
Since interactive I/O typically runs at people speeds, it may take a long time to
completed.DuringthistimeaCPUcanbeutilizedbyanotherprocess.
Operatingsystemallowstheuserstosharethecomputersimultaneously.Sinceeach
actionorcommandinatimesharedsystemtendstobeshort,onlyalittleCPUtime
isneededforeachuser.
AsthesystemswitchesCPUrapidlyfromoneuser/programtothenext,eachuseris
giventheimpressionthathe/shehashis/herownCPU,whereasactuallyoneCPUis
beingsharedamongmanyusers.
Multiprogramming
When two or more programs are residing in memory at the same time, then sharing the
processorisreferredtothemultiprogramming.Multiprogrammingassumesasingleshared

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

processor. Multiprogramming increases CPU utilization by organizing jobs so that the CPU
alwayshasonetoexecute.
Followingfigureshowsthememorylayoutforamultiprogrammingsystem.
Operatingsystemdoesthefollowingactivitiesrelatedtomultiprogramming.
Theoperatingsystemkeepsseveraljobsinmemoryatatime.
Thissetofjobsisasubsetofthejobskeptinthejobpool.
Theoperatingsystempicksandbeginstoexecuteoneofthejobinthememory.
Multiprogrammingoperatingsystem monitorsthestateofallactive programsand
systemresourcesusingmemorymanagementprogramstoensuresthattheCPUis
neveridleunlesstherearenojobs


Advantages
HighandefficientCPUutilization.
UserfeelsthatmanyprogramsareallottedCPUalmostsimultaneously.
Disadvantages
CPUschedulingisrequired.
Toaccommodatemanyjobsinmemory,memorymanagementisrequired.
Interactivity
InteractivityrefersthataUseriscapabletointeractwithcomputersystem.Operatingsystem
doesthefollowingactivitiesrelatedtointeractivity.
OSprovidesuseraninterfacetointeractwithsystem.
OSmanagersinputdevicestotakeinputsfromtheuser.Forexample,keyboard.
OSmanagesoutputdevicestoshowoutputstotheuser.Forexample,Monitor.
OSResponsetimeneedstobeshortsincetheusersubmitsandwaitsfortheresult.
RealTimeSystem
Realtimesystemsrepresentsareusuallydedicated,embeddedsystems.Operatingsystem
doesthefollowingactivitiesrelatedtorealtimesystemactivity.
Insuchsystems,OperatingSystemstypicallyreadfromandreacttosensordata.
TheOperatingsystemmustguaranteeresponsetoeventswithinfixedperiodsoftime
toensurecorrectperformance.
DistributedEnvironment
DistributedenvironmentreferstomultipleindependentCPUsorprocessorsinacomputer
system.Operatingsystemdoesthefollowingactivitiesrelatedtodistributedenvironment.
OSDistributescomputationlogicsamongseveralphysicalprocessors.
Theprocessorsdonotsharememoryoraclock.

Operating System: Unit I : Introduction


Notes Compiled by Kapil Kumar Nagwanshi

Instead,eachprocessorhasitsownlocalmemory.
OSmanagesthecommunicationsbetweentheprocessors.Theycommunicatewith
eachotherthroughvariouscommunicationlines.
29 ExplainDMAindetail.
Ans


For devices that transfer large quantities of data ( such as disk controllers ), it is
wastefultotieuptheCPUtransferringdatainandoutofregistersonebyteatatime.
Instead this work can be offloaded to a special processor, known as theDirect
MemoryAccess,DMA,Controller.
ThehostissuesacommandtotheDMAcontroller,indicatingthelocationwherethe
dataislocated,thelocationwherethedataistobetransferredto,andthenumber
ofbytesofdatatotransfer.TheDMAcontrollerhandlesthedatatransfer,andthen
interruptstheCPUwhenthetransferiscomplete.
A simple DMA controller is a standard component in modern PCs, and manybus
masteringI/OcardscontaintheirownDMAhardware.
Handshaking between DMA controllers and their devices is accomplished through
twowirescalledtheDMArequestandDMAacknowledgewires.
WhiletheDMAtransferisgoingontheCPUdoesnothaveaccesstothePCIbus(
includingmainmemory),butitdoeshaveaccesstoitsinternalregistersandprimary
andsecondarycaches.
DMAcanbedoneintermsofeitherphysicaladdressesorvirtualaddressesthatare
mapped to physical addresses. The latter approach is known asDirect Virtual
MemoryAccess,DVMA,andallowsdirectdatatransferfromonememorymapped
devicetoanotherwithoutusingthemainmemorychips.
Direct DMA access by user processes can speed up operations, but is generally
forbidden by modern systems for security and protection reasons. ( I.e. DMA is a
kernelmodeoperation.)
FigureillustratestheDMAprocess.

Vous aimerez peut-être aussi