operating system basics including mac os

vysyarajushanmukh 39 views 64 slides Jun 29, 2024
Slide 1
Slide 1 of 64
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64

About This Presentation

operating systems basic


Slide Content

Department of
Computer Science and Engineering
OPERATING SYSTEMS
School of Computing
Vel Tech Rangarajan Dr. SagunthalaR&D Institute of
Science and Technology
Faculty Name : P.GIRIJA
UNIT -1

Department of Computer Science and Engineering
Course Content
2
UNIT I OPERATING SYSTEMS OVERVIEW 9
Operating system overview: Objectives
Functions
Computer System Organization
Operating System Structure
Operating System Operations
System Calls
System Programs

Department of Computer Science and Engineering
Learning Resources
3
and Project
Management
(SEPM)
Text Books
1.AbrahamSilberschatz,PeterBaerGalvinandGregGagne,“OperatingSystemConcepts”,9th
Edition,JohnWileyandSonsInc.,2012.
2.RichardPetersen,“Linux:TheCompleteReference”,6thEdition,TataMcGraw-Hill,2008.
Reference Books
1.AndrewS.Tanenbaum,“ModernOperatingSystems”,4thEdition,PrenticeHall,Wesley,
2014.
2.WilliamStallings,“OperatingSystems–InternalsandDesignPrinciples”,7thEdition,
PrenticeHall,2011.
3.HarveyM.Deitel,“OperatingSystems”,7thEdition,PrenticeHall,2003.
4.DMDhamdhere,“OperatingSystems:AConcept-BasedApproach”,2ndEdition,Tata
McGraw-HillEducation,2007.
5.CharlesCrowley,“OperatingSystems:ADesign-OrientedApproach”,TataMcGrawHill
Education”,1996.
Digital Resources
1.http://www.tutorialspoint.com/operating_system/
2.http://www.mu.ac.in/myweb_test/MCA%20study%20material/OS%20-%20PDF.pdf
3.http://codex.cs.yale.edu/avi/os-book/OS8/os8c/slide-dir/PDF-dir/ch2.pdf
4.http://www.freebookcentre.net/CompuScience/Free-Operating-Systems-Books-download.html
/

Department of Computer Science and Engineering
Why you need to learn os?
4
and Project
Management
(SEPM)
OSisakeypartofacomputersystem
Itisthemostimportantsoftwarethatrunsonacomputer.It
managesthecomputer’s
Memory
Processes
Software
Hardware.
Italsoallowsyoutocommunicatewiththecomputer.

Department of Computer Science and Engineering
•AnOperatingSystem(OS)isaninterfacebetweenacomputer
userandcomputerhardware.
•Anoperatingsystem(OS)issystemsoftwarethatmanages
computerhardwareandsoftwareresources,andprovidescommon
servicesforcomputerprograms.
•Anoperatingsystemisaprogramthatactsasaninterfacebetweentheuserand
thecomputerhardwareandcontrolstheexecutionofallkindsofprograms.
5
OPERATING SYSTEMS -Definition

Department of Computer Science and Engineering

Department of Computer Science and Engineering

Department of Computer Science and Engineering
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting codes
Coordination between other software and users

Department of Computer Science and Engineering
•ExecuteuserProgram&makesolvinguserproblemseasier.
•MakethecomputerSystemconvenienttouse.
•Usethecomputerhardwareinanefficientmanner.
Goals of an operating System

Department of Computer Science and Engineering
•Hardware
•Operating system
•Application programs
•Users
Four main components of Computer

Department of Computer Science and Engineering
•Hardware–providesbasiccomputingresources
•CPU,memory,I/Odevices
•Operatingsystem
•Controlsandcoordinatesuseofhardwareamongvariousapplicationsandusers
•Applicationprograms
•Definethewaysinwhichthesystemresourcesareusedtosolvethecomputing
problemsoftheusers
•Wordprocessors,compilers,webbrowsers,databasesystems,videogames
•Users
•People,machines,othercomputers
Computer system can be divided into four components:

Department of Computer Science and Engineering
Views of Operating Systems

Department of Computer Science and Engineering
•Bootstrapprogramisloadedatpower-uporreboot
•TypicallystoredinROMorEPROM,generallyknownas
firmware
•Initializesallaspectsofsystem
•Loadsoperatingsystemkernelandstartsexecution
Computer Start up

Department of Computer Science and Engineering
Computer System Organization

