Professional Documents
Culture Documents
INTRODUCTION
Operating System acts as an intermediary between the user of a computer and the computer
hardware. The purpose of an operating system is to provide an environment in which a user can
execute programs in a convenient and efficient manner.
Components of Computer system A computer system can be divided roughly into four
components:
1. Hardware
2. Operating system
3. Application programs
4. Users
● Hardware such as Central processing unit (CPU), Memory and the Input/Output (I/O)
devices provides the basic computing resources for the system.
● Application programs such as word processors, spreadsheets, compilers and Web
browsers define the ways in which these resources are used to solve users’ computing
problems.
● Operating system controls the hardware and coordinates its use among the various
application programs for the various users. Operating system provides an Environment
within which other programs can do useful work.
From the computer’s point of view an operating system is viewed as a Resource Allocator and a
Control Program.
● The operating system acts as the manager of the resources such as CPU time, memory space,
file-storage space, I/O devices and so on. Resource allocation is important where many users
access the same mainframe or minicomputer.
● An operating system is a control program that manages the execution of user programs to
prevent errors and improper use of the computer. It is especially concerned with the operation
and control of I/O devices. Note: Resource utilization means how various hardware and
software resources are shared.
2. USER VIEW OF OPERATING SYSTEM
The user’s view of the computer varies according to the Interface being used.
● Operating system is software that is used for controlling and allocating resources. The
fundamental goal of computer systems is to execute user programs and to make solving user
problems easier. Computer hardware alone is not easy to use, application programs are developed.
These programs require certain common operations such as controlling the I/O devices.
● The operating system is also defined as the program that is running at all times on the computer is
called the Kernel.
COMPUTER-SYSTEM ARCHITECTURE
A computer system can be categorized according to the number of general-purpose processors used.
1. Single-Processor Systems
2. Multi-Processor Systems
3. Clustered systems
● Single processor system has one main CPU capable of executing a general-purpose instruction set
from system processes and user processes.
● All single processor systems have other special-purpose processors also. They come in the form
of device-specific processors such as disk, keyboard and graphics controllers, I/O processors etc.
● These special-purpose processors runs a limited instruction set and do not run user processes.
They are managed by the operating system.
● Operating system sends information about their next task to these processors and monitors their
status.
● Example: A disk-controller microprocessor receives a sequence of requests from the main CPU
and implements its own disk queue and scheduling algorithm. This arrangement relieves the main
CPU of the overhead of disk scheduling. Note: The use of special-purpose microprocessors does
not turn a single-processor system into a multiprocessor.
Multi-Processor system
● Multi-processor systems have two or more processors that share the resources such as computer
bus, memory, clock and peripheral devices. Multiprocessor systems have three main advantages:
i. Increases the throughput: By increasing the number of processors more work will be done
in less time (i.e.) the speed of the system will increases.
ii. Economy of scale: Multiprocessor systems share peripherals, mass storage and power
supplies; hence the cost is less as compared to single-processor systems.
iii. Increased reliability: In single processor system if the processor fails the entire system
fails, but in multi-processor system if processor fails then the entire system will not fail,
other processor will pick up and shares the work of failed processor.
1. Asymmetric multiprocessing
2. Symmetric multiprocessing
● Each processor has its own set of registers and cache memory and all processors share
physical memory.
● In SMP if there are N CPU’S then N processes can run without causing performance
degradation.
● It is the most common used system. All modern operating systems including Windows,
Mac OS X and Linux provide support for SMP.
Multicore processors
● Multicore processors are special type of multiprocessors in which multiple computing cores
reside on a single chip. Each core has its own register set and its own local cache.
● These are more efficient than multiple chips with single cores because on-chipcommunication is
faster and one chip with multiple cores uses less power than multiple single-core chips.
The below figure shows dual-core design with two cores on the same chip
Clustered Systems
∙ Clustered computers share storage and are closely linked via a local-area network LAN.
∙ Clustering is usually used to provide High-availability service (i.e.) service will continue even if
one or more systems in the cluster fail. Clustering can be structured Asymmetrically or
Symmetrically.
● In Asymmetric clustering, one machine is in Hot-Standby mode while the other is running the
applications. The hot-standby host machine only monitors the active server. If the active server
fails, the hot-standby host becomes the active server.
● In Symmetric clustering, two or more hosts are running applications and are monitoring each
other. This structure is obviously more efficient, as it uses all of the available hardware. Parallel
clusters: parallel clustering allow multiple hosts to access the same data on shared storage. The
clustering is done over Wide Area Networks (WAN’s).
⮚ Process Management:- A process is a program in execution. A program does nothing unless its
instructions are executed by a CPU. Example:
1. A time-shared user program such as a compiler is a process.
2. A word-processing program being run by an individual user on a PC is a process.
3. A system task such as sending output to a printer is a process.
● A process needs certain resources including CPU time, memory, files and I/O devices to
accomplish its task.
● These resources are either given to the process when it is created or allocated to it while it∙ is
running.
● A program is a passive entity, like the contents of a file stored on disk, whereas a process∙ is an
active entity.
● The CPU executes one instruction of the process after another until all instructions in that∙
process completes.
● At any time, at most only one instruction is executed on behalf of the process.
● A process is the unit of work in a system. A system consists of a collection of processes such as
operating-system processes and user processes.
● Operating system process executes system code whereas user processes executes user code.
The operating system is responsible for the following activities of process management:
⮚ MEMORY MANAGEMENT:-
● Main memory is a large array of bytes. Each byte has its own address. Main memory is a
repository of quickly accessible data shared by the CPU and I/O devices.
● A program to be executed, it must be mapped to absolute addresses and loaded into memory.
● As the program executes, it accesses program instructions and data from main memory by
generating these absolute addresses.
● The program terminates, its memory space is declared available and the next program can be
loaded and executed.
● Memory management is needed to improve both CPU utilization and computer speed.
2. Deciding which processes and data to move into the memory and move out of memory.
3. Keeping track of which parts of memory are currently being used and who is using them.
The operating system is responsible for the following activities in connection with disk
management: Free-space management, Storage allocation, Disk scheduling.
⮚ Caching:- Cache is faster storage system used to store the information temporarily and the size of
cache is very small.
● Information is normally kept in storage systems such as main memory. As it is used, it is
copied into the cache on a temporary basis.
● When we need a particular piece of information, we first check whether it is in the cache.
● If information is in cache then we use the information directly from the cache.
● If information is not cache, we use the information from the source, putting a copy in the
cache.
⮚ I/O Systems:- One of the purposes of an operating system is to hide details of specific hardware
devices from the user. Only the device driver knows details of the specific device. Example: In
UNIX, the peculiarities of I/O devices are hidden from the bulk of the operating system itself by
the I/O subsystem. The I/O subsystem consists of several components:
● A memory-management component that includes buffering, caching and spooling
∙ A general device-driver interface
∙ Drivers for specific hardware devices.
Batch processing was very popular in the 1970s. The jobs were executed in batches. People used to have a
single computer known as a mainframe. Users using batch operating systems do not interact directly with
the computer. Each user prepares their job using an offline device like a punch card and submitting it to
the computer operator. Jobs with similar requirements are grouped and executed as a group to speed up
processing. Once the programmers have left their programs with the operator, they sort the programs with
similar needs into batches.
The batch operating system grouped jobs that perform similar functions. These job groups are treated as a
batch and executed simultaneously. A computer system with this operating system performs the following
batch processing activities:
1. A job is a single unit that consists of a preset sequence of commands, data, and Programs.
2. Processing takes place in the order in which they are received, i.e., first come, first serve.
3. These jobs are stored in memory and executed without the need for manual information.
4. When a job is successfully run, the operating system releases its memory.
Advantages:
Increased performances as a new get started as soon as the previous job finished without any
manual intervention.
Disadvantage
1. Lack of interaction between the user and job.
2. CPU is often idle, because the speeds of the mechanical I/O devices are slower than CPU.
2. Multiprogramming
Sharing the processor, when two or more programs reside in memory at the same time, is
referred as multiprogramming. Multiprogramming assumes a single shared processor.
Multiprogramming increases CPU utilization by organizing jobs so that the CPU always
has one to execute. The following figure shows the memory layout for a
multiprogramming system.
An OS does the following activities related to multiprogramming.
● The operating system keeps several jobs in memory at a time.
● This set of jobs is a subset of the jobs kept in the job pool.
● The operating system picks and begins to execute one of the jobs in the memory.
● Multiprogramming operating systems monitor the state of all active programs
and system resources using memory management programs to ensure that the
CPU is never idle, unless there are no jobs to process.
Advantages
Disadvantages
4. These systems are referred as loosely coupled systems where each processor has its own
local memory and processors communicate with one another through various
communication lines.
5. By loosely coupled systems, means that such computers possess no hardware
connections at the CPU - memory bus level(no memory sharing).
● The Distributed OS involves a collection of autonomous computer systems, capable
of communicating and cooperating with each other through a LAN / WAN.
Advantages
● resource sharing facility, a user at one site may be able to use the resources
available at another.
● Reliable - Failure of one site in a distributed system doesn’t affect the others, the
remaining sites can potentially continue operating.
● Reduction of the load on the host computer.
● Reduction of delays in data processing.
6. Network Operating System – These systems run on a server and provide the capability to
manage data, users, groups, security, applications, and other networking functions. These types of
operating systems allow shared access of files, printers, security, applications, and other
networking functions over a small private network. One more important aspect of Network
Operating Systems is that all the users are well aware of the underlying configuration, of all other
users within the network, their individual connections, etc. and that’s why these computers are
popularly known as tightly coupled systems.
The main feature, objective, and purpose of the Multiprocessors are to provide high speed at a
low cost in comparison to a uniprocessor.
Multiprocessing is the use of two or more central processing units (CPUs) within a single
computer system.
Multiprocessing also refers to the ability of a system to support more than one processor and or
the ability to allocate tasks between them.
The term processor in multiprocessor can mean either a CPU or an input-output processor (IOP).
Types of Multiprocessor
There are mainly two types of multiprocessor systems.
Asymmetric and symmetric multiprocessors are the two basic types of multiprocessors. The
following are the specifications:
All of the processors are in a peer-to-peer arrangement, which means that there is no master-slave
relationship between them.
1. Simple Structure:- Such operating systems do not have well defined structure and are
small, simple and limited systems. The interfaces and levels of functionality are not well
separated. MS-DOS is an example of such operating system. In MS-DOS application
programs are able to access the basic I/O routines. These types of operating system cause
the entire system to crash if one of the user programs fails.
Diagram of the structure of MS-DOS is shown below.
Advantages of Simple structure:
● It delivers better application performance because of the few interfaces between the
application program and the hardware.
● Easy for kernel developers to develop such an operating system.
Disadvantages of Simple structure:
● The structure is very complicated as no clear boundaries exists between modules.
● It does not enforce data hiding in the operating system.
2. Layered Structure:-
● An OS can be broken into pieces and retain much more control on system. In this
structure the OS is broken into number of layers (levels). The bottom layer (layer 0) is
the hardware and the topmost layer (layer N) is the user interface.
● These layers are so designed that each layer uses the functions of the lower level
layers only.
● This simplifies the debugging process as if lower level layers are debugged and an
error occurs during debugging then the error must be on that layer only as the lower
level layers have already been debugged.
● The main disadvantage of this structure is that at each layer, the data needs to be
modified and passed on which adds overhead to the system. Moreover careful
planning of the layers is necessary as a layer can use only lower level layers. UNIX is
an example of this structure.
Advantages of Layered structure:
● Layering makes it easier to enhance the operating system as implementation of a
layer can be changed easily without affecting the other layers.
● It is very easy to perform debugging and system verification.
Disadvantages of Layered structure:
● In this structure the application performance is degraded as compared to simple
structure.
● It requires careful planning for designing the layers as higher layers use the
functionalities of only the lower layers.
3. Monolithic Kernel:- Monolithic Kernel is another classification of Kernel. Like
microkernel, this one also manages system resources between application and hardware, but
user services and kernel services are implemented under the same address space. It increases
the size of the kernel, thus increasing the size of the operating system as well. This kernel
provides CPU scheduling, memory management, file management, and other operating
system functions through system calls. As both services are implemented under the same
address space, this makes operating system execution faster.
4. Microkernel:- A microkernel is one of the classifications of the kernel. Being a kernel it
manages all system resources. But in a microkernel, the user services and kernel services are
implemented in different address spaces. The user services are kept in user address space,
and kernel services are kept under kernel address space, thus also reduces the size of kernel
and size of an operating system as well.
Microkernel Architecture –
Since the kernel is the core part of the operating system, so it is meant for handling the most
important services only. Thus in this architecture, only the most important services are inside
the kernel and the rest of the OS services are present inside the system application program.
Thus users are able to interact with those not-so-important services within the system
application. And the microkernel is solely responsible for the most important services of the
operating system they are named as follows:
● Inter process-Communication
● Memory Management
● CPU-Scheduling
Some key features of microkernel-based operating systems include:
● Small and simple kernel: The microkernel is designed to be as small and simple as
possible, containing only the basic functions needed to manage system resources, such as
memory, processes, and interprocess communication.
● Modular design: Most of the operating system’s services and drivers are moved into user
space, where they can be loaded and unloaded as needed. This allows for a more modular
and flexible design, and makes it easier to add or remove functionality from the system.
● Message passing: Communication between different parts of the operating system is
typically done using message passing, rather than shared memory. This provides a more
secure and reliable way to exchange information between processes, and helps prevent
bugs and errors from propagating throughout the system.
● Extensibility: The microkernel design makes it easier to add new functionality to the
operating system, since new services and drivers can be added to user space without
modifying the kernel itself.
● Security: By separating the kernel from most of the operating system’s services,
microkernel-based operating systems can be more secure, since bugs and vulnerabilities
in user-space code are less likely to affect the kernel. Additionally, microkernel-based
systems often use formal verification techniques to ensure the correctness of the kernel’s
code.
Advantages of Microkernel –
● Modularity: Because the kernel and servers can be developed and maintained
independently, the microkernel design allows for greater modularity. This can make
adding and removing features and services from the system easier.
● Fault isolation: The microkernel design aids in the isolation of faults and their prevention
from affecting the entire system. If a server or other component fails, it can be restarted
or replaced without causing any disruptions to the rest of the system.
● Performance: Because the kernel only contains the essential functions required to manage
the system, the microkernel design can improve performance. This can make the system
faster and more efficient.
● Security: The microkernel design can improve security by reducing the system’s attack
surface by limiting the functions provided by the kernel. Malicious software may find it
more difficult to compromise the system as a result of this.
● Reliability: Microkernels are less complex than monolithic kernels, which can make them
more reliable and less prone to crashes or other issues.
● Scalability: Microkernels can be easily scaled to support different hardware architectures,
making them more versatile.
● Portability: Microkernels can be ported to different platforms with minimal effort, which
makes them useful for embedded systems and other specialized applications.
● Process table contains a per process region table whose entry points to entries in
region table.
● Kernel loads an executable file into memory during ‘exec’ system call’.
● It decides which process should be allocated to processor to execute and which
process should be kept in main memory to execute.
● It basically acts as an interface between user applications and hardware.
● The major aim of kernel is to manage communication between software i.e.
user-level applications and hardware i.e., CPU and disk memory.
Objectives of Kernel :
S.
Parameters Microkernel Monolithic kernel
No.
In microkernel, user
In monolithic kernel, both user
services and kernel
1. Address Space services and kernel services are kept
services are kept in
in the same address space.
separate address space.
To implement IPC
messaging queues are used Signals and Sockets are utilized to
9. Communication
by the communication implement IPC in monolithic kernels.
microkernels.
OPERATING-SYSTEM SERVICES
An Operating system provides an environment for the execution of programs. OS
provides certain services to programs and to the users of those programs.
Operating system services are provided for the convenience of the programmer and to
make the programming task easier.
The list of Operating system services that are helpful to the user:
1. User interface
2. Program Execution
3. I/O Operation
4. File system manipulation
5. Communication
6. Error Detection
7. Resource allocation
8. Accounting
9. Protection and Security
1. User Interface
Almost all operating systems have a User Interface (UI). An UI is generally of 3 types:
● Command-Line Interface (CLI) uses text commands and a method for entering them.
● Batch Interface: The commands and directives to control those commands are entered
into files and those files are executed.
● Graphical User Interface (GUI) is a window system with a pointing device (i.e. mouse)
to direct I/O, choose from menus and make selections and a keyboard to enter text.
2. Program Execution
The system must be able to load a program into main memory and to run that program. The
program must be able to end its execution, either normally or abnormally.
3. I/O operations
A running program may require I/O, which may involve a file or an I/O device. Example are
blanking a display screen, recording to a CD or DVD drive or.
4. File-system manipulation
● Programs need to read and write files and directories.
● They need to create and delete them by name, search for a file and list file information.
● Operating systems include permissions management to allow or deny access to files or
directories based on file ownership.
5. Communications
● One process in its life time needs to communicate with another process to exchange
information.
● Communication occurs between processes that are executing on the computer.
● Communications may be implemented via Shared Memory or Message Passing.
● In Shared memory communication two or more processes read and write to a shared
section of memory.
● In Message passing communication the packets of information in predefined formats are
moved between processes by the operating system.
6. Error Detection
The operating system needs to be detecting and correcting errors constantly. The different
types of errors occurred are:
● CPU and Memory hardware errors such as a memory error or a power failure.
● I/O devices errors such as a parity error on disk, a connection failure on a network, or
lack of paper in the printer
● User Program errors such as an arithmetic overflow, an attempt to access an illegal
memory location.
● For each type of error, the operating system should take the appropriate action to ensure
correct and consistent computing.
7. Resource Allocation
● When there are multiple users or multiple jobs running at the same time, resources must
be allocated to each of them.
● Operating system resources are CPU cycles, main memory, file storage, I/O devices etc.
The operating system manages many of these resources.
● CPU cycles, main memory and file storage may have special allocation code. I/O devices
may have much more general request and release code.
● In determining how best to use the CPU, operating systems have CPU-scheduling
routines that take into account the speed of the CPU, the jobs that must be executed, the
Number of registers available and other factors.
● There may also be routines to allocate printers, USB storage drives and other peripheral
devices.
8. Accounting
● Operating system keeps track of different kind of resources used by all users.
● This record keeping may be used for accounting so that users can be billed or simply for
accumulating usage statistics.
● Usage statistics are valuable tool for researchers who wish to reconfigure the system to
improve computing services.
9. Protection and security
● Protection ensures that all access to system resources is controlled because when several
separate processes execute concurrently, it should not be possible for one process to
interfere with the others or with the operating system itself.
● Security of the system defends the system from outsider’s attacks such as invalid access
of system resources such as I/O devices etc. Security starts with user authentication by
providing username and password to gain access to system resources.