You are on page 1of 12

Operating System

PART I
What is Operating System?
• It is a program that
 controls the execution of application programs
 acts as an interface between applications and computer hardware
 manages the resources associated with a computer
Objectives of OS:
 Convenience of use of the computer
 Efficient use of the computing resources
 Should be such that it can permit effective development, testing and introduction of new
system functions without affecting he service.
 A program that acts as an intermediary between a user of a computer and the computer
hardware.
 Operating system goals:
 Execute user programs and make solving user problems easier.
 Make the computer system convenient to use.
 Use the computer hardware in an efficient manner.
 OR >> An operating system, or OS, is a software program that enables the computer hardware
to communicate and operate with the computer software. Without a computer operating
system, a computer would be useless.

Computer System Structure


 Computer system can be divided into four components
 Hardware – provides basic computing resources
 CPU, memory, I/O devices
 Operating system
 Controls and coordinates use of hardware among various applications and
users
 Application programs – define the ways in which the system resources are used to
solve the computing problems of the users
 Word processors, compilers, web browsers, database systems, video games
 Users
 People, machines, other computers
Four Components of a Computer System (diagram 1)

Operating System Definition


 OS is a resource allocator
 Manages all resources
 Decides between conflicting requests for efficient and fair resource use
 OS is a control program
 Controls execution of programs to prevent errors and improper use of the computer
 No universally accepted definition
 “Everything a vendor ships when you order an operating system” is good approximation
 But varies wildly
 “The one program running at all times on the computer” is the kernel. Everything else is
either a system program (ships with the operating system) or an application program

Bootstrapping (diagram 2)
Computer Startup Steps:
1. Empty Ram
2. BIOS Loading
3. Boot drive (Floppy Drive, Hard disk, CD ROM, USB)
4. Primary drive (Primary partition, Drive C :), portioning or Active drive.
5. Goes to MBR (Master Boot record)=== Boot.ini
6. Boot loader files (boot.ini)

Storage-Device Hierarchy (diagram 3)

Registers (Assignment)
 What is Cache?
 Important principle, performed at many levels in a computer (in hardware, operating system,
software)
 Information in use copied from slower to faster storage (temporarily)
 Faster storage (cache) checked first to determine if information is there
 If it is, information used directly from the cache (fast)
 If not, data copied to cache and used there
 Cache smaller than storage being cached
 Cache management important design problem
 Cache size and replacement policy
Performance of Various Levels of Storage (diagram 4)
 Movement between levels of storage hierarchy can be explicit or implicit

Level 1 2 3 4
Name Registers Cache Main memory Disk Storage
Typical Size < 1 KB > 16 MB > 16 GB > 100 GB
Implementation Custom memory ON-chip or CMOS DRAM Magnetic disk
technology with multiple OFF-chip
ports (CMOS) CMOS SRAM
Access Time (ns) 0.25 - 0.5 0.5 - 25 80 - 250 5000000
Bandwidth 20000 - 100000 5000 - 10000 1000 - 5000 20 - 150
(MB/Sec)
Managed By Compiler Hardware Operating Operating
system system
Backed By Cache Main memory disk CD or Tape

Migration of Integer A from Disk to Register


 Multitasking environments must be careful to use most recent value, not matter where it is
stored in the storage hierarchy

 Multiprocessor environment must provide cache coherency in hardware such that all CPUs
have the most recent value in their cache
 Distributed environment situation even more complex
 Several copies of a datum can exist

 Operating system timeline (Evaluations, Generations)


 First generation: 1945 – 1955
 Vacuum tubes
 Plug boards
 Second generation: 1955 – 1965
 Transistors
 Batch systems
 Third generation: 1965 – 1980
 Integrated circuits
 Multiprogramming
 Fourth generation: 1980 – present
 Large scale integration
 Personal computers
 Next generation: ???
 Systems connected by high-speed networks?
 Wide area resource management?

First generation: direct input


 Run one job at a time
 Enter it into the computer (might require rewiring!)
 Run it
 Record the results
 Problem: lots of wasted computer time!
 Computer was idle during first and last steps
 Computers were very expensive!
 Goal: make better use of an expensive commodity: computer time

• Serial Processing
 From 1940s to mid-1950s
 Programmer interacted with the hardware
 Programs in machine code were loaded via the input device (card reader)
 In case of any error, they were indicated with lights

Second generation: batch systems


 Bring cards to 1401
 Read cards onto input tape
 Put input tape on 7094
 Perform the computation, writing results to output tape
 Put output tape on 1401, which prints output