Department of Computer Science and Engineering
Computer System Organization
•Computer-systemoperation
•OneormoreCPUs,devicecontrollersconnectthroughcommon
busprovidingaccesstosharedmemory
•I/OdevicesandtheCPUcanexecuteconcurrently
•Eachdevicecontrollerisinchargeofaparticulardevicetype
•Eachdevicecontrollerhasalocalbuffer
•CPUmovesdatafrom/tomainmemoryto/fromlocalbuffers
•I/Oisfromthedevicetolocalbufferofcontroller

Department of Computer Science and Engineering
•DevicecontrollerinformsCPUthatithasfinisheditsoperationby
causinganinterrupt
•Interrupttransferscontroltotheinterruptserviceroutinegenerally,
throughtheinterruptvector,whichcontainstheaddressesofallthe
serviceroutines
•Interruptarchitecturemustsavetheaddressoftheinterrupted
instruction
•Atraporexceptionisasoftware-generatedinterruptcausedeitherby
anerrororauserrequest
•Anoperatingsystemisinterruptdriven
INTERRUPTS

Department of Computer Science and Engineering
INTERRUPTS

Department of Computer Science and Engineering
•The OS preserves the state of the CPU by storing registers and the
program counter
•Determines which type of interrupt has occurred:
polling
•The interrupt controller polls (send a signal out to) each device to
determine which one made the request
vectored -interrupt system
•Separate segments of code determine what action should be taken
for each type of interrupt
INTERRUPT HANDLING

Department of Computer Science and Engineering
INTERRUPT TIMELINE

Department of Computer Science and Engineering
STORAGE HIERARCHY

Department of Computer Science and Engineering
•StorageistheonlyoneofmanytypesofI/Odeviceswithinacomputer.
•AlargeportionofOScodeisdedicatedtomanagingI/O
•Becauseofitsimportanceofreliability&performance.
•ComputersystemconsistsofCPU&multipledevicescontrollersthrough
commonbus.
•Eachdevicecontrollerisinchargeofaspecifictypesofdevices.
I/O STRUCTURE

Department of Computer Science and Engineering
DEVICECONTROLLER
•Maintainslocalbufferstorage&setofSpecialpurposeregisters.
DEVICEDRIVER
•OShaveadevicedriverforeachdevicecontroller.
•Devicedriverunderstandsthedevicecontroller&givesuniforminterface
totherestoftheOS.
•Devicecontrollertransfersblocksofdatafrombufferstoragedirectlyto
mainmemorywithoutCPUintervention
•Onlyoneinterruptisgeneratedperblock,ratherthantheoneinterruptper
byte.
I/O STRUCTURE

Department of Computer Science and Engineering
DEVICECONTROLLER
CPU
ADDRESS BUS
DATA BUS
Registers Registers
LOCAL BUFFERS
MAIN MEMORY

Department of Computer Science and Engineering
•TostartanIOoperations,devicedriverloadstheappropriateregisterswithin
thedevicecontroller.
•Devicecontrollerinturnsexaminesthecontentoftheseregistersto
determinewhatactiontotake.
•Thecontrollerstartsthetransferofdatafromthedevicetoitslocalbuffer.
•Oncethetransferofdataiscomplete,thedevicecontrollerinformsthedevice
driverviaaninterruptthatithasfinisheditsoperations.
•DevicedriverthenreturnthecontroltoOS.
Issue:
•ThisformofinterruptdrivenIOisfineformovingsmallamountsofdata.
•Butcanproducehighoverheadwhenusedforbulkdatamovement.
Working of I/O operations

Department of Computer Science and Engineering
DMA(DIRECT MEMORY ACCESS)
•Tosolvetheaboveproblem,DMAisused.
•Aftersettingupbuffers,pointers&countersforIOdevices,the
devicecontrollertransfersanentireblockofdatadirectlytoorfrom
itsownbufferstoragetomemorywithoutinterventionofCPU.
•Onlyoneinterruptisgeneratedperblock,totellthedevicedriver
thattheoperationhascompleted.
•Whilethedevicecontrollerisperformingtheseoperations,CPUis
availabletoaccomplishotherworks.
Working of I/O operations

Department of Computer Science and Engineering
How a Modern Computer Works

Department of Computer Science and Engineering
OPERATING SYSTEM STRUCTURE
COMMONALITIES
MULTIPROGRAMMING
MULTI TASKING
(TIME SHARING)

