You are on page 1of 19

Unit - 1

1.1Introduction

An operating system is a program that manages the computer hardware. It also provides a basis
for application programs and acts as an intermediary between a user of a computer and the computer
hardware.

A computer system can be divided roughly into four components:


• Hardware
• Operating system
• Application programs
• Users

User1 User User User


2 3 n

Complier assembler text editor …database s/m


System and application programs

Operating System

Computer Hardware

Abstract view of the components of a computer system.

1.2 Mainframe Systems

 It is the first computer used to tackle many commercial and scientific applications.
 It has the following systems.
1. Batch Systems
2. Multiprogrammed Systems
3. Time – Shared Systems.

1. Batch Systems:

The common input devices are :

1
1. card readers
2. tape drivers
The common output devices are:
1. Line printers
2. Tape drives
3. Card Punches
The user did not interact directly with the computer systems. Using I/O devices, the process of
user can interact with the computer system.
Example:
P1, P2, P3

Processes
If we execute each process one by one means, it takes more time to execute.
To speedup processing,
Programs are batched together and executed. The result sent back to the appropriate
programmer.
In this execution environment, CPU is often idle. Because, if any one process wants to
performs I/O operations, CPU sit idle. To overcome this difficulty Multiprogramming system can be
used.

Operating System

User Program area

Memory Layout of batch system

2. Multiprogrammed system:

Operating System keeps several jobs(programs) in memory simultaneously


Example:
Job1 Job2 Job3
If one job performs I/O operations CPU fetches another job from memory.
In this environment CPU never sit idle.

Operating System
0
Job1

Job2

Job3

Job4 2
512k

Memory layout for a Multiprogramming system.

3. Time sharing system:

 It is a logical extension of multiprogramming.


 In time sharing systems, the CPU executes multiple jobs.
 It provides direct communication between user and the system.
 It allows many users to share the computer simultaneously.
 It uses CPU scheduling and multiprogramming to provide each user and the small
portion of time – shared computer.
 Virtual memory – a techniques that allows the execution of a job that is not completely
in memory.
 Physical memory – defined by OS, it is nothing but the actual location of program.
 Logical memory – it viewed by the user.
User1 User2 User3
2m 4m 6m
 User1 completed the task with 2m.
 User2 completes task +3m, remaining 1m is there.
 User3 needs the complete its task 7m. so it should CPU time of user2.

1.3 Desktop Systems

It deals with versions of OS. It includes 2 objectives.


1. Microsoft windows
2. Apple Macintosh
In terms of Microsoft windows  OS/2 Version which is upgraded by IBM forms MS-DOS .
In terms of Apple Macintosh produce Macox and it is derived to form Unix/Linux.

1.4Multiprocessor Systems

 It is also known as parallel systems or tightly coupled systems.


 Such systems have their more than one processor in close communication sharing the
computer bus, clock, memory, and peripheral devices.
 Advantages
1. Increased Throughput
If we increase number of processors, it takes less time to finish the task

More no of processor increase ∞ less time to finish task

3
2. Economy of scale
It saves more money because, it shares the resources between the processors.
3. Increased reliability
If functions can be distributed among several processors, then the failure of one
processor will not halt the system, only show it down
If we have ten processors, if one processor gets failed means, remaining 9
processor will take the responsibility of failed processor. thus the entire system runs only
10% slower speed than normal speed. This is called graceful degradation.
Systems designed for graceful degradation are also called fault tolerant.
It is used for detecting, diagnosing and correcting the failures.
It has two processor
1. primary
2. backup
Two copies are maintained in each processor. If one gets failed, other will take
responsibility of failed processor.
1. Symmetric Multiprocessing (SMP)
• Symmetric Multiprocessing, in which each processor runs a copy of
the OS and these communicate with one another as needed
2. Asymmetric Multiprocessing (ASMP)
• Asymmetric Multiprocessing acting as a Master – Slave relationship.
One acting as a client and other acting as a server. If one gets failed
means, other will take copy, it doesn’t perform the operations.

CPU CPU CPU

Memory

Symmetric Multiprogramming System

1.5 Distributed Systems

It is also referred as loosely coupled systems. It consists of a collection of processors that do


not share memory or clock.

4
Instead, each processor has its own local memory. The processors communicate with one
another through various communication lines such as high speed lines or telephone lines.
It has four systems.
1. Computer Networks
2. Client – Server systems
3. Peer – to – Peer systems
4. Distributed operating systems.

