You are on page 1of 56

Operating Systems

Unit – 1 (Introduction to OS)


Contents
◼ We will learn
1. What is Operating System?
2. What OS does?
3. Structure of OS
4. Evolution of OS
◼ Batch Processing
◼ Multiprogramming
◼ Time sharing systems
◼ Distributed Systems
◼ Real Time systems
5. Operating System Structure & Services
6. System Calls and System Programs
7. Virtual Machines
What is OS?
◼ OS is a software that makes a computer actually work.

◼ It is the software the enables all the programs we use.

◼ The OS organizes and controls the hardware.

◼ interface between the user and the hardware.

◼ Main Objectives of OS:


❑ Convenience, Efficiency, Ability to solve

◼ Examples: Windows, Linux, Unix and Mac OS, etc.,


What OS does?

An operating system performs basic tasks such as,

◼ controlling and allocating memory,


◼ prioritizing system requests,
◼ controlling input and output devices,
◼ facilitating networking and
◼ managing file systems.
Advantages of using OS

◼ Allows you to hide h/w details by creating an


Easy to use with a GUI
◼ Offers an environment in which a user may execute
programs/applications
◼ Convenient to use
◼ Acts as an intermediate between all hardware's and
software's of the system
◼ Provides the system resources with easy to use
Disadvantages of using OS

◼ If any issue occurs in OS, stored data will be lost


◼ Operating System's software is quite expensive for small
size organization.
❑ Example: Windows, Windows Server.
◼ It is not fully secure as a threat can occur at any time
Structure of Operating System:
Application Programs

System Programs

Software (Operating System)

HARDWARE

(Contd…)
Structure of Operating System
(Contd…):
◼ The structure of OS consists of 4 layers:
1. Hardware
Hardware consists of CPU, Main memory, I/O
Devices, etc.

2. Software (OS)
Software includes process management
routines, memory management routines, I/O
control routines, file management routines.

(Contd…)
Structure of Operating System
(Contd…):

3. System programs
This layer consists of compilers, Assemblers,
linker etc.

4. Application programs
This is dependent on user’s need.
E.g. Railway reservation system, Bank
database management etc.,
What is a Kernel?

◼ Central component of a computer operating systems.


◼ The only job performed by the kernel is to the manage
the communication between the software and the
hardware.
◼ A Kernel is at the nucleus of a computer while the Kernel
is the innermost part of an operating system, a shell is
the outermost one.
Difference b/w the OS and Kernel
OPERATING SYSTEM KERNEL
◼ OS is a system software that ◼ Kernel is system software which
load when computer boots up. is part of OS.
◼ provides interface b/w user ◼ kernel provides interface b/w
and hardware. application and hardware.
◼ OS provides protection and ◼ Main purpose is memory
security management, disk management,
process management
◼ All system needs operating ◼ All OS needs kernel to run.
system to run.
◼ Type of OS includes single and ◼ Type of kernel includes
multi-user OS, multiprocessor Monolithic and Micro kernel.
OS, real-time OS , Distributed
OS.
Evolution of OS:

◼ The evolution of operating systems went through seven


major phases.

◼ Six of them significantly changed the ways in which


users accessed computers through the open shop, batch
processing, multiprogramming, timesharing, personal
computing, and distributed systems.

◼ In the seventh phase the foundations of concurrent


programming were developed and demonstrated in
model operating systems.
(Contd…)
Evolution of OS (contd..):
Major Technical Operating
Phases Innovations Systems
The idea of OS IBM 701 open shop
Open Shop (1954)

Tape batching, BKS system (1961)


Batch
First-in, first-out
Processing scheduling.
Processor multiplexing, Atlas supervisor (1961),
Multi- Indivisible operations, Exec II system (1966)
programming Demand paging,
Input/output spooling,
Priority scheduling,
Remote job entry
(Contd…)
Evolution of OS (contd..):
Simultaneous user Multics file system
Timesharing interaction, (1965),
On-line file systems Unix (1974)
Hierarchical systems, RC 4000 system (1969),
Concurrent Extensible kernels, Parallel 13 Venus system (1972),
Programming programming concepts, 14 Boss 2 system
Secure parallel languages (1975).

Graphical user interfaces OS 6 (1972)


Personal
Pilot system (1980)
Computing
Remote servers WFS file server (1979)
Distributed Unix United RPC (1982)
Systems 24 Amoeba system
(1990)
Batch Processing:
◼ In Batch processing same type of jobs batch (BATCH- a
set of jobs with similar needs) together and execute at a
time.
◼ The OS was simple, its major task was to transfer control
from one job to the next.
◼ The job was submitted to the computer operator in form
of punch cards. At some later time the output appeared.
◼ The OS was always resident in memory.
◼ Common Input devices were card readers and tape
drives.
Batch Processing (Contd…):
Batch Processing (Contd…):
◼ Common output devices were line printers, tape drives,
and card punches.
◼ Users did not interact directly with the computer
systems, but he prepared a job (comprising of the
program, the data, & some control information).
OS