Department of Computer Science and Engineering
•Multiprogramming(Batchsystem)neededforefficiency
•CapabilityofrunningmultipleprogramsbytheCPU.
•ItincreasesCPUutilizationbyorganizingjobs(codeanddata)soCPU
alwayshasonetoexecute.
•Singleprogram(user)cannotkeepCPUandI/Odevicesbusyatalltimes
•Asubsetoftotaljobsinsystemiskeptinmemory
•Onejobselectedandrunviajobscheduling
•Whenithastowait(forI/Oforexample),OSswitchestoanotherjob
OPERATING SYSTEM STRUCTURE
JOB
1
J
JOB
3
JOB
2
JOB
4
JOB POOL

Department of Computer Science and Engineering
•Timesharing(multitasking)islogicalextensioninwhichCPU
•switchesoccurssofrequentlythatuserscaninteractwitheachjobwhileit
isrunning,creatinginteractivecomputing
•Responsetimeshouldbe<1second
•Eachuserhasatleastoneprogramexecutinginmemoryprocess
•IfseveraljobsreadytorunatthesametimeCPUscheduling
•Ifprocessesdon’tfitinmemory,swappingmovestheminandoutto
run
•Virtualmemoryallowsexecutionofprocessesnotcompletelyin
memory
OPERATING SYSTEM STRUCTURE

Department of Computer Science and Engineering
•UNIXisapowerfulOperating
Systeminitiallydevelopedby
KenThompson,Dennis
RitchieatAT&T Bell
laboratoriesin1970.

Department of Computer Science and Engineering
•Features of UNIX Operating System

Department of Computer Science and Engineering
•Multitasking:AUNIXoperatingsystemisamultitaskingoperatingsystemthatallowsyou
toinitiatemorethanonetaskfromthesameterminalsothatonetaskisperformedasa
foregroundandtheothertaskasabackgroundprocess.
•Multi-user:UNIXoperatingsystemsupportsmorethanoneusertoaccesscomputer
resourceslikemainmemory,harddisk,tapedrives,etc
•Portability:ThisfeaturemakestheUNIXworkondifferentmachinesandplatformswith
theeasytransferofcodetoanycomputersystem.
•FileSecurityandProtection:Beingamulti-usersystem,UNIXmakesspecialconsideration
forfileandsystemsecurity.
•Communication:InUNIX,communicationisanexcellentfeaturethatenablestheuserto
communicateworldwide.Itsupportsvariouscommunicationfacilitiesprovidedusingthe
writecommand,mailcommand,talkcommand,etc.
•OpenSource:UNIXoperatingsystemisopensourceitmeansitisfreelyavailabletoall
andisacommunity-baseddevelopmentproject.
•Accounting:UNIXkeepsanaccountofjobscreatedbytheuser.
•UNIXToolsandUtilities:likecompiler,interpreter...etcforunixgrep,sed,awketc...

Department of Computer Science and Engineering
•The structure of Unix OS Layers are as follows:

Department of Computer Science and Engineering
•Interruptdriven(hardwareandsoftware)
•Hardwareinterruptbyoneofthedevices
•Softwareinterrupt(exceptionortrap):
•Softwareerror(e.g.,divisionbyzeroorinvalidmemoryaccess)
•Requestforoperatingsystemservice
•ForeachtypeofinterruptseparatesegmentofcodeintheOS
determinewhatactionshouldbetaken.
•ISR[InterruptServiceRoutine]providedtodealwithinterrupt.
•AproperlydesignedOSensurethatanincorrectormaliciousprogramcannot
causeotherprogramstoexecuteincorrectly.
Operating-System Operations

Department of Computer Science and Engineering
•Dual-modeoperationallowsOStoprotectitselfandothersystemcomponents
2 MODES OF OPERATIONS
DUAL MODE & MULTI MODE OPERATIONS
User mode
kernelmodeorSupervised
modeorprivilegedmode.

Department of Computer Science and Engineering
•Modebit
•Addedtohardwareofthecomputer.
•Toindicatethecurrentmode
•Kernel(0)
•User(1)
•Systemexecutingauserapplication–Usermode.
•UserApplicationrequestaservicefromOS(viaSystemcall).
•Systemmusttranslatefromusermodetokernelmodetofulfillthe
request.
DUAL MODE & MULTI MODE OPERATIONS

Department of Computer Science and Engineering
DUAL MODE & MULTI MODE OPERATIONS

