You are on page 1of 8

Lecture note for OS

Chapter one
After going through this unit, you will be able to:

Define Operating system, functions, history and Evolution

Describe operating system services and its components.

Define multitasking and multiprogramming.

Describe timesharing, buffering & spooling


What is an Operating System?

A program that acts as an intermediary between a user of a computer and the computer
hardware.

An operating system is a software that manages the computer hardware. The hardware must
provide appropriate mechanisms to ensure the correct operation of the computer system and to
prevent user programs from interfering with the proper operation of the system.

An Operating system is a program that controls the execution of application programs and acts
as an interface between the user of a computer and the computer hardware.

OS simplifies and manages the complexity of running application programs efficiently.

Network os [UNIX, Linux, MS windows server 2000]

Desktop operating system [MS windows 9x, MAC OS]

Mobile operating system [palm OS, Android OS]

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.

Modes of operations:

Dual-mode operation allows OS to protect itself and other system components

To avoid having applications that constantly crashed, newer OSs were designed with 2 different
operative modes:

User modes:

The executing code has no ability to directly access hardware or reference memory.
Code running in user mode must delegate to system APIs to access hardware or
memory.
Due to the protection afforded by this sort of isolation, crashes in user mode are
always recoverable.
Most of the code running on your computer will execute in user mode.
Application program

Kernel modes:

The executing code has complete and unrestricted access to the underlying
hardware.
It can execute any CPU instruction and reference any memory address.
Kernel mode is generally reserved for the lowest-level, most trusted functions of the
operating system.
Crashes in kernel mode are catastrophic; they will halt the entire PC.
It has access to every resource
Supervisor mode
Many drivers run in kernel mode
Driver Programs (Device Driver) small program that allows a specific input or
output device to communicate with the rest of the computer system
How the switch occurs
Mode bit added to computer hardware to indicate the current mode: monitor (0) or
user (1).
1. System call
Interface to the services made available by an operating system.
Tasks where hardware must be accessed directly
2. API[ application program interface]
designed program
Computer System Components
Every general purpose computer consists:
1. Hardware provides basic computing resources (CPU, memory, I/O devices).

2. Operating system controls and coordinates the use of the hardware among the various
application programs for the various users.

3. Applications programs define the ways in which the system resources are used to solve the
computing problems of the users (compilers, database systems, video games, business
programs).

4. Users-(people, machines, other computers).

What Operating Systems Do

Every computer must have an operating system to run other programs.


The operating system and coordinates the use of the hardware among the various system
programs and application program for a various users.
It simply provides an environment within which other programs can do useful work.
It performs basic tasks such as recognizing input from the keyboard, keeping track of
files and directories on the disk, sending output to the display screen and controlling a
peripheral devices.

Figure 1 Abstract view of computers

The operating system must support the following tasks. The tasks are:

1. Provides the facilities to create, modification of program and data files using and editor.

2. Access to the compiler for translating the user program from high level language to machine
language.

3. Provide a loader program to move the compiled program code to the computers memory for
execution.

4. Provide routines that handle the details of I/O programming.

Operating System Services


The common service provided by the operating system is listed below.
1. Program execution:

loads a program into memory


Executes the program.
2. I/O operation: Program may require any I/O device while running. So operating system
must provide the required I/O.
3. File system manipulation: Program needs to read a file or write a file. The operating
system gives the permission to the program for operation on file.
4. Communications: control communications between two devices
5. Error detection: error may occur in CPU, in I/O devices or in the memory hardware. The
operating system constantly needs to be aware of possible errors. It should take the
appropriate action to ensure correct and consistent computing.
Operating System Components:
1. Process Management
2. Main Memory Management
3. File Management
4. Secondary Storage Management
5. I/O System Management
6. Networking
7. Protection System
8. Command Interpreter System
Computer system architectures:
Batch system:
Batch operating system is one where programs and data are collected together in a batch
before processing starts.
A job is predefined sequence of commands, programs and data that are combined in to a
single unit called job.
Memory management in batch system is very simple.
Memory is usually divided into two areas: Operating system and user program area.
No jobs can be stated until previous job is completed

Figure 2memory layout of simple batch system

Scheduling is also simple in batch system.


Jobs are processed in the order of submission i.e first come first served fashion
Batch system often provides simple forms of file management
Batch systems are inconvenient for users because users cannot interact with their jobs to
fix problems

Figure 3 batch operating system

Advantages of Batch System


Move much of the work of the operator to the computer.
Increased performance
Disadvantages of Batch System
Difficult to debug program.
A job could enter an infinite loop.
A job could corrupt the monitor, thus affecting pending jobs.
Due to lack of protection scheme, one batch job can affect pending jobs.

Solutions to speed up Input/ output

Spooling:

Acronym for simultaneous peripheral operations on line.


Spooling refers to putting jobs in a buffer, a special area in memory or on a disk where a
device can access them when it is ready.
The most common spooling application is print spooling
In print spooling, documents are loaded into a buffer and then the printer pulls them off
the buffer at its own rate.
Allows overlap - I/O of one job with computation of another.
Introduces notion of a job pool that allows OS choose next job to run so as to increase
CPU utilization

Polling:
Device sets a flag when it is busy.
Program tests the flag in a loop waiting for completion of I/O.

Multiprogramming system:

When two or more programs are in memory at the same time, sharing the processor is
referred to the multiprogramming operating system.
Multiprogramming assumes a single processor that is being shared.
It increases CPU utilization by organizing jobs so that the CPU always has one to execute
Jobs entering into the system are kept into the memory. Operating system
picks the job and begins to execute one of the job in the memory
Requires CPU scheduling to choose the next job to run
Figure 4 memory layout of multiprogramming

Advantages:
1. High CPU utilization.
2. It appears that many programs are allotted CPU almost simultaneously.
Disadvantages:
1. CPU scheduling is requires.
2. To accommodate many jobs in memory, memory management is required
Time Sharing Systems:
To provide interactive use of a computer system
Uses CPU scheduling and multiprogramming to provide each user with a small
portion of a time-shared computer
Allows the many users to share the computer simultaneously
Multi-tasking system
Like multiprogramming, but timer device
A timer interrupt is used to multiplex CPU among jobs
CPU switching
Personal computer system:

Single user
Utilization is no longer a concern
Emphasis is on user interface and API
Many services & features not present
Parallel system:

Multiprocessor systems with more than one CPU in close communication


Also known as Multiprocessors
Advantages:
Increased throughput: by increasing number of processor, get more work done in less
time
Economy of scale: can share peripherals, memory
Increased reliability: failure of one processor cant halt the system
Asymmetric multiprocessing:

Each processor is assigned a specific task.


Master processor control the system
Master-slave relation ship
Master allocate work to slave to work
Symmetric multiprocessing:

each processor performs all tasks


all processors are peers

Distributed system:

The processors do not share memory or a clock. Instead, each processor has its own local
memory.
They communicate with each other through various communication lines.
A distributed system provides user access to various system resources.
Advantages:
resource sharing
computation speed-up
reliability
communication - e.g. email
Real time system:

Correctness of the system depends not only on the logical result of the computation but
also on the time at which the results are produced.
A hard real-time task is one that must meet its deadline
Failure to meet deadlines is fatal
[example : Flight Control System]
A soft real-time task has an associated deadline that is desirable but not mandatory;
Late completion of jobs is undesirable but not fatal
[Online Databases]
Are time bounded system

You might also like