Upload
balajijvc
View
221
Download
0
Embed Size (px)
Citation preview
7/31/2019 Operating System Assocition
1/34
7/31/2019 Operating System Assocition
2/34
WHAT IS AN OPERATING
SYSTEM ? An operating system (OS) is a set of programs that
manage computer hardware resources and provide common
services for application software.
The operating system is the most
important type of system software in a
computer system.
A user cannot run an application program on thecomputer without an operating system
7/31/2019 Operating System Assocition
3/34
TYPES OF OPERATING
SYSTEMS
REAL-TIME
MULTI-TASKING Vs SINGLE-TASKING
MULTI-USER Vs SINGLE-USER
DISTRIBUTED
EMBEDDED
7/31/2019 Operating System Assocition
4/34
Computer System Structure
Computer system can be divided into four components
Hardware provides basic computing resources CPU, memory, I/O devices
Operating system Controls and coordinates use of hardware among various
applications and users
Application programs define the ways in which thesystem resources are used to solve the computingproblems of the users
Word processors, compilers, web browsers, database systems,video games
Users People, machines, other computers
7/31/2019 Operating System Assocition
5/34
Four Components of a ComputerSystem
7/31/2019 Operating System Assocition
6/34
Operating System Definition
OS is a resource allocator Manages all resources
Decides between conflicting requests forefficient and fair resource use
OS is a control program Controls execution of programs to prevent
errors and improper use of the computer
7/31/2019 Operating System Assocition
7/34
No universally accepted definition
Everything a vendor ships when you order anoperating systemis good approximation
But varies wildly
The one program running at all times on thecomputeris the kernel. Everything else iseither a system program (ships with theoperating system) or an application program
7/31/2019 Operating System Assocition
8/34
Computer-System Operation
I/O devices and the CPU can execute concurrently. Each device controller is in charge of a particular
device type. Each device controller has a local buffer. CPU moves data from/to main memory to/from
local buffers I/O is from the device to local buffer of controller.
Device controller informs CPU that it has finished itsoperation by causing an interrupt.
7/31/2019 Operating System Assocition
9/34
Operating-System Structures
Simple Structure
MS-DOS Layer Structure
Layered Approach UNIX
Microkernel system Structure
Modules
7/31/2019 Operating System Assocition
10/34
Simple Structure
MS-DOS written to provide the mostfunctionality in the least space
Not divided into modules Although MS-DOS has some structure, its
interfaces and levels of functionality are
not well separated
7/31/2019 Operating System Assocition
11/34
MS-DOS Layer Structure
7/31/2019 Operating System Assocition
12/34
Layered Approach
The operating system is divided into anumber of layers (levels), each built on top oflower layers. The bottom layer (layer 0), isthe hardware; the highest (layer N) is theuser interface.
With modularity, layers are selected suchthat each uses functions (operations) andservices of only lower-level layers
7/31/2019 Operating System Assocition
13/34
Layered Approach Structure
7/31/2019 Operating System Assocition
14/34
UNIX
UNIX limited by hardware functionality, theoriginal UNIX operating system had limitedstructuring. The UNIX OS consists of twoseparable parts
Systems programs The kernel
Consists of everything below the system-call interface and
above the physical hardware Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a largenumber of functions for one level
7/31/2019 Operating System Assocition
15/34
UNIX System Structure
7/31/2019 Operating System Assocition
16/34
Microkernel System Structure
In computer science, a microkernel is the near-minimum amount of software that can provide themechanisms needed to implement an operating
systems. Benefits:
Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode)
More secure Detriments:
Performance overhead of user space to kernel spacecommunication
7/31/2019 Operating System Assocition
17/34
Modules
Most modern operating systems implementkernel modules Uses object-oriented approach
Each core component is separate
Each talks to the others over known interfaces
Each is loadable as needed within the kernel
Overall, similar to layers but with moreflexible
7/31/2019 Operating System Assocition
18/34
Process management is an integral part of any modern day
operating system (OS). The OS must allocate resources toprocesses ,enable processes to share and exchangeinformation, protect the resources of each process from otherprocesses and enable synchronization among processes.
Process Concept Process Scheduling Operations on Processes Co-operating Processes Interprocess Communication
Communication in Client-Server Systems
Processes
7/31/2019 Operating System Assocition
19/34
Process Concept
An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks
Textbook uses the termsjob and process almostinterchangeably Process a program in execution; process execution
must progress in sequential fashion A process includes:
program counter
Stack data section
7/31/2019 Operating System Assocition
20/34
Process State
As a process executes, it changes state
new: The process is being created
running: Instructions are being executed
waiting: The process is waiting for some eventto occur
ready: The process is waiting to be assigned to aprocessor
terminated: The process has finished execution
7/31/2019 Operating System Assocition
21/34
Diagram of Process State
7/31/2019 Operating System Assocition
22/34
Process Control Block (PCB)
Information associated with each process Process state
Program counter CPU registers
CPU scheduling information
Memory-management information Accounting information
I/O status information
7/31/2019 Operating System Assocition
23/34
7/31/2019 Operating System Assocition
24/34
Process Scheduling Queues
Job queueset of all processes in the system Ready queueset of all processes residing in
main memory, ready and waiting to execute Device queues
set of processes waiting for
an I/O device Processes migrate among the various queues
7/31/2019 Operating System Assocition
25/34
Schedulers
Long-term scheduler(or job scheduler) selects which processes should bebrought into the ready queue
Short-term scheduler(or CPU scheduler)selects which process should beexecuted next and allocates CPU
7/31/2019 Operating System Assocition
26/34
Short-term scheduler is invoked very frequently (milliseconds)(must be fast)
Long-term scheduler is invoked very infrequently (seconds,
minutes)
(may be slow)
The long-term scheduler controls the degree of multiprogramming
Processes can be described as either: I/O-bound processspends more time doing I/O than computations,
many short CPU bursts CPU-bound processspends more time doing computations; few very
long CPU bursts
7/31/2019 Operating System Assocition
27/34
Process Creation
Parent process create children processes, which, in turn create otherprocesses, forming a tree of processes Resource sharing
Parent and children share all resources Children share subset of parents resources Parent and child share no resources
Execution Parent and children execute concurrently Parent waits until children terminate
Address space Child duplicate of parent Child has a program loaded into it
UNIX examples fork system call creates new process execsystem call used after a fork to replace the process 'memory space
with a new program
7/31/2019 Operating System Assocition
28/34
Process Termination
Process executes last statement and asks the operatingsystem to delete it (exit) Output data from child to parent (via wait)
Process 'resources are deal located by operating system Parent may terminate execution of children processes
(abort) Child has exceeded allocated resources Task assigned to child is no longer required
If parent is exiting ome operating system do not allow child to continue if its parent
terminates All children terminated -cascading termination
7/31/2019 Operating System Assocition
29/34
Deadlocks
A deadlock is a situation wherein two or morecompeting actions are each waiting for the other tofinish, and thus neither ever does.
The Deadlock Problem
System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention
Deadlock Avoidance Deadlock Detection Recovery from Deadlock
7/31/2019 Operating System Assocition
30/34
The Deadlock Problem
Waiting to acquire a resource held by another processin the set.
Example
System has 2 disk drives. P1 and P2 each hold one disk drive and each needs another one.
Example semaphoresA and B, initialized to 1
P0 P1wait (A); wait(B)wait (B); wait(A)
7/31/2019 Operating System Assocition
31/34
Methods for Handling Deadlocks
Ensure that the system will never enter adeadlock state.
Allow the system to enter a deadlock stateand then recover.
Ignore the problem and pretend that
deadlocks never occur in the system; usedby most operating systems, includingUNIX.
7/31/2019 Operating System Assocition
32/34
Deadlock Prevention
.
Mutual Exclusionnot required for sharableresources;
must hold for non-sharable resources.
Hold and Waitmust guarantee that whenever aprocess requests a resource, it does not hold anyother resources. Require process to request and be allocated all its
resources before it begins execution, or allow process torequest resources only when the process has none.
Low resource utilization; starvation possible.
7/31/2019 Operating System Assocition
33/34
No Preemption
If a process that is holding some resources requestsanother resource that cannot be immediately allocated toit, then all resources currently being held are released.
Preempted resources are added to the list of resources forwhich the process is waiting.
Process will be restarted only when it can regain its oldresources, as well as the new ones that it isrequesting.
Circular Waitimpose a total ordering of all resourcetypes, and require that each process requests resourcesin an increasing order of enumeration.
7/31/2019 Operating System Assocition
34/34
Thank You..!