Professional Documents
Culture Documents
A. Frank - P. Weisberg
University Institute of Engineering (UIE)
Department of Computer Science and Engineering (CSE)
What is OS?
Operating System is a software, which makes a computer to actually work.
What is OS?
Responsibilities of an Operating
System
There are three basic responsibilities (in literature):
1. Resource Manager manages and allocates resources.
2. Control program controls the execution of user programs and operations
of I/O devices.
3. Command Executer Provides an environment for running user
commands.
But one more modern view: the Operating System as a Virtual Machine.
Operating-System Structure
General-purpose OS is very large program
Various ways to structure ones
Simple structure MS-DOS
More complex -- UNIX
Layered an abstraction
Microkernel -Mach
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.
Main advantage of layered approach is
Modularity.
With modularity, layers are selected such
that each uses functions (operations) and
services of only lower-level layers.
The major difficulty with layered
approach is to divide the layers carefully,
because a layer can use only those layers
which are below it.
Process Management
A process is a program in execution. It is a unit of work within the
system. Program is a passive entity, process is an active entity.
Process needs resources to accomplish its task
CPU, memory, I/O, files
Initialization data
Process termination requires reclaim of any reusable resources
Single-threaded process has one program counter specifying location
of next instruction to execute
Process executes instructions sequentially, one at a time, until
completion
Multi-threaded process has one program counter per thread
Typically system has many processes, some user, some operating system
running concurrently on one or more CPUs
Concurrency by multiplexing the CPUs among the processes /
threads
Memory Management
To execute a program all (or part) of the instructions must be in memory
All (or part) of the data that is needed by the program must be in memory.
Memory management determines what is in memory and when
Optimizing CPU utilization and computer response to users
Storage 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)
File-System management
Files usually organized into directories
Access control on most systems to determine who can access what
OS activities include
Creating and deleting files and directories
Primitives to manipulate files and directories
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
File-System Management
File-System management
Files usually organized into directories
Access control on most systems to determine who can access what
OS activities include
Creating and deleting files and directories
Primitives to manipulate files and directories
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
I/O Subsystem
One purpose of OS is to hide peculiarities of hardware devices from the user
I/O subsystem responsible for
Memory management of I/O including buffering (storing data temporarily
while it is being transferred), caching (storing parts of data in faster
storage for performance), spooling (the overlapping of output of one job
with input of other jobs)
General device-driver interface
Drivers for specific hardware devices
OS challenges
Reliability
Does the system do what it was designed to do?
Availability
What portion of the time is the system working?
Mean Time To Failure (MTTF), Mean Time to Repair
Security
Can the system be compromised by an attacker?
Privacy
Data is accessible only to authorized users
OS challenges
Performance
Latency/response time
How long does an operation take to complete?
Throughput
How many operations can be done per unit of time?
Overhead
How much extra work is done by the OS? Fairness
How equal is the performance received by different users?
Predictability
How consistent is the performance over time?
Portability
For programs:
Application programming interface (API)
For the kernel
Hardware abstraction layer
In early days, computer work was given on punch cards and then these punch cards
behave as input to the computer.
These jobs or batch jobs were then executed by the computer one by one. So that
computers were called as batch computers or batch systems.
The work done by batch systems are in parts i.e. one job is processed then another
job in the queue is processed and so on.
The various jobs of the users are collected in a queue. This process is known as
Spooling (Simultaneous Peripheral Operations On Line).
OS
User
Program
Area
Disadvantages -
Lack of interaction between the user and job.
CPU is often idle, because the speeds of the mechanical I/O devices is slower than
CPU.
Difficult to provide the desired priority.
Multiprogrammed Systems
This allows to execute multiple programs.
In this, several processes are kept in memory (set of jobs are kept in Job Pool) & CPU
execute all these processes concurrently.
When one process start performing I/O operations , the CPU is allocated to another user
process in the main memory that is ready to use the CPU.
Multiprogrammed Systems
Advantages
It increases CPU utilization.
It increases throughput also by utilizing idle time of CPU for running other
programs that are already present in main memory.
It lowers the Response time by recognizing the priority of a job as it enters the
system & by processing jobs on a priority basis.
Disadvantages -
It is fairly sophisticated and more complex.
A multiprogramming operating system must keep track of all kinds of jobs it is
concurrently running.
Multitasking and
Time-sharing operating systems
Disadvantages -
Problem of reliability.
Security and Integrity of user programs and data is at risk.
It consumes much resources so it need special operating systems.
Switching between tasks becomes sometimes sophisticated as there are lot of users and
applications running which may hang up the system. So the time sharing systems
should have high specifications of hardware.
Multiprocessing systems
Multiprocessing is the use of two or more central processing units (CPUs)
within a single computer system.
The term also refers to the ability of a system to support more than one
processor and/or the ability to allocate tasks between them.
Advantage -
1.Increased throughput
2.Economy of scale
3. Increased reliability
Disadvantage -
1) If one processor fails then it will affect in the speed
2) Multiprocessor systems are expensive
3) Large main memory required.
Distributed systems
Distributed systems use multiple central processors to serve multiple real time
application and multiple users.
Data processing jobs are distributed among the processors accordingly to which
one can perform each job most efficiently.
Processors in a distributed system may vary in size and function. These processors
are referred as sites, nodes, computers and so on.
Distributed systems
Advantages
Speedup the exchange of data with one another via electronic mail.
Reduction of the load on the host computer.
Reliability (fault tolerance) - if some of the machines crash, the system can survive.
Sharing of data/resources - shared data is essential to many applications (banking,
computer- supported cooperative work, reservation systems); other resources can be
also shared (e.g. expensive printers).
Disadvantages
Complex System - Distributed systems are much more complex to setup and
difficult to maintain.
Security problems - sharing generates the problem of data security.
Networking problems: several problems are created by the network infrastructure,
which have to be dealt with: loss of messages, overloading, ...
There is no difference between the results when same problem run on different
occasion on same machine.
Real System is always on line whereas on line system need not be real time.
Real-time systems are used when there are rigid time requirements on the operation
of a processor or the flow of data and real-time systems can be used as a control
device in a dedicated application.
Real-time operating system has well-defined, fixed time constraints otherwise system
will fail. For example Scientific experiments, medical imaging systems, industrial
control systems, weapon systems, robots, and home-applicance controllers, Air traffic
control system etc.
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 Programming
Interface (API) rather than direct system call use
Three most common APIs are Win32 API for Windows, POSIX API for
POSIX-based systems (including virtually all versions of UNIX, Linux,
and Mac OS X), and Java API for the Java virtual machine (JVM)
Note that the system-call names used throughout this text are generic
References