You are on page 1of 58

Operating Systems

(10B11CI511 )
Introduction to OS-related Hardware and
Software

Grading
T1

20 Marks

T2

20 Marks

T3

35 Marks

Project
10 Marks
Attendance #
5 Marks
Assignments* +
10 Marks
Class Participation
Total

100 Marks

# If proxy is caught will be awarded absent for next 3 lectures


* If assignments of any two students are same both will be awarded zero.
2

Text books
Charles Crowley Operating System A Design Approach TMH.
Operating Systems Concepts: Essentials by Silberschatz, Galvin, Gagne
William Stallings Operating Systems-Internals and Design Principles
Andrew S. Tanenbaum Operating Systems Design and Implementation,
Third Edition, Prentice Hall Publications 2006
5. A.S. Tanenbaum, Modern Operating Systems, 2nd edition, Prentice Hall
India.
1.
2.
3.
4.

Overview
What is an Operating System?
A review of OS-related hardware

What is an operating system?


A program that controls the execution of
application programs and implements an
interface between the user of a computer and the
computer hardware
Narrow view of a computer and OS
Traditional computer with applications running on it (e.g.
PCs, Workstations, Servers)

Broad view of a computer and OS


Anything that needs to manage resources (e.g. router OS,
embedded system, cell phone OS ...)
5

Levels in a computer system


User

Abstract View of System


Components

Two key OS functions


Abstract Machine
Hides complex details of the underlying hardware
Provides common API to applications and services
Simplifies application writing

Resource Manager
Controls (scheduling, multiplexing, transforming etc.) accesses to
shared resources
CPU, memory, disks, network, ...

Allows for global policies to be implemented


Better utilization of computer hardware

OS as a resource manager
Allocating resources to applications across space
and time
time sharing a resource (scheduling)
space sharing a resource (allocation)

Making efficient use of limited resources


improving utilization
minimizing overhead
improving throughput/good put

Enforcement of boundaries
protecting applications from each other

Operating System Definitions


Resource allocator manages and allocates resources
Control program controls the execution of user programs
and operations of I/O devices
Kernel lies between software and hardware. The one
program running at all times (all else being application
programs)

Hardware resources

Providing abstraction via system calls


Application
System Calls: read(), open(), write(), mkdir(), kill() ...

Device
Mgmt

Operating
System
Protection

File System

Video Card
Monitor

CPU

Network
Comm.

Memory
Disk

Process
Mgmt
Security

Network

Printer
12

Types of multiplexing
Time multiplexing
time-sharing
scheduling a serially-reusable resource among several users

Space multiplexing
space-sharing
dividing a multiple-use resource up among several users

Time-multiplexing the processor

14

Space-multiplexing memory

15

Time-multiplexing I/O devices

16

Space-multiplexing the disk

17

O.S. Components

Process management
Main memory management
File management
I/O system management
Secondary storage management
Networking
Protection system
Command interpreter system

Process Management
A process is a program in execution.
Needs (CPU time, memory, files, and I/O devices).

The OS is responsible for the following


activities in connection with process
management.
Process creation and deletion.
process suspension and resumption.
Provision of mechanisms for:
process synchronization
process communication

Main-Memory Management
Memory is a large array of words or bytes,
each with its own address. It is a repository of
quickly accessible data
shared by the CPU and I/O devices.

Main memory is a volatile storage device.


It loses its contents in the case of system failure.

The operating system is responsible for the


following activities in connections with
memory management:
Keep track of which parts of memory are currently being used and by whom.
Decide which processes to load when memory space becomes available.
Allocate and de-allocate memory space as needed.

File Management
A file is a collection of related information
defined by its creator. Commonly, files represent
programs (both source and object forms) and
data.
The operating system is responsible for the
following activities in connections with file
management:

File creation and deletion.


Directory creation and deletion.
Support of primitives for manipulating files and directories.
Mapping files onto secondary storage.
File backup on stable (nonvolatile) storage media.

I/O System Management


The I/O system consists of:
A buffer-caching system
A general device-driver interface
Drivers for specific hardware devices

Secondary-Storage Management
Main memory (primary storage) is volatile
and small.
The operating system is responsible for the
following activities in connection with disk
management:
Free space management
Storage allocation
Disk scheduling

Networking (Distributed Systems)


A distributed system is a collection of processors
that do not share memory or a clock. Each
processor has its own local memory.
The processors in the system are connected
through a communication network.
Communication takes place using a protocol.
Access to a shared resource allows:
Computation speed-up
Increased data availability
Enhanced reliability

Protection System
Protection refers to a mechanism for
controlling access by programs, processes, or
users to both system and user resources.
The protection mechanism must:
distinguish between authorized and unauthorized usage.
specify the controls to be imposed.
provide a means of enforcement.

Command-Interpreter System
Many commands are given to the operating
system by control statements which deal with:

process creation and management


I/O handling
secondary-storage management
main-memory management
file-system access
protection
Networking

The program that reads and interprets control


statements is called variously:
command-line interpreter
shell (in UNIX)

Modes of execution
User mode.
Supervisory (or Kernel) mode.

Some instructions (e.g. controlling the system hardware) are not offered to
everyone for use.
These instructions are called privileged instructions and allowed to only privileged
users for use.

27

Problems an OS must solve


Time sharing the CPU among applications
Space sharing the memory among
applications
Space sharing the disk among users
Time sharing access to the disk
Time sharing access to the network