Department of Computer Science and Engineering
•Hardwarestartsinkernelmode.
•OSisthenloaded&startsuserapplicationinusermode.
•Whenevertraporinterruptoccurs,thehardwareswitches
fromusermodetokernelmode.
•OSgainsthecontrolofcomputerinkernelmode.
•Thesystemalwaysswitchestousermodebeforepassing
controltoauserprogram.
System Boot

Department of Computer Science and Engineering
•Thehardwareallowstheseinstructionstobeexecutedonly
inkernelmode.
•Example:
•Theinstructionstoswitchtokernelmode.
•I/Ocontrol
•Timermanagement
•Interruptmanagement
Privileged Instructions(System Calls)

Department of Computer Science and Engineering
•CPUusesmorethanonebittoset&testthemode.
•CPUsupportsvirtualizationfrequentlyhaveaseparatemodeto
indicatewhentheVirtualMachineManager(VMM)&the
virtualizationmanagementsoftwareVMsisincontrolofthe
system.
•VMMhasmoreprivilegesthanuserprocessesbutfewerthanthe
kernel.
•Example
•Intel64familyofCPUsupports4privilegedlevels&virtualization
butdoesnothaveseparatemodeforvirtualization.
Beyond two modes[multi mode operations]

Department of Computer Science and Engineering
•Providestheuserprogramtoasktheoperatingsystemtoperformtasks
reservedfortheOS.
•Itisinvokedinvarietyofways.
•Usuallyittakestheformofatraptoaspecificlocationintheinterruptvector.
•Trapexecutedbyagenerictrapinstruction,syscallinstructiontoinvokea
systemcall.
•Whensystemcallisexecuted,hardwaretreateditassoftwareinterrupt.
•Controlpassesthroughinterruptvectortoaserviceroutine&modebitisset
tokernelmode.
•Thekernelexaminestheinterruptinginstructiontodeterminewhatsystem
callhasoccurred.
SYSTEM CALL

Department of Computer Science and Engineering
•Aparameterindicateswhattypeofservicetheuserprogramis
requesting.
•Additionalinformationpassedinregisters,onthestackorinmemory.
•Kernelverifiesthatparametersarecorrect&legal,executetherequest
&returnscontroltotheinstructionfollowingthesystemcall.
Nobitmode
•Lackofhardwaresupportedwithdualmodecauseseriousshort
comings.
Example
•MSDOS–IntelArchitecturehasnomodebit&nodualmode.
ExampleforDualmode
•Windows10,UNIX,Linux
SYSTEM CALL

Department of Computer Science and Engineering
•ProgramminginterfacetotheservicesprovidedbytheOS.
•Typicallywritteninahigh-levellanguage(CorC++)
SYSTEM CALLS
User Mode
Kernel
Mode

Department of Computer Science and Engineering
Examples -SYSTEM CALLS
•Systemcallsequencetocopythecontentsofonefiletoanotherfile

Department of Computer Science and Engineering
•Acquire input File name:
•To enter the file name
•2 ways are there
•Through keyboard
•Mouse
•Frequently system execute thousands of system calls per second.
Examples -SYSTEM CALLS

Department of Computer Science and Engineering
•Specifiessetoffunctionsthatareavailabletoanapplicationprogrammer,
includingparameterspassedtoeachfunctions&returnvaluesthe
programmercanexpect.
•Mostlyaccessedbyprogramsviaahigh-levelApplication
ProgrammingInterface(API)ratherthandirectsystemcall.

SYSTEM CALLS -APIs

Department of Computer Science and Engineering
Examples of Standard APIs

Department of Computer Science and Engineering
•WhyapplicationprogrammerpreferprogrammingaccordingtoAPIthan
invokingsystemcalls?
•Programportability
•ApplicationprogrammerdesignaprogramusinganAPIcanexpecther
programtocompile&runonanysystemthatsupportsthesameAPI.
SYSTEM CALLS -APIs

Department of Computer Science and Engineering
•Manyprogramminglanguagesprovidesasystemcallinterface.
•Itservesasthelinktosystemcallsmadeavailablebyoperatingsystem.
•ItinterceptsfunctioncallsintheAPI&invokesthenecessarysystemcallwritten
theOS.
•Anumberisassociatedwitheachsystemcall.
•Itmaintainsatableindexedaccordingtothesenumbers.
•ItinvokesintendedsystemcallinOSkernel&returnsstatusofthesystemcalls&
anyreturnvalues.
•Thecallerneedknownothingabouthowthesystemcallisimplemented.
•JustneedonlyobeytheAPI&understandwhatOSwilldoasaresultofsystem
call.
•MostdetailofOSinterfacehiddenfromprogrammerbyAPI.
•Managedbyruntimesupportlibrary(setoffunctionsbuiltintolibrariesincluded
withcompiler)
SYSTEM CALLS interface

