Operating Systems
MS. UMA.S
ASSISTANT PROFESSOR
COMPUTER SCIENCE/COMPUTER APPLICATIONS
THIRUVALLUVAR UNIVERSITY COLLEGE OF ARTS AND SCIENCE
TIRUPATTUR – 635901
Unit I
Operating Systems Basics
Unit I
Basic Concepts of Operating System
Services of Operating System
Classification of Operating System
Architecture and Design of an Operating System
Process Management
Introduction to Process-Process State
PCB
Process Scheduling
Interprocess Communication
Basic Concepts of Operating Systems
Introduction
Definition – OS
Goals of OS
Basic Concepts of OS-Introduction
OPERATING SYSTEMS – OS
An important part of almost every computer systems
A computer system can be divided into 4 components
The hardware
Operating system
Application programs
User
Basic Concepts of OS-Introduction
Hardware - CPU, memory and I/O devices –
Provides the basic computing resources
Application Programs - compilers, database
systems, games and business programs
Define the ways in which these resources are used
to solve the computing problems of the users.
Basic Concepts of OS-Introduction
Users
Many different users –people, machines, other
computers
Trying to solve different problems
Accordingly there may be many different applications
Basic Concepts of OS-Introduction
Operating System – controls and coordinates
the use of the hardware among the various
application programs for the various users
Basic Concepts of OS-Introduction
OS – Government
Components of the computer systems
Hardware
Software
Data
OS provides the means for the proper use of these
resources in the operation of the computer system
Basic Concepts of OS-Introduction
Like government – OS provides no useful
function by itself.
It simply provides an environment within which
other programs can do useful work
Basic Concepts of OS-Introduction
OS- viewed as an resource allocator
Computer system has many resources that may be required to
solve a problem
CPU time
Memory space
File storage spaces
I/O devices …
Basic Concepts of OS-Introduction
OS acts as a manager of these resources and allocates
them to specific programs and users
OS decides which requests are allocated resources to
operate the computer system efficiently and fairly
Basic Concepts of OS-Introduction
OS – control program
OS – focuses on the need to control the various
I/O devices and user programs
Basic Concepts of OS-Introduction
Control Program controls the execution of user
programs to prevent error and improper use of
the computer.
Concerns with the operation and control of
I/O devices.
Basic Concepts of OS-Introduction
Fundamental goal of computer systems is
To execute user programs and to make solving user
problems easier
Towards this goal, computer hardware is constructed.
Since bare hardware alone is not particularly easy to
use; applications programs are developed.
Basic Concepts of OS-Introduction
These various programs require certain common
operations
Controlling the I/O devices
The common functions of controlling and allocating
resources – done by OS
Basic Concepts of OS-Introduction
Definition
Is a program that acts as an intermediary between a user of a
computer and the computer hardware
Purpose of OS
To provide an environment in which a user can execute programs
Two Goals of OS
Primary Goal
Secondary Goal
Basic Concepts of OS-Introduction
Primary Goal :
To make the computer system convenient to use.
[convenience for the user]
Secondary Goal :
To use the computer hardware in an efficient manner.
[Efficient operation of computer system]
Services of Operating System
OS provides an environment for the execution of
program
OS services are provided for the convenience of the
programmer to make the programming task easier.
Services of Operating System
Program Execution :
System must be able to load a program into
memory and to run it.
Program must be able to end its execution either
normally or abnormally
Services of Operating System
I/O Operations :
A running program may require I/O
I/O may involve a file or an I/O device,
Specific devices may require special function.
File-System Manipulation :
Programs need to read and write files, create and
delete files by name.
Services of Operating System
Communication :
One process needs to exchange information with
another process.
Two major ways in which communication occurs
1) Communication takes place between processes executing
on the same computer
2) Communication takes place between processes executing
on different computer system through computer network
Services of Operating System
Communications may be implemented via
Shared Memory or
Message passing
Services of Operating System
Error detection
OS needs to be aware of possible errors.
Errors may occur in the
CPU
Memory hardware
I/O devices
User Programs
For each type of error, OS should take the appropriate action to ensure
correct and consistent computing
Services of Operating System
Resource Allocation
Many different types of resources are managed by the
OS.
When there are multiple users or multiple jobs
running at the same time, resources must be
allocated to each of them
Services of Operating System
Accounting
To keep track
which users used
how much and what kinds of computer resources
Record keeping may be for
Accounting or accumulating usage statistics. (to improve
the computing services)
Services of Operating System
Protection
When several disjoint processes execute concurrently
it should not be possible for one process to interfere with the
other or with the OS itself
Protection involves ensuring that all access to system
resources is controlled.
Security from outsiders is also important
Requires authentication - Passwords
Classification of Operating System
Simple batch Systems
Multiprogrammed Batched Systems
Time-Sharing Systems
Multiprocessor System
Distributed Operating Systems
Real Time Operating Systems
Simple Batch Systems
In this type of system, there is no direct interaction
between user and the computer.
Each user prepares his job on an off-line device like
punch cards and submits it to the computer operator.
To speed up processing, jobs with similar needs are
batched together and run as a group.
Then a special program, the monitor, manages the
execution of each program in the batch.
Simple Batch Systems
In early computers, OS was fairly simple
Major task : transfer control automatically from
one job to the next
OS was always resident in the memory
Simple Batch Systems
Disadvantanges
In this execution environment,
the CPU is often idle because the speeds of the I/O
devices are much slower than the speed of the CPU.
User has no direct interaction with the system.
Waiting time is more for a user/program.
No mechanism to prioritize processes.
Simple Batch systems – Memory Layout
Multiprogrammed Batched Systems
Multiprogramming is a technique to execute number of programs
simultaneously by a single processor.
In multiprogramming, number of processes resides in main memory
at a time.
The OS picks and begins to execute one of the jobs in main memory.
If any I/O wait happened in a process, then CPU switches from that
job to another job.
Multiprogrammed Batched Systems
Hence in Multiprogramming system, CPU will
never be idle and keeps on processing.
If several jobs are ready to run at the same
time, then system chooses which one to run
(using CPU Scheduling).
Multiprogrammed Batched Systems
Advantages
Efficient memory utilization
Throughput increases
CPU is never idle, so performance increases.
Waiting time is limited in multiprogramming.
Multiprogrammed Batched Systems
Disadvantages
User can not interact directly with the system.
Multiprogrammed Batched Systems
JOB SCHEDULING
If several jobs are ready to be brought into memory
and when there is not enough room for all of them,
then the system must choose among them.
Making this decision is job scheduling
Multiprogrammed Batched Systems
CPU SCHEDULING
If several jobs are ready to run at the same time, the system
must choose among them.
Making this decision is CPU scheduling
Time-Sharing Systems
Multiprogramming systems provide an environment
in which various system resources like CPU,
memory, I/O devices were utilized effectively.
Does not provide user interaction with the computer
system.
Time-Sharing Systems
Time sharing or multitasking is a logical
extension of multiprogramming.
user interacts with the system.
Time-Sharing Systems
Multiple jobs are executed by switching the CPU
between them
The switches occur so frequently that users can interact with
each program while it is running and
User can assume that he is only working on the system, but
actually CPU is shared among different users.
Time-Sharing Systems
CPU time is shared by different processes - system is
called as time sharing system.
The CPU scheduler selects a job from the ready queue and
switches the CPU to that job. When the time slot expired,
the CPU switches from this job to another job.
The time slice is given by the OS for sharing CPU time
between processes.
Time-Sharing Systems
Time sharing system uses
CPU scheduling
Multiprogramming
Memory management scheme
UNIX is a time shared system.
Time-Sharing Systems
Advantages
The main advantage of time sharing system over
the batch system is,
the user can interact with the job while it is
executing, but it is not possible in batch system.
Efficient CPU utilization
Time-Sharing Systems
Disadvantages
As numbers of users are interacting with the processor at the same time,
it is complex than multiprogrammed OS.
System must have memory management and protection, since several jobs are
kept in memory at the same time.
Disk management is also required.
It provides mechanism for concurrent execution which requires complex CPU
scheduling scheme.
Multiprocessor System or Parallel Systems
Single processor systems have only one CPU, however in
multiprocessor system have more than one processor.
These systems are also known as parallel systems or tightly
coupled systems.
Multiprocessor System or Parallel Systems
Here the processors share
Computer Bus
Memory
Clock
Peripheral Devices
Multiprocessor System or Parallel Systems
It is called parallel system, because numbers of processors are executing
their jobs in parallel.
A multiprocessor OS controls and manages hardware and software resources
such that user can view the entire system as a powerful uniprocessor
system as he is not aware of multiprocessor system and interconnection
network.
Multiprocessor System or Parallel Systems
Graceful degradation
Ability to continue providing service to the level of surviving
hardware
Fault-tolerant
Systems designed for graceful degradation
Multiprocessor System or Parallel Systems
The major issues of Multiprocessor OS are
Process synchronization
Task scheduling
Memory management
Security and protection,
since main memory is shared among many physical processors.
Multiprocessor System or Parallel Systems
Multiprocessor systems can be
Symmetric Multiprocessing System
Each processor runs an identical copy of the OS and
these copies communicate with one another as
needed.
Multiprocessor System or Parallel Systems
Asymmetric Multiprocessing Systems
Each processor is assigned a specific task
A master processor controls the system, others gets instruction
from master
Master-Slave relationship
Master Processor Schedules and allocates work to the slave
processors
Multiprocessor System or Parallel Systems
Advantages
Increased throughput
Economy of scale
Increased reliability
Distributed Operating System
Distributed OS are the OS for a network of autonomous
computers, connected by a communication network, that
follows message passing mechanism.
In this system, processors cannot share memory or clock. Each
processor has its own local memory.
The processors communicate with one another through various
communication lines such as high speed bus.
Loosely Coupled Systems
Distributed Operating System
A distributed OS controls and manages the software and
hardware resources of a distributed system.
When a program is executed on a distributed system, user is not
aware of where the program is executed, on which location etc..
Processor in Distributed System varies in
Size and function
Distributed Operating System
Processors are referred by different names
Sites
Nodes
computers
Distributed Operating System
The basic design issue of distributed operating system
is:
Process Synchronization
Deadlock
Inter process communication
Memory Management
CPU scheduling
Distributed Operating System
Nearly all systems today are distributed in some
way i.e.
They use email
Access files over a network
Receive audios and videos etc.
Examples of distributed OS are Alpha, Amoeba,
Mach etc.
Distributed Operating System
Advantages
Resource sharing
Computation Speedup
Reliability
Communication
Distributed Operating System
Resource Sharing
Sharing of files at remote sites
Processing information in a distributed DB
Printing files at remote sites
Distributed Operating System
Computation Speedup
Computation – partitioned into a number of Sub
computations
Runs Concurrently
If any site is currently overloaded with jobs, some of
them may be moved to other, lightly loaded sites
Load Sharing
Distributed Operating System
Reliability
If one site fails in a distributed systems,
the remaining sites can continue operating.
Distributed Operating System
Communication
Processes at different sites can exchange
information
Real-Time Operating System
Real-time systems is used when there are
rigid time requirements on the operation of
a processor or the flow of data.
Used as a control device in a dedicated
application
Real-Time Operating System
Systems that control
scientific experiment
Medical imaging systems
Industrial control systems
Fuel-injection systems
Home-Appliances controllers
Weapon Systems
Real-Time Operating System
Real-time systems are defined as those systems in
which
the correctness of the system
depends
not only on the logical result produced,
But
also the time at which the result produced.
Real-Time Operating System
RT System is considered to function correctly
only if it returns the correct result within any
time constraints
Real-Time Operating System
User convenience and resource utilization are
secondary concern to these systems.
Real time systems have many events that must
be accepted and processed in a short time or
within certain deadline.
Real-Time Operating System
RTOS – has well-defined constraints or the system
will fail.
RT System is considered to function correctly
only if it returns the correct result within any
time constraints
Real-Time Operating System
Such applications include:
Rocket lunching
Flight control
Robotics
Telephone switching equipment
Fire and smoke sensor etc.
Real-Time Operating System
Real-time systems are classified into
two categories:
Hard Real-Time System
Soft Real-Time System
Hard Real-Time System
A system is said to be hard real-time system if the
deadline is not met the system is said to have failed.
Examples: : Industrial control applications
On-board computers
Robots
These systems guarantee that critical tasks should be
completed on time.
Soft Real-Time System
A system is said to be soft real-time system, If a deadline is
missed, the system does not fail.
Only the performance of the system is said to have degraded.
The utility of a result decreases with time after the deadline.
Examples: Railway reservation system, video on demand system