28

More problems an OS must solve


Protection

of applications from each other


of user data from other users
of hardware/devices
of the OS itself!

29

Operating System Services

Program execution
I/O operations
File-system manipulation
Communications
Error detection

Mainframe Systems
First Computer used to tackle many commercial and scientific
applications
Batch Systems

Multiprogrammed Systems

Time-Sharing SystemsInteractive

Batch Systems
Reduce setup time by batching similar jobs

Automatic job sequencing automatically


transfers control from one job to another. First
rudimentary operating system
Input devices: Card Reader and Tape drive
Output Devices :Line printer , Tape drive and
Punch cards.

Memory Layout for a Simple Batch System

Multiprogrammed Systems

Several jobs are kept in main memory at the same time, and
the CPU is multiplexed among them.

OS Features Needed for Multiprogramming


Job scheduling: jobs (disk -> memory).

Memory management memory allocation to several jobs


CPU scheduling jobs (ready to run)
Allocation of devices

Time-Sharing SystemsInteractive Computing


Batch and Multiprogrammed system do not provide
interaction with user during program execution.
The CPU is multiplexed among several jobs that are kept in
memory and on disk (the CPU is allocated to a job only if the
job is in memory).
A job swapped in and out of memory to the disk.

Time-Sharing SystemsInteractive Computing

Multitasking systems
Multiuser
Interactive computer system

Computer system architecture


Single processor systems
one general-purpose CPU

Multiprocessor (Parallel/tightly coupled) system

high throughput
more reliable/fault tolerant
less costly
Asymmetric and symmetric multiprocessing (SMP)

Clustered systems
Multiple systems connected (e.g. LAN)
Shared storage
38

Parallel Systems
In parallel computing, all processors may have
access to a shared memory to exchange
information between processors.

39

Distributed Systems

In distributed computing, each processor has its own private


memory (distributed memory). Information is exchanged by
passing messages between the processors.
A distributed system consists of a collection of autonomous
computers linked to a computer network and equipped with
distributed system software.
A distributed system is a collection of processors that do not
share memory or a clock.
Distributed systems is a term used to define a wide range of
computer systems from a weakly-coupled system such as
wide area networks, to very strongly coupled systems such as
multiprocessor systems.
Distribute the computation among several physical processors

Parallel vs Distributed systems


The main difference between parallel systems
and distributed systems is the way in which
these systems are used.
A parallel system uses a set of processing units
to solve a single problem.
A distributed system is used by many users
together.

41

Other types of systems


Real-Time Systems
Hard real-time systems
Ex. Satellite launch system

Soft real-time systems


Ex. Multimedia presentation system

Handheld Systems
RTOS running on a mobile device

Overview
What is an Operating System?
Operating System Structure
A review of OS-related hardware

43

OS Structure
Monolithic Systems
Micro kernel architecture

Layered Systems
Virtual Machine

Monolithic Systems

Microkernel System Structure


Moves as much from the kernel into user space.
Communication takes place between user modules using
message passing directly without involvement of kernel.
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

Microkernel based OS

Monolithic Kernels VS Microkernels

Layered Approach
Advantages : modularity, Simplifies
debugging and system verification
Difficulty: Careful definition of layers since a
layer can use only those layers below it.
Disadvantages: Less efficient (Each layer adds
overhead)

System Calls
System calls provide the interface between a
running program and the operating system.
assembly-language instructions.

Types of System Calls


Process control : end, abort, create, terminate, execute, wait event,
signal event
File management : create file, delete file, open, close, read, write,
reposition
Device management: request device, release device, read, write,
reposition
Information maintenance: get time or date, set time or date
get process file or device attributes, set process file or device
attributes
Communications: Craete, delete communication connection
send, receive message, transfer status information, aatach or detach
remote device

System programs
System calls provide a convenient environment
for program development and execution.
Most users view of the operating system is
defined by system programs, not the actual
system calls.

Virtualization
Virtualization is the creation of a virtual (rather than actual)
version of something, such as an operating system, a server, a
storage device or network resources.
Full virtualization: Almost complete simulation of the actual
hardware to allow software, which typically consists of a guest
operating system, to run unmodified.
Partial virtualization: Some but not all of the target
environment is simulated. Some guest programs, therefore,
may need modifications to run in this virtual environment.
Paravirtualization: A hardware environment is not simulated;
however, the guest programs are executed in their own
isolated domains, as if they are running on a separate system.
Guest programs need to be specifically modified to run in this
environment.

Computing environments
Client-Server computing
Peer-to-peer computing
Web-based computing

54

The OS is just a program!


The OS is a sequence of instructions that the CPU
will fetch/decode/execute
How can the OS cause application programs to run?
How can the OS switch the CPU to run a different
application and later resume the first one?
How can the OS maintain control?
In what ways can application code try to seize control
indefinitely (ie. cheat)?
And how can the OS prevent such cheating?
How can applications programs cause the OS to run?
55

How can OS guarantee to regain


control?
What if a running application doesnt make a
system call and hence halt the CPU?
OS needs interrupts from a timer device!

56

What if the application tries to cheat?


What stops the running application from disabling the future timer
interrupt so that the OS can not take control back from it?
Disabling interrupts must be a privileged instruction which is not
executable by applications

57

What other ways are there to cheat?


What stops the running application from
modifying the OS?
Memory protection!

Why must the OS clear the mode bit before it


hands control to an application?

58

You might also like