1. Computer Networks
A network communication path between two or more systems. It depends on networking for
their functionality. Networks vary by the protocols used, the distance between nodes, and transport
media. It needs an interface device a network adapter.
It deals with
LAN  Local Area Network
Computers within a room, floor or a building
WAN  Wide Area Network
Usually links buildings, cities or countries.
MAN  Metropolitan Area Network
It could link buildings within a city.

2. Client – Server Systems:


Server systems to satisfy requests generated by client systems.
It can be categorized as
1. Compute Server Systems
2. File Servers Systems

Compute Server Systems


It provides an interface to which a client can send requests to perform an action, tha
server executes the action and sends back result to the client.

Client Client Client

Server

General Structure of Client – Server System.

2. File Server Systems


It provides a file system interface where client can create, update, read, and delete files.

3. Peer – to – Peer Systems

5
In a Peer – to Peer systems, services can be provided by several nodes distributed throughout the
network.
In this, a node first join the network of peers, once a node has joined the network, it provides
services to requesting and response services are accomplished in following ways:
1. when a node joins network, it register its service and its centralized service on the network.
2. Client acting as a client must first discover what node provides a desired service by
broadcasting a request for the service to all other nodes in the network.

4. Distributed Operating Systems:

A network operating system that provides features such as file sharing across the network and
that includes communication schemes that allow different processes on different computers exchange
messages.

1.6 Clustered Systems

Clustered systems gather together multiple CPUs to accomplish computational work.


 Shares storage
 Used to provide high availability.
o If the monitored machine gets failed monitoring machine gets failed, monitoring
machine takes ownership of its storage and restart the application.
o It has two types
 Symmetric Cluster
Two or more hosts are running applications, and they are monitoring each
other.
 Asymmetric Cluster
One machine is in hot – standby mode while the other is running the
application. Hot –stand- by host does nothing but monitor the active server.

1.7 Real Time Systems

What are the project or applications are mapped with Real time applications can be referred as
Real time systems.
It has 2 types
1. Hard Real Time Systems
2. Soft Real Time Systems.

Hard Real Time Systems


• More complicated task can be performed.
• Non volatile means when the power is switched off, the contents of the file can be retained.
• More advanced OS features are present.

Soft Real Time Systems


• It sets the priority for performing complicated task.
• Volatile means when the power is switched off, the contents of the file cannot be retained.

6
• Most advanced features of OS features absent too.

1.8 Hardware Protection


Early operating systems were called resident monitor.
• To improve system utilization, OS began to share system resources among several programs
simultaneously.
• If not sharing means, error occurs. This sharing improves both utilization and problems.
• It has four functions / objectives
1. Dual- mode operation
2. I/O protection
3. memory protection
4. CPU protection

Dual – mode operation:


To ensure proper operations, we must protect the operating system and all the programs and
their data from any malfunctioning program.
Protection is needed for any shared resource.
Two modes of operation are present
1. user mode
2. monitor mode / supervisor mode/ system mode/ privileged mode.

A bit, called mode bit and the hardware (means resources of the program) to indicate
current mode
User mode  1
Monitor mode  0
Bit checks  whether task performs on behalf of OS or an behalf of the user.
At system boot time, the hardware starts in monitor mode. The operating system is then loaded
and starts user processes in user mode. Whenever trap/interrupt occurs, hardware switches from user
mode to monitor mode.
The lack of a hardware supported dual mode can cause serious shortcomings in the operating
system.

I/O protection:

7
To prevent users from performing illegal I/O are define all I/O instructions to be privileged
instructions. Thus users cannot issue I/O instruction directly, they must do it through the OS by means
of a system call.

Case n Resident monitor

.
1. trap to monitor read 2. perform I/O

. 3. return to user
system call n
User program
.

1. At initial stage program in monitor mode.


2. Performing I/O operations using read command in user mode.
3. After performing I/O, returns to user done by system call.
Case n -> deals with number of programs

Memory protection

• To ensure correct operation, we must protect the interrupt vector from modification by a
user program.
• Two registers are used
1. Spooling
2. Buffering
• We can provide this protection by using two registers.
1. Base registers -> smallest legal physical memory address.
2. Limit register -> size of the range.

0
Monitor
256000
Job1
300040 300040 base register
Job2
420940
Job3 120900 Limit register
880000
Job4
10240000

(i.e.) 300040(base) – 420940 = 120999 (Limit)

8
The base and limit register can be loaded only by the operating system.

300040 + -> base


120900 -> limit
--------------
420940
---------------

CPU Operation
Protectin cpu, by ensuring OS maintain control. We must prevent stuck from the user
program by using timer.
- A timer can be set to interrupt the computer after a specified period. The period
may be fixed / variable.
- maintains time and time slicing

Base + limit

Address yes no
CPU
>= <

no no

Error Error Memory