• Simple Batch Processing


 for maximizing machine utilization
 batch O.S. used
 a piece of software called the monitor used
 monitor reads in jobs one at a time from the input device
 as a job is read in, control is passed to the current job; control return back to the
monitor when the job is finished
 results of a job are sent to an output device such as the printer
 Processor is executing the instructions from those of the monitor
 Processor will then execute the instruction of the user program until it encounters an
ending or error condition
 instructions for the monitor are contained in the JCL
(Diagram)

 Original batch systems used tape drives


 Later batch systems used disks for buffering
o Operator read cards onto disk attached to the computer
o Computer read jobs from disk
o Computer wrote job results to disk
o Operator directed that job results be printed from disk
 Disks enabled simultaneous peripheral operation on-line (spooling)
o Computer overlapped I/O of one job with execution of another
o Better utilization of the expensive CPU
o Still only one job active at any given time
o CPU potentially idle if not all I/O at beginning and end of a job

Spooling (Assignment)
Spooling & Buffering
Spooling: - (Simultaneous Peripheral Operation On-Line)
Using a disk or similar device as a large buffer, for reading as far ahead as possible on input devices
or storing output files until the output device are ready for them.
 Buffering overlaps the I/O of a job with its own computation.
 Spooling overlaps the I/O of a job with the computation of all other jobs.
 Spooling can be used to provide a job pool
 Spooling is a term used in computers and it means place an operation that is being run by the
operating system in a temporary are until another action is taken. For example sending a print
job from your computer to the printer. The operating system places the sent job in a temporary
folder until action is taken by the printer
Buffering: - A method of overlapping the I/O of a job with its execution. After data has been read
and while the CPU starts execution, the input device is instructed to begin the next input immediately
so that it is in memory when it is requested.

Third generation: multiprogramming (diagram) ---


 Multiple jobs in memory
o Protected from one another
 Operating system protected from each job as well
 Resources (time, hardware) split between jobs
 Still not interactive
o User submits job
o Computer runs it
o User gets results minutes (hours, days) later

Several jobs from the job pool are kept in memory.


 The OS picks and begins execution of one of these jobs.
 If the job needs to wait for an I/O device the OS switches to executing another job.
 When that job needs to wait the OS switches to another job.
 The CPU therefore can be kept busy more of the time.
 We say these jobs are being run concurrently.
 This is an aspect of operating systems that adds much of its complexity.

Timesharing
 Multiprogramming allowed several jobs to be active at one time

 Initially used for batch systems

Time Sharing (also called multitasking)


Multitasking - A function of operating system that is capable of allowing multiple
processes (Jobs) to run at the same time. Below are some examples of multitasking operating
systems.
E.g. Unix & Windows 2000
 This is an extension of multiprogramming.
 No job is allowed to use the CPU for more than a certain time, called the quantum.
 A timer is set when a job enters the CPU.
 If the timer expires before the job request I/O, another job is chosen for execution.
 If the quantum is small compared to a human time scale, it seems as if many jobs are
running simultaneously.
 This allows for a high degree of interaction between the user and the computer without
the associated inefficiency as the CPU waits for the user to push a key.
 Similar to when only one person could use a computer at a time.
 Note: if there is only one CPU, at most one user job can be running at any time.

Types of modern operating systems


 Mainframe operating systems: MVS
 Server operating systems: FreeBSD, Solaris
 Multiprocessor operating systems: Cellular IRIX. Windows 2000
 Personal computer operating systems: Windows XP, Linux
 PDA operating systems: Palm OS, Pocket PC OS.
 Real-time/embedded operating systems: VxWorks, QNX, Chorus
 Hand Held Systems
 Most of these are considerably more powerful than then mainframes of 40 years ago. Some do
networking and multitasking.
 Some operating systems can fit into more than one category

Types of Operating System:


There are two types of OS.

1. General Purpose
a. Single User
b. Multi User
2. Special Purpose
a. Serial purpose OS
b. Batch processing OS
c. Multiprogramming
d. Multitasking
e. Multiprocessing
 Single User OS:
These systems usually design for microcomputers which provide the services to a single user.
These types of OS are very simple in structure and working. The single user OS controls very limited
devices and their functions are restricted to initializing the system when it is turn O, providing I/O
routines (procedures) to permit user to perform to transfer data between main memory and I/O
devices and provide file system to process the program. And once it is loaded in the main memory it
remains until its completion or abortion.

 Multi User OS:


