Professional Documents
Culture Documents
Shell
Operating
System
CPU Memory
Video Card Network
Monitor Disk Printer
Why is abstraction important?
• Without OSs and abstract interfaces, application writers
must program all device access directly
– load device command codes into device registers
– understand physical characteristics of the devices
• Applications suffer!
– very complicated maintenance and upgrading
– no portability
What Operating Systems Do
(User’s view)
Depends on the point of view
•Single user system
•Users want convenience, ease of use
– Don’t care about resource utilization
• OS is a control program
– Controls execution of programs to prevent
errors and improper use of the computer
Concept of Process
• Process
– Program loaded in memory and in execution
• Program is a passive entity
• Process is an active entity
10
Stages of a Process
System boot
Hence we have
1.Process management
2.Memory management
3.File management
4.I/O management
Process Management
• A process is a program in execution. Program is a
passive entity, process is an active entity.
• Process needs resources to accomplish its task
– CPU time
• Representation of process
– Process has one program counter specifying location of next
instruction to execute
– Data structure (stores information of a process)
• Many processes may be associated with the same
program
• Typically system has many processes
– some user processes,
– some operating system processes
• Life cycle of a process
– States
– Arrival, Computation, I/O, I/O completion, termination
Process Management Activities
The operating system is responsible for the following activities in
connection with process management:
Process Memory
Management Unit
• Process terminates => MMU declares that the memory space is available
• Multiprogramming: Memory management manages several processes in
memory
– Optimizing CPU utilization and computer response to users
• Ensure memory protection
– Track illegal address
• Memory management activities
– Keeping track of which parts of memory are currently being used and by which
process
– Allocating and deallocating memory space as needed
• Introduces Virtual memory
– If the process size is bigger than the RAM size
• Hardware support
File Management
• OS provides uniform, logical view of information storage
– Abstracts physical properties to logical storage unit - File
– File => Collection of related information defined by the creator
– Each medium is controlled by device (i.e., disk drive, tape
drive)
• Varying properties include access speed, capacity, data-
transfer rate, access method (sequential or random)
User
Files (user’s
view)
Device Driver Mapping
Disk
Physical (sector,
media track)
File Management
• OS provides uniform, logical view of information storage
– Abstracts physical properties to logical storage unit - file
– Each medium is controlled by device (i.e., disk drive, tape drive)
• Varying properties include access speed, capacity, data-transfer rate,
access method (sequential or random)
I/O devices
Operating Systems
• Basics of Operating Systems
Working of Operating System
Stage-1
Any program is stored as an
executable file in C:/ Drive
Stage-4
Stage-2 OS submits one
OS loads the file in Main process at a time
Hard Disk
Memory to CPU
C:/
RAM as Main Memory(M/M) CPS as
D:/
Ready Queue Processor
E:/ (Executes on
P 1 P2 P-2 P-1 process at a
F:/ time to give
desired output
to a user)
Stage-3
1.File gets converted in to process in M/M
by operating system
2.Process gets scheduled inside Ready
Queue of Main Memory. This activity is
know as Process Scheduling
Functions of Operating System
• Memory Management
• Process Management
• Management of File system
• Device Management
• Misc Activities
Functions of Operating System
Memory Management
• MM(RAM) is managed by the OS
• MM- stores user programs or job requests in the
form of processes
• ROM-stores inbuilt programs
• Program needs to be loaded into main memory for
execution
• Activities in Memory management are:
– Tracking part of used and Unused memory
– Allocate/reserve memory space of a process from
main memory when if requests to do so.
– To de-allocate/release memory space of the process
from main memory when the memory space is not
from the process or a CPU has completed execution
Functions of Operating System
Process Management
• In multiprogramming (also called multitasking),
several processes are all loaded into memory
and available to run.
• OS has to duty to identify process to be
loaded next.
– Time to load and Duration
– This is know as Scheduling
• Activities in Process management are:
– Tracks each process and the status of each
process
– Controls the processor to perform execution
– Frees the processor after completion of task
Functions of Operating System
Management of File System
• OS organizes the file system into directory
for easy navigation
• Activities :
– Tracks information , locations, status and
uses of a file& folder under a directory
– Controls which files is allocated to which
resources, at what time and for how long
– Frees the file from the process after
completion of task
Functions of Operating System
Device Management
• OS manages communication of each device
through their corresponding drivers
• Activities :
– It keeps rack of all computer system devices through
–I/O Controller
– It has to make sure device which process, at what
time and for how long
– It provides an interface to the process of the desired
device for execution in an effective manner
– It frees the device from the process once a process
finishes execution
Functions of Operating System
Misc Activities
– Accounting information : It keeps track of time and
resources used by various processes and users
– Security: many techniques to protect data and
programs from unauthorized usage
– Monitors Performance of Systems: tracks request-
response delays of any kind occurring within the
system.
– Coordination between user and software : achieves
this by using-Complier, interpreter, assembler, etc.,
– Error Detection mechanism: traces, dumps, error
messages, along with debugging tools.
History of Operating System
The First Generation (1940's to early 1950's )
No Operating System
All programming was done in absolute machine language, often by wiring up plug-
boards to control the machine’s basic functions.
The Second Generation (1955-1965)
First operating system was introduced in the early 1950's.It was called GMOS
Created by General Motors for IBM's machine the 701.
Single-stream batch processing systems
• Extension of Multiprogramming
– Need for user interactivity
– Instead of switching jobs when waiting for IO, a timer causes
jobs to switch
• User interacts with computer via CRT and keyboard
– Systems have to balance CPU utilization against response time
– Better device management
• Need for file system to allow user to access data and code
• Need to provide user with an “interaction environment”
Time Sharing Operating system from IBM Museum
5 Gen Parallel Systems
th
• Characteristics
1. One program is selected by the OS, out of the many in memory for
execution
2. Whenever an I/O operation is required by a program, the OS switches
from the current job, to perform that operation.
3. NOTE: The number of jobs on disk are always greater than that of the
main memory
4. CPU Scheduling is performed by the OS, when several jobs are ready
for execution simultaneously
5. Multiprogramming OS, does not sit idle, the processor is always busy.
As a result the CPU utilization improves, and hence the performance of
the system improves
• Time sharing is an extension on Multiprogramming OS
3. Time-Sharing(or Multi-Tasking OS)
Operating Systems
• Key goal of Multiprogramming maximizing CPU utilization
• This is improved in Time sharing systems, where minimizing response time
is a concern.
• Execute multi jobs through frequently switching, may lead to immediate
response time.
• Time Quantum
3. Time-Sharing Operating Systems cont..
Basic Each processor run the tasks in Only Master processor run the
Operating System. tasks of Operating System.
Process Processor takes processes Master processor assign processes
from a common ready queue, to the slave processors, or they
or there may be a private ready have some predefined processes.
queue for each processor.
Architecture All processor in Symmetric All processor in Asymmetric
Multiprocessing has the same Multiprocessing may have same or
architecture. different architecture.
Communication All processors communicate Processors need not communicate
with another processor by a as they are controlled by the
shared memory. master processor.
Failure If a processor fails, the If a master processor fails, a slave
computing capacity of the is turned to the master processor to
system reduces. continue the execution. If a slave
processor fails, its task is switched
to other processors.
Ease Symmetric Multiprocessor is Asymmetric Multiprocessor is
complex as all the processors simple as master processor access
need to be synchronized to the data structure.
maintain the load balance.
5. Distributed Operating System
• Various interconnected computers communicate with each other using a
shared communication network.
• Independent systems possess their own memory unit and CPU.
• These are referred to as loosely coupled systems.
• Examples:- Locus, DYSEAC
5. Distributed Operating System
• Benefits
– Fast processing Speed
– Need not be physically at same place
– Load Distribution
– Cheaper than Multi processor
Parallel Vs Distributed Computing
6. Network Operating System
• These systems run on a server and provide the capability
to manage data, users, groups, security, applications, and
other networking functions.
• These types of operating systems allow shared access of
files, printers, security, applications, and other networking
functions over a small private network.
• The “ other" computers arc called client computers, and
each computer that connects to a network server must be
running client software designed to request a specific
service.
6. Network Operating System
6. Network Operating System
• Essential Services
– Execution of Basic programs and Processes
– Carrying out Input and Output Operations
– Management of File System
– For Ensuring Proper process communication
– Detecting and Resolving System Errors
– Allocation of Resources
– System Protection and Security
– Tracking System opreations
System Calls
• Definition: Systems Calls provide an
interface between the process and the
operrating System
• Eg:
• Models involved in System Calls
– User Mode/Supervisor Mode
– Kernel Mode/Monitor Mode
System Calls
• Programming interface to the services
provided by the OS
• Typically written in a high-level language (C
or C++)
• Mostly accessed by programs via a high-level
Application Program Interface (API)
• Three most common APIs are
– Win32 API for Windows,
– POSIX API (all versions of UNIX, Linux, and Mac
OS X), and
– Java API for the Java virtual machine (JVM)
System Calls: Example
• Standard C
• As an example, let's
assume a C program
invokes printf() statement.
• The C library intercepts
this call and invokes the
necessary system call(s)
in the OS.
• The C library takes the
value returned
by write() and passes it
back to the user program
Categories of System Calls
1. Process Management
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
1) Process Control
• end, abort
• load, execute
• create process, terminate process
• get process attributes, set process
attributes
• wait for time
• wait event, signal event
• allocate and free memory
File Management
• create file, delete file
• open, close
• read, write, reposition
• get file attributes, set file attributes
Device Management
• request device, release device
• read, write, reposition
• get device attributes, set device attributes
• logically attach or detach devices
Information Maintenance
• get time or date, set time or date
• get system data, set system data
• get process, file, or device attributes
• set process, file, or device attributes
Communication
• create, delete communication connection
• send, receive messages
• transfer status information
• attach or detach remote devices
Operating System Structure
• Architecture of OS principle:
Principle of Separation of concerns
• Should be divided into relatively independent parts with
specific individual features
Operating System Structure
• General-purpose OS is very large
program
• Various ways to structure ones
– Simple structure – MS-DOS
– More complex -- UNIX
– Layered – an abstrcation
– Microkernel -Mach
Simple Structure -- MS-DOS
• MS-DOS – written to
provide the most
functionality in the least
space
– Not divided into modules
– Although MS-DOS has
some structure, its
interfaces and levels of
functionality are not well
separated
Non Simple Structure -- UNIX
UNIX – limited by hardware functionality, the original
UNIX operating system had limited structuring. The
UNIX OS consists of two separable 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 large number of functions
for one level
Traditional UNIX System Structure
Beyond simple but not fully layered
Layered Approach
• The operating system is divided
into a number of layers (levels),
each built on top of lower layers.
The bottom layer (layer 0), is the
hardware; the highest (layer N) is
the user interface.