36000 > 35000 (yes) => 36000 < 37000 (yes) => fetches into memory

1.9 System Components

We can create a system as large and complex as an operating system only by partitioning it into
smaller pieces, each piece should be a well – defined portion of the system, with carefully defined
inputs, outputs and functions.

The various system components are


• Process Management
• Main memory Management
• I/O system Management

9
• File Memory Management
• Secondary storage Management
• Networking Management
• Protection Management
• Command – Interpreter System

Process Management

A set of instructions not complied is called program.


A process can be thought of as a program in execution, but its definition. (or)
A time shared user program such as a compiler is a process. (or)
A word processing program being run by an individual user on a PC is a process. (or)
A system task, such as sending output to a printer, is also a process.
Thus, a process need resources such as
 CPU Time
 Memory
 Files
 I/O devices

Here program is a passive entity, such as the contents of a file stored on disk, whereas process is
an active entity, with a program counter specifying the next instruction to execute. The execution of a
process must be sequential.
The operating system is responsible for the following activities in connection with process
management:
• Creating and deleting both user and system processes.
• Suspending and resuming processes.
• Providing mechanisms for process synchronization.
• Providing mechanisms for process communication.
• Providing mechanisms for deadlock handling.

Main Memory Management

The main memory is central to the operation of a modern computer system. Main memory is a
large array of words or bytes, ranging in size form hundreds of thousands to billions. Each word or
byte has its own address. Main memory is a repository of quickly accessible data shared by the CPU
and I/O devices.
Many different memory – management schemes are available, and the effectiveness of the
different algorithms depends on the particular situation.
The operating system is responsible for the following activities in connection with memory
management:
• Keeping track of which parts of memory are currently being used and by whom.
• Deciding which processes are to be loaded into memory when memory space becomes
available.
• Allocating and de allocating memory space as needed.
File Management

10
File management is one of the most visible components of operating systems. Computers can
store information on several different types of physical media. Magnetic tape, Magnetic disk and
optical disk are the most common media. Each of these media has its own characteristics and physical
organization. Each medium is controlled by a device, such as a disk drive or tape drive, that also has
unique characteristics. These properties include access speed, capacity, data transfer rate and access
method.
The operating system is responsible for the following activities in connection with file
management:
• Creating and deleting files
• Creating and deleting directories
• Supporting primitives for manipulating files and directories
• Mapping files onto secondary storage
• Backing up files on stable (nonvolatile) storage media.
I/O System Management

One of the purposes of an operating system is to hide the peculiarities of specific hardware
devices form the user.
The I/O subsystem consists of
• A memory – management component that includes buffering, caching and spooling.
• A general device – driver interface.
• Drivers for specific hardware devices.

Secondary storage management

The main purpose of a computer system is to execute programs. These programs, with the data
they access, must be in main memory, or primary storage, during execution.
The operating system is responsible for the following activities in connection wit disk
management:
• Free – space management
• Storage allocation
• Disk scheduling.

Networking

Distributed system is a collection of processors that do not share memory, peripheral devices, or a
clock.
Each processor has its own local memory and clock, and the processors communicate with one
another through various communication lines, such as high – speed buses or networks.
The processors in a distributed system vary in size and function. They may include small micro
processors, workstations, minicomputers and large, general – purpose computer systems.

Protection System

If a computer system has multiple users and allows the concurrent execution of multiple proceses,
then the various processes must be protected from one another’s activities.

11
Protection can improve reliability by detecting latent errors at the interfaces between component
subsystems. Early detection of interface errors can often prevent contamination of a healthy subsystem
by another subsystem that is malfunctioning.

Command – Interpreter System

One of the most important systems programs for an operating system is the command interpreter,
which is the interface between the user and the operating system.
Some of the operating systems include the command interpreter in the kernel.
When a new job is started in a batch system, or when a user logs on to a time – shared system, a
program that reads and interprets control statements is executed automatically.
This program is sometimes called the control – card interpreter or the command- line interpreter,
and is often known as the shell.
Its function is simple. To get the next command statement and execute it.

1.10 Handheld Systems

Handled systems includes personal Digital Assistants (PDAs) such as palm, pocket – pcs/ cellular
telephones.
The main challenge of this type system is to make limited size of the system.
So, it holds small amount of storage space. One approach for displaying the content in webpage in
web clipping where only a small subset of a web page is delivered and displayed on the handheld
device.

1.11 Operating System Services