User
program
area
Batch Processing (Contd…):
Advantages:
◼ Transfers much of the work of the operator to the computer
◼ Increased performance, a job starts as soon as the previous
one finishes
◼ Simple scheduling
◼ Does not use any critical device management.
Disadvantages:
◼ CPU is often idle due to slow i/o devices
◼ Turn around time can be large from user view,
◼ Difficult to debug
◼ A job could corrupt the monitors, affecting all jobs
◼ A job may enter an infinite loop
Buffering

◼ A method to overlap I/O and processing of job


Order of execution is as follows:
1. Read a set of data from i/p device
2. As CPU starts processing the input data , the input device
begins to read the next set of data
3. Now CPU and input device are busy.
4. By the time the CPU finishes the processing and is ready for
the next set of data ,the input device must have finished
reading it.
5. This is common for o/p devices also.
Understand Buffering
Spooling (Simultaneous Peripheral
Operation On Line)
◼ Cards are read directly from card reader to the disk
◼ During the execution of the job, the OS takes the i/p from the disk
◼ Similarly when the job requests for output on a printer, the line is
copied to system buffer and written on the disk.
◼ On completion of the job, the output is printed.
Spooling (Simultaneous Peripheral
Operation On Line)
◼ special area in memory / hard disk for putting data of various
I/O jobs in a buffer.
◼ OS activities related to distributed environment
• Handles I/O device data spooling as devices have different
data access rates.
• Maintains the spooling buffer which provides a waiting
station where data can rest while the slower device catches
up.
• Maintains parallel computation because of spooling
process as a computer can perform I/O in parallel fashion.
Spooling (Simultaneous Peripheral
Operation On Line)
Advantages
◼ The spooling operation uses a disk as a very large buffer.

◼ Spooling is capable of overlapping I/O operation for one job


with processor operations for another job
Multiprogramming:

◼ Multiprogramming is a technique to execute number of


programs simultaneously by a single processor.
◼ In Multiprogramming, number of processes reside in
main memory at a time.
◼ The OS picks and begins to executes one of the jobs in
the main memory.
◼ If any I/O wait happened in a process, then CPU
switches from that job to another job.
◼ Hence CPU in not idle at any time.
Multiprogramming - Example:
Multiprogramming (Contd…):
• The main memory consists of 5 jobs at
OS a time, the CPU executes one by one.

Job 1 • Multiprogramming has to make


following decisions:
Job 2
• Job Scheduling
Job 3 • Memory Management
Job 4 • CPU Scheduling
Job 5 • Disk Storage
Multiprogramming (Contd…):
Advantages:
• Efficient memory utilization
• Throughput increases
• CPU is never idle, so performance increases.
• Shorter Response Time
Disadvantages:
• More storage space required
Time Sharing Systems:

◼ Time sharing, or multitasking, is a logical extension of


multiprogramming.
◼ Prime focus is to minimize the response time.
◼ Multiple jobs are executed by switching the CPU
between them.
◼ In this, the CPU time is shared by different processes, so
it is called as “Time sharing Systems”.
◼ Time slice / Time Quantum is defined by the OS, for
sharing CPU time between processes.
◼ Examples: Multics, Unix, etc.,
Time Sharing Systems:
Time Sharing Systems:
Advantages:
• Each task gets an equal opportunity
• CPU idle time can be reduced
• User gets quick response
Disadvantages:
• More complex than multiprogramming
• Reliability problem
• Data Communication problem occurs
• Requires CPU Scheduling, Memory & Disk Management
Multiprogramming vs Time Sharing Systems:

Multiprogramming Time Sharing

Objective is to maximize CPU


Objective is to minimize response time
utilization

Directives are given by Job


Directives are entered at the terminal
Control Language (JCL)

It’s not Interactive It is interactive


Distributed Systems
◼ Collection of loosely coupled processors interconnected
by a communications network.
◼ Processors may vary in size and functions and referred as
sites, nodes, computers, machines, hosts.
◼ Reasons for distributed systems:
❑ Resource sharing:

◼ sharing and printing files at remote sites.


◼ processing information in a distributed database.
◼ using remote specialized hardware devices.
❑ Computation speedup – load sharing.
❑ Reliability – detect and recover from site failure, function
transfer, reintegrate failed site.
❑ Communication – message passing.
Distributed Systems
Distributed Systems
Advantages:
• Failure of one site doesn’t affect the others
• Better service to the customers
• Reduced load on the host computer
• Reduction of delays in data processing
Disadvantages:
• Failure of main node will stop the entire communication
• Implementation is difficult
• Needs resource management, memory management
and protection.
Real-Time Systems
◼ Defined as a data processing system in which the time
interval required to process and respond to inputs is so
small that it controls the environment.
◼ Not all OSs are general-purpose systems.
◼ Dedicated systems that need to adhere to deadlines , i.e.,
time constraints.
◼ Correctness of the computation depends not only on the
logical result but also on the time at which the results are
produced.
◼ The time taken by the system to respond to an input and
display of required updated information is termed as
the response time.
Hard Real-Time
◼ Hard real-time system must meet its deadline.
◼ Conflicts with time-sharing systems, not supported by
general-purpose OSs.
◼ Often used as a control device in a dedicated application:
❑ Industrial control
❑ Robotics
❑ weapon systems
❑ air traffic control systems

