This material will be useful for students who are taking operating system course.
Size: 1.24 MB
Language: en
Added: Sep 12, 2020
Slides: 77 pages
Slide Content
OPERATING SYSTEMS
Prepared by,
Ms. S. Shanmuga Priya
Senior Assistant Professor,
Department of Computer Science and Engineering
New Horizon College of Engineering
Bangalore
Karnataka
MODULE 1
INTRODUCTION AND OPERATING
SYSTEM SERVICES
S. Shanmuga Priya, NHCE
INTRODUCTION
S. Shanmuga Priya, NHCE
What is an OperatingSystem?
■Operatingsystemgoals:
•Executeuserprogramsandmakesolvinguserproblemseasier
•Makethecomputersystemconvenienttouse
•Usethecomputerhardwareinanefficientmanner
■OS is a resource allocator
•Manages all resources
•Decides between conflicting requests for efficient and fair resource use
■OS is a control program
•Controls execution of programs to prevent errors and improper use of the
computer
S. Shanmuga Priya, NHCE
What is an OperatingSystem?Cont…
■Nouniversallyaccepteddefinition
■Aprogramthatactsasanintermediarybetweenauserofacomputerand
thecomputerhardware
■“Everythingavendorshipswhenyouorderanoperatingsystem”isgood
approximation
•Butvarieswildly
■“Theoneprogramrunningatalltimesonthecomputer”isthekernel.
Everythingelseiseitherasystemprogram(shipswiththeoperatingsystem)or
anapplicationprogram
S. Shanmuga Priya, NHCE
ComputerStartup
■Bootstrapprogramisloadedatpower-uporreboot
•TypicallystoredinROMorEPROM,generallyknownasfirmware
•Initializesallaspectsofsystem
•Loadsoperatingsystemkernelandstartsexecution
S. Shanmuga Priya, NHCE
Computer SystemOrganization
■Computer-system operation
•One or more CPUs, device controllers connect through common bus
providing access to shared memory
•Concurrent execution of CPUs and devices competing for memory cycles
S. Shanmuga Priya, NHCE
S. Shanmuga Priya, NHCE
Single vs Multi Processor
System
S. Shanmuga Priya, NHCE
MULTI PROCESSOR –BLADE
SERVER
S. Shanmuga Priya, NHCE
QUICK QUIZ
What is operating system?
a) collection of programs that manages hardware resources
b) system service provider to the application programs
c) link to interface the hardware and application programs
d) all of the mentioned
ANS: d
S. Shanmuga Priya, NHCE
OPERATING SYSTEM STRUCTURES
S. Shanmuga Priya, NHCE
Memory Layout for MultiprogrammedSystem
S. Shanmuga Priya, NHCE
MULTI TASKING
Multiprocessingistheabilityof
anoperatingsystemtoexecute
more than one process
simultaneouslyonamulti
processormachine.
Multitaskingistheabilityofan
operatingsystemtoexecute
more than one task
simultaneouslyonasingle
processormachine.
S. Shanmuga Priya, NHCE
OPERATING SYSTEM OPERATIONS
S. Shanmuga Priya, NHCE
TYPES OF INSTRUCTIONS
NORMAL INSTRUCTIONS PRIVILEGED INSTRUCTIONS
Example
ADD
SUB
Example
Initiate I/O
Switch state or contexts
Load/Save from protected memory
S. Shanmuga Priya, NHCE
PROBLEMS IN
MULTIPROGRAMMING SYSTEM
•Oneerroneousprogrammightmodifyanother
program,dataofanotherprogram,oreventheOS
itself.
•NeedtoensureproperexecutionofOS
•MustdistinguishbetweenOSCodeandUser-
definedCode
•Withoutprotectionagainstthesesortsoferrors,
eitherthecomputermustexecuteonlyoneprocess
atatimeoralloutputmustbesuspected
•A properlydesigned
operatingsystemmust
ensurethatanincorrect(or
malicious)programcannot
causeotherprogramsto
executeincorrectly.
S. Shanmuga Priya, NHCE
SOLUTION????
Introduce different modes while
executing instructions
S. Shanmuga Priya, NHCE
MODES
USER MODE KERNEL MODE
Processorexecutes“normal
instructions”intheuser’s
program
Processorexecutesboth“normal
andprivilegedinstructions”
Processorswitchestokernel
mode,andtheOSperformsa
service
Under user mode
Encountering Privileged Instruction
User-to-kernelswitchsavesthe
informationnecessarytocontinue
theexecutionoftheuserprocess
NOTE:
OperatingSystemisaprocessthatrunsin
kernelmode
S. Shanmuga Priya, NHCE
HOW/WHEN USER PROCESS
CAN ENTER TO KERNEL
MODE (invoke OS)?
WHEN?? HOW!!!
SYSTEMCALLS
-SoftwareInterrupts
-SetoffunctionswhichtheOSsupportsandauserprocesscouldinvokeany
ofthesystemcallstogetinformationortoaccesshardwarethatarewithinthekernel
space.
-Direct“call”fromauserprogram
-Ex:open()toopenafile,exec()torunanewprogram
S. Shanmuga Priya, NHCE
QUICK QUIZ
•To access the services of operating system, the
interface is provided by the:
•A.system calls
•B.API
•C.library
•D.assembly instructions
ANS: A
S. Shanmuga Priya, NHCE
Approach used to differentiate among various modes
of execution
DUAL-MODE OPERATION
-Used in modern OS
-Dual Mode: Helps in protecting the OS from errant
user and from one another
-Implementation : Hardware-based
Dual-Mode Operation Multi-Mode Operation
S. Shanmuga Priya, NHCE
QUICK QUIZ
•Which one of the following error will be
handle by the operating system?
•A.power failure
•B.lack of paper in printer
•C.connection failure in the network
•D.all of the mentioned
ANS: D
S. Shanmuga Priya, NHCE
Transition from User to KernelMode
ModeBitBitattachedtothehardwareofthe
computertoindicatethecurrentmode
0Kernel
1User
NeedforbitHelpstodistinguishbetweenUser
TaskorOSTask
S. Shanmuga Priya, NHCE
How transition takes place?
System Boot Time Kernel Mode (Bit = 0)
OS is loaded and starts user application User Mode (Bit = 1)
On occurrence of trap or interrupt Hardware switches
from user mode to kernel mode
USER PROGRAM
App
Operating System
system call
(write to STDOUT)
device
driver
USER PROGRAM
S. Shanmuga Priya, NHCE
SUMMARY OF DUAL MODE OPERATION
S. Shanmuga Priya, NHCE
How to prevent User Process
taking too much of Kernel Time?
Implement a Timer
Need: Used to prevent user
program from running too
long
PROBLEM???
User Process taking too much of Kernel Time
OS must maintain control over the CPU
S. Shanmuga Priya, NHCE
KERNEL DATA STRUCTURES
OBJECTIVE: To learn about the Operating System
Implementation
-the way the data are structured
in the system
S. Shanmuga Priya, NHCE
Types of Computing Environment
•Mobile Computing
•Distributed Systems
•Client-Server Computing
•Peer-to-Peer (P2P)
•Virtualization
•Cloud Computing
•Real-Time Embedded Systems
S. Shanmuga Priya, NHCE
TRADITIONAL COMPUTING
Traditional Computing
Early days Computing Current Trend Computing
PCsconnectedtoanetwork,terminals
attachedto mainframe or
minicomputersprovidingbatchand
timesharing
-Nowportalsallowingnetworkedand
remotesystemsaccesstosame
resources
-HomeNetworksUsesingle
system,withmodems,withfirewalls
S. Shanmuga Priya, NHCE
MOBILE COMPUTING
•Referstocomputingonhandheldsmartphonesandtablet
computers.
•PhysicalFeatures
–PortableandLightweight
–Historically,comparedwithdesktopandlaptop
•UniqueFeatures
–Additionalbuilt-insensors,suchasGPS(GlobalPositioning
System)Chipsusefulfornavigation
•Example,tellinguserswhichwaytowalkordriveorperhapsdirecting
themtonearbyservices,suchasrestaurants.
–Accelerometers
•Allowsamobiledevicetodetectitsorientationwithrespecttothe
groundandtodetectcertainotherforces,suchastiltingandshaking
•Usedingaming
S. Shanmuga Priya, NHCE
•Comparedwithdesktopandlaptop:
–Limitedin
•StorageCapacity,
•MemoryCapacity,and
•ComputingPower
–GaveupScreenSize
•Generallyuses
–SmallerandSlowerProcessorswithfewerprocessing
cores(thanfoundintraditionalPCs),thatconsumeless
batterypowerandproducelessheat.
MOBILE COMPUTING Cont…
S. Shanmuga Priya, NHCE
•TypicallyconnecttotheInternetusingwirelessnetworking
(IEEE802.11)orcellulartelephonetechnology
•Today,mobilesystemsareusednotonlyfore-mailandweb
browsingbutalsofor
–playingmusicandvideo,
–readingdigitalbooks,
–takingphotos,and
–recordinghigh-definitionvideo
•Twooperatingsystemscurrentlydominatemobilecomputing:
AppleiOSandGoogleAndroid.
MOBILE COMPUTING Cont…
S. Shanmuga Priya, NHCE
Cloudsmaycontain
-Thousandsofphysicalcomputers,
-Millionsofvirtualones,and
-Petabytesoftotalstorage
S. Shanmuga Priya, NHCE
REAL-TIME EMBEDDED SYSTEM
•Areal-timesystemisusedwhenrigidtime
requirementshavebeenplacedonthe
operationofaprocessorortheflowofdata;
thus,itisoftenusedasacontroldeviceina
dedicatedapplication.
•Theytendtohaveveryspecifictasks.
•Embeddedsystemsalmostalwaysrunreal-
timeoperatingsystems.
S. Shanmuga Priya, NHCE
Real-Time Embedded System Applications
Medical System
Vehicle System
S. Shanmuga Priya, NHCE
REAL-TIME EMBEDDED SYSTEM Cont…
•When to use Real-Time System?
-Used when rigid time requirements have been placed on the
operation of a processor or the flow of data;
-It is often used as a control device in a dedicated application.
•Where does data comes from? Data comes from sensors
•What do real-time system do with data? Computer must analyze the
data and possibly adjust controls to modify the sensor inputs.
TYPES
Hard Real-Time System Soft Real-Time System
Followsstricttimeconstraints,elseleads
tocatastrophiccauses,likepermanent
lossofdata
Ex: Air Bag System, Anti-Lock Brake
System
Missing time constraint is acceptable
Ex: Automatic Teller Machine (ATM)
Audio-Video Playback System
S. Shanmuga Priya, NHCE
•Applicationsandexamplesofreal-timesystems:
-appearingaspartofourcommercial,government,military,medical,
educational,andculturalinfrastructures
•Includedare
VehicleSystems-forautomobiles,subways,aircraft,railways,andships
TrafficControl-forhighways,airspace,railwaytracks,andshipping
lanes
MedicalSystems-forradiationtherapy,patientmonitoring
MilitaryUses-suchasfiringweapons,tracking,andcommandand
control
ManufacturingSystemswithrobots
HouseholdSystems-formonitoringandcontrollingappliances
REAL-TIME EMBEDDED SYSTEM Cont…
S. Shanmuga Priya, NHCE