An operating system provides an environment for the execution of programs, one set of OS
services provides functions that are helpful to the user.
1. Program execution:
The system must be able to load a program into memory and run that program.
2. I/O Operations:
A running program may require I/O which may involve file or an I/O device.
3. File System manipulation:
Programs need to read and write files and directions. They also need to create and delete
then by name, search for a given file, and list file information.
4. Communications:
One process needs to communicate with another process by exchanging or passing
messages between them.
5. Error detection:
The OS constantly needs to be aware of possible error. Errors may be detected by OS in
the programs.
6. Resource Allocation:
When there are multiple users or multiple jobs running at the same time, resources must be
allocated to each of them. Different types of resources are managed by the OS.

12
OS allocates, what are the resources are required to execute the program which can be
done by OS.
7. Accounting:
• It maintains what are the resources are used for the program.
• Status of the program.
• Condition code (CC) of the program can be maintained by OS.
8. Protection and Security:
Protection involves ensuring that all access to system resources is controlled security of the
system from outsiders is also important.

1.12 SYSTEM CALLS

- System call provide the interface between a process and the operating system. These calls
are available in assembly language instructions.
- Certain systems allow calls to be made directly from a higher level language program.
- To include function call. In terms of user defined program, contains two parts
1. Main program
2. function
Which is invoked by the call statement.
- The user can then use the mouse to select the source name, and a window can be opened for
the destination name to be specified. It require many I/O system calls.
- Once the two files names are obtained program must open the input file and create the
output file. Each operations require another system call if we are opening file means OS checks
whether the proper is existing / not. If the input file exists, we must create the output file. Each
requires system call.
- System calls over in different ways, depending on the computer use. Often, more inform is
required than simply the identity of the desired system call. The exact type and amount of
information vary according to the particular operating system and call.
- Three general methods are used to pass parameters to the operating system.
1. The simplest approach is to pass the parameters in registers.
2. In some cases, there may be more parameters in registers. Here paramentes are
and address of the block is passed as a parameter in a register.
3. Parameters stored in stack => PUSH approach.

X: Parameters for X (register)


call

Load address x

System call 13 Use parameters


FIG : Passing parameters as a table from table X
In this diagram, passing parameters as a tables through registers.
It contains following objectives

13
1. process control
2. file management
3. device management
4. information management
5. communications.

Process Control
A running program needs to be able to halt its execution either normally / abnormally.
A program in execution can be referred as process. Process can be controlled by detecting the
errors. Using following objectives process can be controlled.
1. end , abort
2. load, execute
3. create process, terminate process
4. get process attributes, set process attributes
5. wait for time
6. wait event, signal event
7. allocate and free memory.
 end means, if the program is successfully completed. Abort means, if the program is not
successfully completed, then this program will be aborted.
 at initial stage program will be loaded from main memory to buffer and executed.
 getting attributes of the process such as,
• name of the process
• memory space
• speed execution of the process
• what are the resources are utilized.
Depends on this information it sets the attribute. If memory space needed for storing of
program, which can be allocated, if a program can be deleted from the secondary storage, free
space can be managed for the future use. Free memory

Process
Free memory

Command interpreter
Command interpreter

kernel
kernel

At system startup
Running a program
FIG: MS – DOS execution

14
 At system startup, free memory, command interpreter and kernel is available because no process
is loaded.
 During execution of a program, free memory, process, command interpreter and kernel is
available.
 If we run more number of programs, structure looking like the following

Process D

Free memory

Process C

Interpreter

Process B

Kernel

FIG : UNIX running multiple programs


Process D and process C can be interpreted by command interpreter and also process B. Finally three
programs can be executed.

File Management
File manipulation are performed.
They are
File creation
Deletion
Renaming a file
Modifying a file contents
Creating files and directories are performed.
Device Management
A program as it is running may need more resources. Additional resources are more money, more
clock, more I/O devices of the system has multiple users, we must first request the device, to ensure
exclusive use of it. After we finished the device, we should release the device.

Information Management

15
System maintaining the following information
1. system have a system call to return the current time and date.
2. other system call may return information about the system, such as the number of current
users, the version number of the OS, the amount of free memory or disk space and so on.
3. it also maintains get process attributes and sets process attributes.
Communication:
There are two common models for communication
1. message passing model
2. shared memory model
In message passing model, information is exchanged through an interprocess – communication
facility provided by the OS.
Before communication can take place, a condition must be opened. The name of the other
communicator must be known be it another process on the same CPU / Process on another
computer connected by a communications network.

Process A Process A
M
Shared memory
Process B M
Process B

Kernel M Kernel

Message Passing Shared Memory

In shared memory, processes use map memory system calls to gain access to regions of
memory owned other processes. They may then exchange information by reading and writing data in
the shared area. Process 1 / shares memory and process 2 shares memory.

1.13 SYSTEM PROGRAMS