◼ Secondary storage is limited or absent.


◼ data/program is stored in short term memory, or ROM.
◼ Virtual memory is almost never found.
Soft Real-Time
◼ Deadlines desirable but not mandatory.
◼ A critical real-time task gets priority over other tasks and
retains the priority until it completes.
◼ Limited utility than Hard Real-Time systems.
◼ Useful in modern applications requiring advanced OS
features.
❑ Multimedia
❑ Video conference
❑ Virtual Reality
❑ Advanced Scientific projects like undersea exploration and
planetary rovers.
Operating Systems Structure
Operating Systems Services
◼ The main functions of operating systems are:

1. Program execution
2. I/O operations
3. File System Manipulation
4. Communication
5. Error detection
6. Resource allocation
7. Accounting
8. protection
Program Execution
◼ OS should load a program into memory and run it.
◼ The program must be able to end its execution, either
normally or abnormally.
I/O Operations

◼ Running program requires I/O, which involve a file or an


I/O Device.
◼ For some devices, special functions may be desired
(like rewinding a tape drive or to blank a CRT screen)
◼ For efficiency and protection purposes, the users usually
are not able to control the I/O devices.
◼ So it is the duty of the OS to provide a means for the I/O
since users cannot execute them directly.
File-System Manipulation

◼ Programs need to read and write files.


◼ Programs also need to create and delete files by name.
◼ The OS handles the process of creating, deleting and
manipulating files.
Communications
◼ Two types of communication:
❑ b/w processes executing on the same computer.
❑ b/w processes executing on the different computer connect by a n/w.

◼ Communication can be implemented by the OS by


❑ Shared Memory
❑ Technique of message passing (info packets exchanged b/w process)
Error Detection
◼ OS must be able to detect any kind of error.
◼ Some common errors are:
❑ Power failure
❑ Memory error
❑ Parity error in I/O devices
❑ n/w connection failure
❑ Out of paper in a printer
❑ Arithmetic overflow in a user program
Resource Allocation
◼ Multiple jobs run at the same time so resources must be
allocated to each one of them.
◼ OS manages different types of resources.
◼ Some have special allocation code, whereas others have
general request and release code.
◼ OS have various routines for different jobs in the system,
e.g. CPU scheduling
Accounting
◼ Which users
◼ How many users
◼ What kind of computer resources
◼ Helps to charge the users for using the resources
◼ Usage statistics are available for improving the computing
service
Protection
◼ Protection and Security is an important issue in multi-user
computer systems.
◼ Protection involves in ensuring that all access to system
resources, is controlled.
◼ Protection of the system from outside users is also
important.
◼ Access to the resources must be authenticated with a
password.
System Calls

◼ System calls provide an interface to the services made


available by an operating system.
◼ Type of system calls:
❑ Process control (e.g., create and destroy processes)
❑ File management (e.g., open and close files)
❑ Device management (e.g., read and write operations)
❑ lnformation maintenance (e.g., get time or date)
❑ Communication (e.g., send and receive messages)
System calls flow
System Calls
Communication Models
System Programs
◼ File management (e.g., create, delete files)
◼ Status management (e.g., date/time, available memory
and disk space)
◼ File modification (e.g., editors)
◼ Programming language support (e.g., assemblers,
compilers, interpreters)
◼ Program loading and execution (e.g., loaders, linkage
editors)
◼ Communications (e.g., connections between processes,
sending/receiving e-mails)
Virtual Machines

◼ A Virtual Machine (VM) is a software between the kernel


and hardware.
◼ Thus, a VM provides all functionalities of a CPU with
software simulation.
◼ A user has the illusion that he/she has a real processor
that can run a kernel.
Virtual Machines

processes processes processes processes

kernel kernel kernel

VM1 VM2 VM3


kernel
VM implementation
hardware hardware
Virtual Machines

◼ Self-Virtualized VM: the VM is identical to the hardware.


Example: IBM’s VM/370 and VMware (creating a VM
under Linux to run Windows).
◼ Non-Self-Virtualized VM: the VM is not identical to the
hardware. Example: Java Virtual Machine JVM and
SoftWindow.
◼ It can be proved that all third-generation CPUs can be
virtualized.
Virtual Machines

◼ difficult to implement because they must duplicate all


hardware functions.
◼ Benefits:
❑ provides a robust level of security
❑ permits system development to be done without disrupting
normal system operation.
❑ allows multiple operating systems to run on the same machine
at the same time.
❑ can make system transition/upgrade much easier

You might also like