Operating System (OS)
An Operating System is a program that manages a computer's hardware. It also provides a basis for
application programs and acts as an intermediary between the computer user and the computer hardware.
An amazing aspect of operating systems is how they vary in accomplishing these tasks. Mainframe
operating systems are designed primarily to optimize utilization of hardware. Operating Systems for
mobile computers provide an environment in which a user can easily interface with the computer to
execute programs. Thus, some operating systems are designed to be convenient, others to be efficient,
and others to be some combination of the two.
Before we can explore the details of computer system operation, we need to know something about
system structure. We thus discuss the basic functions of system startup, I/O, and storage early in this unit.
We also describe the basic computer architecture that makes it possible to write a functional operating
system.
Because an operating system is large and complex, it must be created piece by piece. Each of these pieces
should be a well-delineated portion of the system, with carefully defined inputs, outputs, and functions. In
this unit, provide a general overview of the major components of contemporary computer system as well
as the functions provided by the operating system.
user1 user 2 user 3 ..…. user
n
compiler assemblerSystem and application
text editorprograms ….. database system
Operating System (OS)
Computer hardware
Figure: Abstract view of the components of a computer system with operating system.
1.1 What Operating System Do
We begin our discussion by looking at the operating system's role in the overall computer system. A
computer system can be divided roughly into four components: the hardware, the operating system, the
application programs, and the users (figure:)
The hardware- provides the basic computing resources for the system. The application-define the
ways in which these resources are used to solve user's computing problems. The operating system
controls the hardware and coordinates its use among the various application programs for the various
users.
We can also view a computer system as consisting of hardware, software, and data. The operating
system provides the means for proper use of these resources in the operation of the computer system.
1.2 Defining Operating Systems
How, then, can we define what an operating system is? In general, we have no completely adequate
definition of an operating system. Operating systems exist because they offer a reasonable way to
solve the problem of creating a usable computing system. The fundamental goal of computer systems
is to execute user programs and to make solving user problems easier. Computer hardware is
constructed toward this goal. Since bare hardware alone is not particularly easy to use, application
programs are developed. These programs require certain common operations, such as those
controlling the I/O devices. The common functions of controlling and allocating resources are then
brought together into one piece of software: the operating system.
The operating system is the one program running at all times on the computer-usually called the
kernel. (Along with the kernel, there are two other types of programs: system programs, which are
associated with the operating system but are not necessarily part of the kernel, and application
programs, which include all programs not associated with the operation of the system.) Mobile
operating systems often include not only a core kernel but also middleware - a set of software
frameworks that provide additional services to application developers. For example, each of the two
most prominent mobile operating systems like Apple's iOS and Google's android features a core
kernel along with middleware that supports databases, multimedia, and graphics ( to name a only
few).
Following are some of important functions of an operating system.
Memory Management
Memory management refers to management of Primary Memory and Main Memory. Main
memory is a large array of words or bytes where each word or byte has its own address.
Main memory provides a fast storage that can be accessed directly by the CPU. For a program to
be executed, it must in the main memory. An Operating System does the following activities for
memory management:
a. Keeping track of which parts of memory are currently being used and who is using them.
b. Deciding which processes (or parts of processes) and data to move into and out of memory.
c. In multiprogramming, the OS decides which process will get memory when and how much.
d. Allocates the memory when a process requests it to do so.
e. De-allocates the memory when a process no longer needs it or has been terminated.
Processor Management
In Multiprogramming environment, the OS decides which processor when and for how much
time. This function is called process scheduling. An Operating System does the following
activities for processor management:
a. Keeps tracks of processor and status of process. The program responsible for this task is known
as traffic controller.
b. Allocates the processor (CPU) to a process.
c. De-allocates processor when a process is no longer required.
d. Scheduling processes and threads on the CPUs.
e. Creating and deleting both user and system processes.
f. Suspending and resuming processes.
g. Proving mechanisms for process synchronization.
h. Proving mechanism for process communication.
Device Management
An Operating System manages device communication via their respective drivers. It does the
following activities for device management.
a. Keeps tracks of all devices. The program responsible for this task is known as the I/O controller.
b. Decides which process gets the device when and for how much time.
c. Allocates the device in the most efficient way.
d. De-allocates devices.
File Management
A file system is normally organized into directories for easy navigation and usage. These
An Operating System does the following activities for file management:
a. Keeps track of information, location, uses, status etc. The collective facilities are often known as
file system.
b. Decides who gets the resources.
c. Allocates the resources.
d. De-allocates the resources.
e. Creating and deleting files.
f. Creating and deleting directories to organize files.
g. Supporting primitives for manipulating files and directories.
h. Mapping files onto secondary storage.
i. Backing up files on stable (non-volatile) storage media.
Security
Security means of password and similar other techniques, it prevents unauthorized access to
program and data. It is the job of security to defend a system from external and internal attacks.
Such attacks spread across a huge range and include viruses and worms, denial-of-service attacks
(which use all of a system's resources and so keep legitimate users out of the system), identity
theft, and theft of service ( unauthorized use of a system).
Prevention of some of these attacks is considered an operating system function on some system,
while other systems leave it to policy or additional software. Due to the alarming rise in security
incidents, operating system security features represent a fast-growing area of research and
implementation.
Control over system performance
It is recording delays between request for a service and response from the system.
Job accounting
It is keeping track of time and resource used by various jobs and users.
Error detecting aids
Production of dumps, traces, errors messages, and other debugging and error detecting aids.
Coordination between other software and users
Coordination and assignment of compilers, interpreters, assemblers and other software to the
various users of the computer systems.
Types of Operating System
Operating Systems are there from the very first computer generation and they keep evolving with time.
We will discuss some of the important types of operating systems which are most commonly used.
Batch Operating System
The users of a batch operating system do not interact with the computer directly. Each user
prepares his job on an off-line device like punch cards and submits it to the computer operator.
To speed up processing, jobs with similar needs are batched together and run as a group. The
programmers leave their programs with the operator and the operator then sorts the programs
with similar requirements into batches.
The problems with Batch Systems are as follows:
a. Lack of interaction between the user and the job.
b. CPU is often idle, because the speed of the mechanical I/O devices is slower than the CPU.
c. Difficult to provide the desired priority.
Time-sharing Operating System
Time-sharing is a technique which enables many people, located at various terminals, to use a
particular computer system at the same time. Time-sharing or multitasking is a logical extension
of multiprogramming. Processor's time which is shared among multiple users simultaneously is
termed as time-sharing.
The main difference between Multi-programmed Batch System and Time-Sharing Systems is that
in case of Multi-programmed batch systems, the objective is to maximize processor use, whereas
in Time-Sharing Systems, the objective is to minimize response time.
Multiple jobs are executed by the CPU by switching between them, but the switches occur so
frequently. Thus, the user can receive an immediate response. For example, in a transaction
processing, the processor executes each user program in a short bust or quantum of computation.
That is, if n users are present, then each user can get a time quantum. When the user submits the
command, the response time is in few seconds at most.
The operating system uses CPU scheduling and multi programming to provide each user with a
small portion of a time. Computer systems that were designed primarily as batch systems have
been modified to time-sharing systems.
Advantages of Time-sharing operating systems are as follows:
a. Provide the advantage of quick response
b. Avoids duplication of software
c. Reduces CPU idle time
Disadvantages of Time-sharing operating systems are as follows:
a. Problem of reliability
b. Question of security and integrity of user programs and data
c. Problem of data communication
Distributed Operating System
Distributed systems use multiple central processors to serve multiple real-time applications and
multiple users. Data processing jobs are distributed among processors accordingly.
The processors communicate with one another through various communication lines ( such as
high-speed buses or telephone line). These are referred as loosely coupled systems or distributed
systems. Processors in a distributed system may vary in size and function. These processors are
referred as sites, nodes, computers, and so on.
The advantages of distributed systems are as follows:
a. With resource sharing facility, a user at one site may be able to use the resources available at
another.
b. Speedup the exchange of data with one another via electronic mail.
c. If one site fails in a distributed system, the remaining sites can potentially continue operating.
d. Better service to the customers.
e. Reduction of the load on the host computer.
f. Reduction of delays in data processing.
Network Operating System
A Network Operating System runs on a server and provides the server the capability to manage
data, users, groups, security, applications, and other networking functions. The primary purpose
of the network operating system is to allow shared file and printer access among multiple
computers in a network, typically a local area network (LAN), a private network or to other
networks.
Examples of network operating systems include Microsoft Windows Server 2003, Microsoft
Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.
The advantage of Network operating systems are as follows:
a. Centralized servers are highly stable.
b. Security is server managed.
c. Upgrade to new technologies and hardware can be easily integrated into the system.
d. Remote access to servers is possible from different locations and types of systems.
The disadvantage of Network operating systems are as follows:
a. High cost of buying and running a server.
b. Dependency on a central location for most operations.
c. Regular maintenance and update are required.
Real-Time Operating System
A real-time operating system is 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. The time
taken by the system to respond to an input and display of required updated information is termed
as the response time. So in this method, the response time is very less as compared to online
processing.
Real-time systems are used when there are rigid time requirements on the operation of a
processor or the flow of data and real-time systems can be used as a control device in a dedicated
application. A real-time operating system must have well-defined, fixed time constraints,
otherwise the system will fall. For example scientific experiments, medical imaging systems,
industrial control systems, weapon systems, robots, air traffic control systems, etc.
Hard real-time systems
Hard real-time systems guarantee that critical tasks complete on time. In hard real-time systems,
secondary storage is limited or missing and the data is stored in ROM. In these systems, virtual
memory is most never found.
Soft real-time systems
Soft real-time systems are less restrictive. A critical real-time task gets priority over other tasks
and retains the priority until it complete. Soft real-time systems have limited utility than hard
real-time systems. For example, multimedia, virtual reality, advance scientific projects like
undersea exploration and planetary rovers, etc.
Services of Operating System
An Operating System provides services to both the users and to the programs.
It provides programs an environment to execute.
It provides users the services to execute the programs in a convenient manner.
Following are a few common services provided by an operating system.
program execution
Operating systems handle many kinds of activities from user to system programs like printer
spooler, name servers, file servers, etc. Each of these activities is encapsulation as a process.
A process includes the complete execution context (code to execute, data to manipulate, registers,
OS resources in use). Following are the activities of an operating system with respect to program
management:
a. Loads a program into memory
b. Executes the program
c. Handles program's execution
d. Provides a mechanism for process synchronization
e. Provides a mechanism for process communication
f. Provides a mechanism for deadlock handling
I/O Operation
An I/O subsystem comprises of I/O devices and their corresponding driver software. Drivers hide the
peculiarities of specific hardware devices from users.
An Operating System manages the communication between user and device drivers.
a. I/O operation means read or write operation with any file or any specific I/O devices.
b. Operating Systems provides the access to the required I/O device when required.
File System Manipulation
A file represents a collection of related information. Computer can store files on the disk
(secondary storage), for long-term storage purpose. Examples of storage media include magnetic
tape, magnetic disk and optical disk drives like CD, DVD. Each of these media has its own
properties like speed, capacity, data transfer rate and data access methods.
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions. Following are the major activities of an
operating system with respect to file management:
a. Program needs to read a file or write a file
b. The operating system gives the permission to the program for operation on file.
c. Permission varies from read-only, read-write, denied, and so on.
d. Operating System provides an interface to the user to create/delete files.
e. Operating System provides an interface to the user to create/delete directories.
f. Operating System provides an interface to create the backup of file system.
Communication
In case of distributed systems which are a collection of processors that do not share memory,
peripheral devices, or a clock, the operating system manages communications between all the
processes. Multiple processes communicate with one another through communication lines in the
network.
The OS handles routing and connection strategies, and the problems of contention and security.
Following are the major activities of an operating system with respect to communication:
a. Two processes often require data to be transferred between them.
b. Both the processes can be on one computer or on different computers, but are connected through
a computer network.
c. Communication may be implemented by two methods, either by shared memory or by message
passing.
Error Handling
Errors can occur anytime and anywhere. an error may occur in CPU, in I/O devices or in the
memory hardware. Following are the major activities of an operating system with respect to error
handing:
a. The OS constantly checks for possible errors.
b. The OS takes an appropriate action to ensure correct and consistent computing.
Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU cycles
and files storage are to be allocated to each user or job. Following are the major activities of an
operating system with respect to resource management:
a. The OS manages all kinds of resources using schedulers.
b. CPU scheduling algorithms are used for better utilization of CPU.
Protection
Considering a computer system having multiple users and concurrent execution of multiple
processes, the various processes must be protected from each other's activities.
Protection refers to a mechanism or a way to control the access of programs, processes, or users
to the resources defined by a computer system. Following are the major activities of an operating
system with respect to protection:
a. The OS ensures that all access to system resources is controlled.
b. The OS ensures that external I/O devices are protected from invalid access attempts.
c. The OS provides authentication features for each user by means of passwords.
User Interface
A program that controls a display for the user (usually on a computer monitor) and that allows the user to
interact with the system. The user interface allows the user to communicate with operating system.
The user interface provides of:
a. Input
Allowing the users to manipulate a system.
b. Output
Allowing the system to indicate the effects of the user's manipulation.
Types of User Interface
Command Line Interface (CLI)
A command Line Interface is a mechanism for interacting with a computer operating system for
software by typing commands to perform specific tasks. This method of instructing a computer to
perform a given task is referred to as "entering" a command. Command line interface is accepting
input via keyboard only. So it is not suitable for beginners.
Example of command
Command Description
dir To display list of files or folder
copy To copy file or folder
mkdir To make new folder
cls To clear screen
quit To quit
Graphical User Interface (GUI)
Graphical User Interface is a type of user interface which allows people to interact with computer
with images rather than text commands. It is accept input via keyboard and pointing devices. so it
is easy to learn.
Elements of Graphical User Interface
Pointer
A symbol that appears on the display screen and that you move to select objects and commands. Usually,
the pointer appears as a small angled arrow.
Icons
Small pictures that represent commands, files, or windows.
Desktop
The area on the display screen where icons are grouped is often referred to as the desktop because the
icons are intended to represent real objects on a real desktop.
Windows
Windows used to divide the screen into different areas. In each window, you can run a different program
or display a different file.
Menus
Most graphical user interface let you execute commands by selecting a choice from a menu.
Two types of menu:
pull-down menu
Pop-up menu
Compare between Command Line Interface and Graphical User Interface
Command Line Interface (CLI) Graphical User Interface (GUI)
Ease Because of the memorization and familiarity Although new users may have a difficult
Needed to operate a command line time learning to use the mouse and all GUI
interface, new users have a difficult time features, most users pick up this interface
navigating and operating a command line much easier when compared to a command
interface. line interface.
Control Users have much more control of their file Although a GUI offers plenty of control of
system and operating system in a command a file system and operating system, the
line interface. For example, users can copy a more advanced tasks may still need a
specific file from one location to another command line.
with a non-line command.
Multitaskin Although many command line environments GUI users have windows that enable a user
g are capable of multitasking, they do not to view, control, and manipulate multiple
offer the same ease and ability to view things at once and is much faster to
multiple things at once on one screen. navigate when compared with a command
line.
Speed Command line users only need to use their A GUI may be easier to use because of the
keyboards to navigate a command line mouse. However, using a mouse and
interface and often only need to execute a keyboard to navigate and control your
few lines to perform a task. operating system for many things is going
to be much slower than someone who is
working in a command line.
Examples of Operating System
Microsoft DOS
DOS stands for Disk Operating System developed by Microsoft Inc. It is using command line
interface and does not support multiple users and multitasking. Its first version MS-DOS 1.0 (1981).
Windows
In the mid-1980s, Microsoft and IBM cooperated to develop the OS/2 operating system, which was
written in assembly language for single processor Intel 80286 systems. In 1988, Microsoft decide to end
the joint effort with IBM and its own "new technology" (or NT) portable operating system to support both
the OS/2 and POSIX application programming interfaces (APIs).
Design Principle
Microsoft's design goals for windows included security, reliability, windows and POSIX application
compatibility, high performance, extensibility, portability, and international support.
System Components
The architecture of windows is a layered system of modules, as shown figure. The main layers are the
HAL, the kernel, and the executive, all of which run in kernel mode, and a collection of subsystems and
services that run in user mode. The user mode subsystems fall into two categories: the environmental
subsystem, which emulate different operating systems, and the protection subsystem, which provide
security functions. One of the chief advantages of this type of architecture is that interactions between
modules are kept simple.
Hardware Abstraction Layer (HAL)
The HAL is the layer of software that hides hardware chipset differences from upper levels of the
operating system. The HAL export a virtual hardware interface that is used by the kernel
dispatcher, the executive, and the device driver. Only a single version of each device driver is
required for each CPU architecture, no matter what support chips might be present. Device
drivers map device and access them directly, but the chipset specific details of mapping memory,
configuring I/O buses, setting up DMA, and coping with motherboard special facilities are all
provided by the HAL interfaces.
Kernel
The kernel layer of Windows has four main responsibilities: thread scheduling, non-level
processor synchronization, interrupt and exception handing, and switching between user mode
and kernel mode. The kernel is implemented in the C language, using assembly language only
where absolutely necessary to interface with the lowest level of the hardware architecture.
The kernel is organized according to object-oriented design principles. An object type in
Windows is a system-defined data type that has a set of attributes (data values) and a set of
methods (for example, functions or operations). An object is an instance of an objects type. The
kernel performs its job by using a set of kernel objects whose attributes store the kernel data and
whole methods perform the kernel activities.
Executive
The Windows executive provides a set of service that all environment subsystems use. The
services are grouped as follows: object manager, virtual memory manager, process manager,
advanced local procedure call facility, I/O manager, cache manager, security reference monitor,
plug-and-play and power managers, registry, and booting.
logon OS/2 Win16 Win32 MS-DOS POSIX
process application application application application application
MS-DOS POSIX
VDM subsystem
security OS/2 Win18V
subsystem subsystem DM
authentication
package
security account Win32
manager subsystem
user mode
executive
I/O manager
object security process plug and virtual local
file system manage reference play memory procedure
cache r monitor manager manager manager call facility window
manage manage
device
drivers kernel graphic
device
networ
drivers
k hardware abstraction layer
hardware
Figure: windows block diagram