Department of Computer Science and Engineering
API –System Call –OS Relationship

Department of Computer Science and Engineering
Standard C Library Example
•Cprograminvokingprintf()librarycall,whichcallswrite()systemcall

Department of Computer Science and Engineering
•Often,moreinformationisrequiredthansimplyidentityofdesired
systemcall
•ExacttypeandamountofinformationvaryaccordingtoOSandcall
•ThreegeneralmethodsusedtopassparameterstotheOS
•Simplest:passtheparametersinregisters
•Insomecases,maybemoreparametersthanregisters
•Parametersstoredinablock,ortable,inmemory,andaddressof
blockpassedasaparameterinaregister
•ThisapproachtakenbyLinuxandSolaris
•Parametersplaced,orpushed,ontothestackbytheprogramand
poppedoffthestackbytheoperatingsystem
•Blockandstackmethodsdonotlimitthenumberorlengthof
parametersbeingpassed
SYSTEM CALLS Parameter passing

Department of Computer Science and Engineering
SYSTEM CALLS Parameter passing

Department of Computer Science and Engineering
•Process control
•create process, terminate process
•end, abort
•load, execute
•get process attributes, set process attributes
•wait for time
•wait event, signal event
•allocate and free memory
•Dump memory if error
•Debuggerfor determining bugs, single step execution
•Locksfor managing access to shared data between processes
Types of System Calls

Department of Computer Science and Engineering
•File management
•create file, delete file
•open, close file
•read, write, reposition
•get and set file attributes
•Device management
•request device, release device
•read, write, reposition
•get device attributes, set device attributes
•logically attach or detach devices
Types of System Calls

Department of Computer Science and Engineering
•Information maintenance
•get time or date, set time or date
•get system data, set system data
•get and set process, file, or device attributes
•Communications
•create, delete communication connection
•send, receive messages if message passing model to host nameor
process name
•Fromclient toserver
•Shared-memory model create and gain access to memory regions
•transfer status information
•attach and detach remote devices
Types of System Calls

Department of Computer Science and Engineering
Examples of Windows and Unix System Calls

Department of Computer Science and Engineering
SYSTEM PROGRAMS

Department of Computer Science and Engineering
•Provideaconvenientenvironmentforprogramdevelopmentand
execution.
•Someofthemaresimplyuserinterfacestosystemcalls;
•othersareconsiderablymorecomplex
•Systemprogramsaredividedintofollowingcategories
•File manipulation
•Status information sometimes stored in a File modification
•Programming language support
•Program loading and execution
•Communications
•Background services
•Application programs
SYSTEM PROGRAMS -Definition

Department of Computer Science and Engineering
File management
•Create,
•delete,
•copy,
•rename,
•print,
•dump,
•list, and
•generally manipulate files and directories
SYSTEM PROGRAMS -Categories

Department of Computer Science and Engineering
Status information
•Ask the system for info
Simple information's
•date,
•time,
•amount of available memory,
•disk space,
•number of users
Complex information's
•Detailed performance,
•logging, and
•debugging information,etc.
SYSTEM PROGRAMS -Categories

Department of Computer Science and Engineering
File modification
•SeveralTexteditorsmaybeavailabletocreateandmodifythe
contentoffilesstoredondiskorotherstoragedevices.
•Specialcommandstosearchcontentsoffilesorperform
transformationsofthetext
SYSTEM PROGRAMS -Categories

Department of Computer Science and Engineering
Programming-language support
•Compilers,
•assemblers,
•debuggersand
•Interpreters
•Forsomecommonprogramminglanguages(suchasC,C++,JAVA,Visual
Basic&PERL)
•Providedtotheuserwiththeoperatingsystem.
SYSTEM PROGRAMS -Categories

Department of Computer Science and Engineering
Program loading and execution
•Once a program is assembled or compiled , it must be loaded into
memory to be executed.
•Absolute loaders,
•Relocatableloaders,
•linkage editors, and
•overlay-loaders,
•Debugging systems for higher-level or machine language are needed.
SYSTEM PROGRAMS -Categories