It supports more than one user similtainusly. It includes mini and mainframe computers. The
multi users OS are intended to support many interactive as well as batch processing at the same time
and offer a void spectrum of services. These multi user OS supports a number of storage devices and
maintain more than one program in the main program to perform active sharing of CPU time storage
space and other resources among the active programs. The multi User OS includes;

a. Multiprocessing
b. Time sharing
c. Multiprogramming

 Multithreading - Operating systems that allow different parts of a software program to run
concurrently. Operating systems that would fall into this category are:
 Linux Unix Windows 2000
 Multiprocessing - An operating system capable of supporting and utilizing more than one
computer processor. Below are some examples of multiprocessing operating systems.
 Linux Unix Windows 2000
 Multiprogramming
More than one user and one CPU sytem.
 Multitasking:
One user more than one tasks with one CPU.
 Multiprocessing:
More than one CPU processes.
Multithreading:
More than one pieces of one task, multi parts of the same task.
Time sharing:
That time of CPU which give to a specific job is called time slice or quantum and this process
is called time sharing.

Multiprocessor system:
A computer system that consist of two or more processor for processing is called
multiprocessor system. They divided in to two categories:
1. Asymmetric multiprocessing
2. Symmetric multiprocessing

1. Asymmetric:
In asymmetric multiprocessing their exist master, slave relationship among the processor. The
master processor is assigning the task of the distributing works to other slave processors. The
master does nothing but the assignment of job only where the slave processor execute the jobs
assign by the master. This architecture has the disadvantage of the low device utilization as
master sets idle for the most of the time. It has the total advantage of normal load to all slaves
as the master is performs the distribution of work.
2. Symmetric:
In symmetric multiprocessing there is no master slave relationship. Rather all processors all
peer each processor is executing a copy of same OS and accept jobs from job pool. These
processors communicate through OS. It has the advantage of good device utilization as all the
processors are in work.

Reason to choose multiprocessing System:


1. Economy of scale:
The cast of the system are reduced, if we have 10 users then 10 separate systems are
require (separate memory, etc) if we not using multiprocessor. In multiprocessors all
processors sharing the resources.

2. Reliability:
Multiprocessors more reliable than others because if one fails the remaining are in
working.
3. Better throughput:
The time that a program takes in it’s over all execution called throughput of that
program. So by increasing the number of processors we hope to get more work in less
time.

Architecture of OS
OS consist of two parts which are further divided into parts.
Control programs and service programs
1. Control Programs
It permits the user, computer communication and manages the overall computer operation
to ensure that they are running properly.
These programs are further divided into four sections.
a. Supervisor
This is the major part of OS that control the operation of the computer.
Typically the functions of the supervisor are:
i. Loading programs and data into main memory from backing storing.
ii. Scheduling the sequence of jobs to be run for maximum efficiency.
b. Command processor
It carries out user command. These commands constitute of small modules
or programs a specific tasks. E.g. Format Hd of copying files.
c. Interrupt handler
It keeps track all the processes and executions of commands and display
error messages where and when require.
E.g. in task in not in Drive A and the user wants to format the disk, then
interrupt handler will display the error message “Not reading Drive A”

d. I/O control system


This system schedule the proper I/O devices as well as storage unit, it also
monitor the operation of I/O devices. E.g. from keyboard to display screen
or printer.

2. Service programs
That programs which provide services.
a. Utility programs
These programs enable users to handle file managements. E.g. files can be
easily prepared, copies, deleted, merged, started etc
b. Library programs
These maintain a directly of frequently and software programs and their
locations.

-: Structure
1. User Mode (shell)
2. Kernel mode
Interrupts
• A mechanism by which other modules (I/O, memory) may interrupt the normal sequencing of
the processor
• Interrupts help to improve processor utilization.
• Classes of interrupts:
1. Program: generated by some condition that occurs as a result of an instruction
execution, such as arithmetic overflow, division by zero,attempt to execute an illegal
machine instruction, and reference outside user’s allowed memory space.
2. Timer: Generated by a timer within the processor. This allows the operating system to
perform certain functions regularly.
3. I/O: Generated by an I/O controller, to signal normal completion of an operation or to
signal a variety of error conditions.
4. H/W failure: Generated by a failure, such as power, etc.

Functions of Interrupts
 Interrupt transfers control to the interrupt service routine generally, through the interrupt
vector, which contains the addresses of all the service routines.
 Interrupt architecture must save the address of the interrupted instruction.
 A trap is a software-generated interrupt caused either by an error or a user request.
 An operating system is interrupt driven.

Midterm exam

You might also like