System programs provide a convenient environment for program development and execution. It
can be divided into following categories.
1. File Management
These programs create, delete, copy, rename, print, dump, list and manipulate files and
directories.

2. Status Information

16
It deals with the amount of memory or disk space, numbers of users, date , time / similar status
information.

3. File Modification
Before modifying files, we should check whether the file is existing / not. If it is existing we
can modify the files, if not error occurs.

4. Programming – Language Support


Compilers,assemblers and interpreters for common programming languages.

5. Program loading and execution


Once the program is assembled or compiled, it must be loaded into memory to be executed.
The system may provide loaders, linkage editors…

6. Communication
Each process should be communicated by passing messages. Since it is sharing the resources
between then.
In addition to system progress, most OS an supplied in the programs that are useful in solving
common problems or performing common problems.
Performing common operation
Such programs include web browsers, word processors and text formatters,
spreadsheets, database system – complier , plotting and statistical analysis packages and ganus.
These programs are known as system utilities or application programs.

1.14 System Structures

Monolithic kernels (the ``big mess'' according to Tanenbaum) led to interest in more structured
operating systems, such as layering and better structuring. Look at Unix history and slide.

From there work began on taking functionality out of the kernels and making them much smaller--
``micro'' versions.

Microkernels

Look at organization in Figure 4.9 (Stallings). Layered operating system example is Xinu-- ``a small,
elegant operating system''.

Philosophy of microkernel is to have the bare essentials in the kernel.

Benefits of microkernels:

• uniform interfaces--same for kernel and user-level services


• extensibility--can add new services
• flexibility--can subtract/modify services
• portability--easier to port operating system because os-specific part is smaller

17
• reliability--smaller kernel makes its implementation likely to be more reliable. Also more well-
defined APIs.
• distributed system support--pieces can be on another machine.
• object-oriented operating system--architecture works in OO context.

Performance of such microkernels (Mach and Chorus) has been the concern. Approaches to improve
performance (co-location of services in the kernel) go against microkernel idea.

Mach Operating System

One such system is Mach, which was developed at CMU. Mach was used as the basis for work on
OSF/1, which was adopted by some companies such as Digital. The version of OSF/1 running on
Digital Alpha machines is currently known as Digital Unix.

Windows NT Operating System and Beyond

Single-user, multitasking operating system designed to run on a variety of PCs and workstations.

Uses a modified microkernel architecture (Figure 2.13)--some system services are in the kernel for
performance reasons.

Hardware Abstraction Layer (HAL) contains hardware-specific code.

Windows NT works with objects.

Paging is done in the kernel as well as all I/O.

Provides kernel level threads.

Uses local procedure call (optimized message-passing mechanism) for communication.

The server processes at the user level basically provide different interfaces. Most common is Win32
subsystem--in fact other user-level services must go through Win32 subsystem.

1.15 Virutal Machines


Virtualization is a software technology that allows a user to create and run multiple operating
environments on a server at the same time. Each operating environment, or virtual machine (VM),
requires its own operating system and can run applications independently.

Virtualization can be used to run different applications that are each compatible with different
operating system (OS) versions on the same server. For example, an accounting system that requires
Windows NT Server 4.0 might be installed on a virtual machine with a Windows NT 4.0 OS, even if
the server on which the virtual machine is installed is running Windows 2000 Server. Virtualization
also might be used in a development environment to test applications on different OS’s. This brief

18
describes virtualization and alternative technologies, covers several volume licensing issues related to
virtual machines, and offers answers to FAQs.

Virtualization is one of several technologies that enable multiple applications and, in some
cases, multiple operating systems to function simultaneously on the same hardware. The main
alternatives to virtualization are workload management and partitioning. Each offers a solution to a
different set of customer needs.

Virtual machines offer maximum flexibility by giving system administrators a quick and easy
way to establish different OS environments on a single physical machine. The OS environments are
logically isolated from each other, but share many of the same hardware and software resources of the
server, including its processors. Consequently, a failure on any of these shared resources can affect
multiple virtual machines.

Hardware partitioning, by contrast, creates blocks, or partitions, out of a single, multi-processor


server, such that each will run its OS as if a physically separate machine. Unlike virtual machines,
hardware partitions are physically isolated from each other and cannot share processors. Customers
use this technology to avoid single points of failure. Hardware partitioning is generally less flexible
than virtualization, requiring a re-boot to set up or make changes, for example.

Examples of virtualization

Example 1: Customer migrates a legacy line-of-business (LOB) application from a 1-way server
running Windows NT 4.0 onto a 2-way server running Windows Server 2003 with a virtual machine
running Windows NT 4.0

19

You might also like