2What is Operating System ?
An operating system is a program on which application programs are executed and acts as an
communication bridge (interface) between the user and the computer hardware.
The main task an operating system carries out is the allocation of resources and services, such as
allocation of: memory, devices, processors and information. The operating system also includes
programs to manage these resources, such as a traffic controller, a scheduler, memory
management module, I/O programs, and a file system.
An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs.
Following are some of important functions of an operating System.
● Memory Management
● Processor Management
● Device Management
● File Management
● Security
● Control over system performance
● Job accounting
● Error detecting aids
● Coordination between other software and users
Resource abstraction is the process of "hiding the details of how the hardware operates, thereby making
computer hardware relatively easy for an application programmer to use" [given by Nutt in 1997]. One
way in which the operating system might implement resource abstraction is to provide a single abstract
disk interface which will be the same for both the hard disk and floppy disk. Such an abstraction saves
the programmer from needing to learn the details of both hardware interfaces. Instead, the programmer
only needs to learn the disk abstraction provided by the operating system.
The role of the operating system
The operating system underpins the entire operation of the modern computer.
Abstraction of hardware
The fundamental operation of the operating system (OS) is to abstract the hardware to the programmer
and user. The operating system provides generic interfaces to services provided by the underlying
hardware.
In a world without operating systems, every programmer would need to know the most intimate details
of the underlying hardware to get anything to run. Worse still, their programs would not run on other
hardware, even if that hardware has only slight differences.
Multitasking
We expect modern computers to do many different things at once, and we need some way to arbitrate
between all the different programs running on the system. It is the operating systems job to allow this to
happen seamlessly.
The operating system is responsible for resource management within the system. Many tasks will be
competing for the resources of the system as it runs, including processor time, memory, disk and user
input. The job of the operating system is to arbitrate these resources to the multiple tasks and allow
them access in an orderly fashion. You have probably experienced when this fails as it usually ends up
with your computer crashing (the famous "blue screen of death" for example).
Standardised Interfaces
Programmers want to write programs that will run on as many different hardware platforms as possible.
By having operating system support for standardised interfaces, programmers can get this functionality.
For example, if the function to open a file on one system is open(), on another is open_file() and on yet
another openf() programmers will have the dual problem of having to remember what each system does
and their programs will not work on multiple systems.
The Portable Operating System Interface (POSIX)[9] is a very important standard implemented by UNIX
type operating systems. Microsoft Windows has similar proprietary standards.
Security
On multi-user systems, security is very important. As the arbitrator of access to the system the operating
system is responsible for ensuring that only those with the correct permissions can access resources.
For example if a file is owned by one user, another user should not be allowed to open and read it.
However there also need to be mechanisms to share that file safely between the users should they want
it.
Operating systems are large and complex programs, and often security issues will be found. Often a virus
or worm will take advantage of these bugs to access resources it should not be allowed to, such as your
files or network connection; to fight them you must install patches or updates provided by your
operating system vendor.
Performance
As the operating system provides so many services to the computer, its performance is critical. Many
parts of the operating system run extremely frequently, so even an overhead of just a few processor
cycles can add up to a big decrease in overall system performance.
The operating system needs to exploit the features of the underlying hardware to make sure it is getting
the best possible performance for the operations, and consequently systems programmers need to
understand the intimate details of the architecture they are building for.
In many cases the systems programmers job is about deciding on policies for the system. Often the case
that the side effects of making one part of the operating system run faster will make another part run
slower or less efficiently. Systems programmers need to understand all these trade offs when they are
building their operating system.
Types of Operating Systems
An Operating System performs all the basic tasks like managing file,process, and memory. Thus
operating system acts as manager of all the resources, i.e. resource manager. Thus operating
system becomes an interface between user and machine.
Types of Operating Systems: Some of the widely used operating systems are as follows-
1. Batch Operating System –
This type of operating system does not interact with the computer directly. There is an operator
which takes similar jobs having same requirement and group them into batches. It is the
responsibility of operator to sort the jobs with similar needs.
Advantages of Batch Operating System:
● It is very difficult to guess or know the time required by any job to complete. Processors
of the batch systems know how long the job would be when it is in queue
● Multiple users can share the batch systems
● The idle time for batch system is very less
● It is easy to manage large work repeatedly in batch systems
Disadvantages of Batch Operating System:
● The computer operators should be well known with batch systems
● Batch systems are hard to debug
● It is sometime costly
● The other jobs will have to wait for an unknown time if any job fails
Examples of Batch based Operating System: Payroll System, Bank Statements etc.
2. Time-Sharing Operating Systems –
Each task is given some time to execute, so that all the tasks work smoothly. Each user gets time
of CPU as they use single system. These systems are also known as Multitasking Systems. The
task can be from single user or from different users also. The time that each task gets to execute
is called quantum. After this time interval is over OS switches over to next task.
Advantages of Time-Sharing OS:
● Each task gets an equal opportunity
● Less chances of duplication of software
● CPU idle time can be reduced
Disadvantages of Time-Sharing OS:
● Reliability problem
● One must have to take care of security and integrity of user programs and data
● Data communication problem
Examples of Time-Sharing OSs are: Multics, Unix etc.
3. Distributed Operating System –
These types of operating system is a recent advancement in the world of computer technology
and are being widely accepted all-over the world and, that too, with a great pace. Various
autonomous interconnected computers communicate each other using a shared communication
network. Independent systems possess their own memory unit and CPU. These are referred as
loosely coupled systems or distributed systems. These system’s processors differ in size and
function. The major benefit of working with these types of operating system is that it is always
possible that one user can access the files or software which are not actually present on his
system but on some other system connected within this network i.e., remote access is enabled
within the devices connected in that network.
Advantages of Distributed Operating System:
● Failure of one will not affect the other network communication, as all systems are
independent from each other
● Electronic mail increases the data exchange speed
● Since resources are being shared, computation is highly fast and durable
● Load on host computer reduces
● These systems are easily scalable as many systems can be easily added to the network
● Delay in data processing reduces
Disadvantages of Distributed Operating System:
● Failure of the main network will stop the entire communication
● To establish distributed systems the language which are used are not well defined yet
● These types of systems are not readily available as they are very expensive. Not only that
the underlying software is highly complex and not understood well yet
Examples of Distributed Operating System are- LOCUS etc.
4. 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 type 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.
Advantages of Network Operating System:
● Highly stable centralized servers
● Security concerns are handled through servers
● New technologies and hardware up-gradation are easily integrated to the system
● Server access are possible remotely from different locations and types of systems
Disadvantages of Network Operating System:
● Servers are costly
● User has to depend on central location for most operations
● Maintenance and updates are required regularly
Examples of Network Operating System are: Microsoft Windows Server 2003, Microsoft
Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD etc.
5. Real-Time Operating System –
These types of OSs serves the real-time systems. The time interval required to process and
respond to inputs is very small. This time interval is called response time.
Real-time systems are used when there are time requirements are very strict like missile
systems, air traffic control systems, robots etc.
Two types of Real-Time Operating System which are as follows:
● Hard Real-Time Systems:
These OSs are meant for the applications where time constraints are very strict and even
the shortest possible delay is not acceptable. These systems are built for saving life like
automatic parachutes or air bags which are required to be readily available in case of any
accident. Virtual memory is almost never found in these systems.
● Soft Real-Time Systems:
These OSs are for applications where for time-constraint is less strict.
Advantages of RTOS:
● Maximum Consumption: Maximum utilization of devices and system,thus more output
from all the resources
● Task Shifting: Time assigned for shifting tasks in these systems are very less. For
example in older systems it takes about 10 micro seconds in shifting one task to another
and in latest systems it takes 3 micro seconds.
● Focus on Application: Focus on running applications and less importance to
applications which are in queue.
● Real time operating system in embedded system: Since size of programs are small,
RTOS can also be used in embedded systems like in transport and others.
● Error Free: These types of systems are error free.
● Memory Allocation: Memory allocation is best managed in these type of systems.
Disadvantages of RTOS:
● Limited Tasks: Very few tasks run at the same time and their concentration is very less
on few applications to avoid errors.
● Use heavy system resources: Sometimes the system resources are not so good and they
are expensive as well.
● Complex Algorithms: The algorithms are very complex and difficult for the designer to
write on.
● Device driver and interrupt signals: It needs specific device drivers and interrupt
signals to response earliest to interrupts.
● Thread Priority: It is not good to set thread priority as these systems are very less prone
to switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical
imaging systems, industrial control systems, weapon systems, robots, air traffic control
systems, etc.
PC (Personal Computer)A PC can be defined as a small,
relatively inexpensive computer designed for an individual user. PCs are based on
the microprocessor technology that enables manufacturers to put an entire CPU on
one chip. Businesses use personal computers for word processing, accounting,
desktop publishing, and for running spreadsheet and database management
applications. At home, the most popular use for personal computers is for playing
games and surfing the Internet.Although personal computers are designed as
single-user systems, these systems are normally linked together to form a network.
In terms of power, now-a-days High-end models of the Macintosh and PC offer the
same computing power and graphics capability as low-end workstations by Sun
Microsystems, Hewlett-Packard, and DELL.
WorkStation Workstation is a computer used for engineering
applications (CAD/CAM), desktop publishing, software development,and other such
types of applications which require a moderate amount of computing power and
relatively high quality graphics capabilities.
Workstations generally come with a large, high-resolution graphics screen, large
amount of RAM, inbuilt network support, and a graphical user interface. Most
workstations also have a mass storage device such as a disk drive, but a special
type of workstation, called a diskless workstation, comes without a disk
drive.Common operating systems for workstations are UNIX and Windows NT. Like
PC, Workstations are also single-user computers. However, workstations are
typically linked together to form a local-areanetwork, although they can also be used
as stand-alone systems.
Minicomputer It is a midsize computer. A minicomputer is a
multi-processing system capable of supporting from up to 250 users simultaneously.
Mainframe
Mainframe is a very large in size and is an expensive computer capable of
supporting hundreds, or even thousands, of users simultaneously. Mainframe
executes many programs concurrently. Mainframes support many simultaneous
programs execution
Supercomputer Supercomputers are one of the fastest computers
currently available. Supercomputers are very expensive and are employed for
specialized applications that require immense amounts of mathematical calculations
(number crunching). For example, weather forecasting , scientific simulations,
(animated) graphics, fluid dynamic calculations, nuclear energy research, electronic
design, and analysis of geological data (e.g. in petrochemical prospecting).
Real Time Systems
Real time system means that the system is subjected to real time, i.e., response should be
guaranteed within a specified timing constraint or system should meet the specified deadline. For
example: flight control system, real time monitors etc.
Types of real time systems based on timing constraints:
1. Hard real time system –
This type of system can never miss its deadline. Missing the deadline may have
disastrous consequences.The usefulness of result produced by a hard real time system
decreases abruptly and may become negative if tardiness increases. Tardiness means how
late a real time system completes its task with respect to its deadline. Example: Flight
controller system.
2. Soft real time system –
This type of system can miss its deadline occasionally with some acceptably low
probability. Missing the deadline have no disastrous consequences. The usefulness of
result produced by a soft real time system decreases gradually with increase in tardiness.
Example: Telephone switches
Types of Real Time Operating System
Depending upon the nature of application real time OS are designed and they are classified into 3
types:
1. Soft Real Time Operating System
Soft real time OS is a type of OS where certain deadlines may be missed, they will respond at a
time t=0+.
Soft real time systems are not constrained to extreme rules. The critical time of the soft real time
may be delayed to some extent. The expected latency between the tasks and time constraints may
be deviated.
The preemption period for a soft real time task is about few milliseconds.
Examples
Digital camera, mobile phones, online data base etc.
2. Hard Real Time Operating System
Hard real time OS is a type of OS we can predict the deadline, they will respond at a time t=0.
Hard real time systems are constrained to predicted time constraints, deadlines and latency.
Examples:
Air bag control in cars, anti-lock brake, engine control system etc.
The preemption period for hard real time system is almost less than few microseconds.
3. Firm Real Time Operating System
This type of RTOS has certain time constraints which are not strict and it may cause undesired
effect.
Example for firm RTOS is automated visual inspection in industrial automation. This system
examines and detects the defected parts of assembly line. This type is also called event response
system.
In short RTOS based system is a time critical system where most of the tasks are completed in
time so that most of the deadly events are reduced.
Note: In the next article we are going to see how Real Time Operating system (RTOS) manages
the services and achieve its real time constraints.
Process
A process is basically a program in execution. The execution of a process must progress in a
sequential fashion.
A process is defined as an entity which represents the basic unit of work to be implemented in the
system.
To put it in simple terms, we write our computer programs in a text file and when we execute this
program, it becomes a process which performs all the tasks mentioned in the program.
When a program is loaded into the memory and it becomes a process, it can be divided into four
sections ─ stack, heap, text and data. The following image shows a simplified layout of a process
inside main memory −
S.N. Component & Description
Stack
1 The process Stack contains the temporary data such as method/function parameters, return
address and local variables.
Heap
2
This is dynamically allocated memory to a process during its run time.
Text
3 This includes the current activity represented by the value of Program Counter and the
contents of the processor's registers.
Data
4
This section contains the global and static variables.
Program
A program is a piece of code which may be a single line or millions of lines. A computer
program is usually written by a computer programmer in a programming language. For example,
here is a simple program written in C programming language −
#include <stdio.h>
int main() {
printf("Hello, World! \n");
return 0;
}
A computer program is a collection of instructions that performs a specific task when executed
by a computer. When we compare a program with a process, we can conclude that a process is a
dynamic instance of a computer program.
A part of a computer program that performs a well-defined task is known as an algorithm. A
collection of computer programs, libraries and related data are referred to as a software.
Process Management
Multiprogramming systems explicitly allow multiple processes to exist at any
given time, where only one is using the CPU at any given moment, while the
remaining processes are performing I/O or are waiting.
The process manager is of the four major parts of the operating system. It
implements the process abstraction. It does this by creating a model for the
way the process uses CPU and any system resources. Much of the
complexity of the operating system stems from the need for multiple
processes to share the hardware at the same time. As a conseuence of this
goal, the process manager implements CPU sharing ( called scheduling ),
process synchronization mechanisms, and a deadlock strategy. In addition,
the process manager implements part of the operating system's protection
and security.
Process Life Cycle
When a process executes, it passes through different states. These stages may differ in different
operating systems, and the names of these states are also not standardized.
In general, a process can have one of the following five states at a time.
S.N. State & Description
Start
1
This is the initial state when a process is first started/created.
Ready
2
The process is waiting to be assigned to a processor. Ready processes are waiting to have
the processor allocated to them by the operating system so that they can run. Process may
come into this state after Start state or while running it by but interrupted by the scheduler
to assign CPU to some other process.
Running
3 Once the process has been assigned to a processor by the OS scheduler, the process state is
set to running and the processor executes its instructions.
Waiting
4 Process moves into the waiting state if it needs to wait for a resource, such as waiting for
user input, or waiting for a file to become available.
Terminated or Exit
5 Once the process finishes its execution, or it is terminated by the operating system, it is
moved to the terminated state where it waits to be removed from main memory.
Process Table and Process Control Block
(PCB)
While creating a process the operating system performs several operations. To identify the
processes, it assigns a process identification number (PID) to each process. As the operating
system supports multi-programming, it needs to keep track of all the processes. For this task, the
process control block (PCB) is used to track the process’s execution status. Each block of
memory contains information about the process state, program counter, stack pointer, status of
opened files, scheduling algorithms, etc. All these information is required and must be saved
when the process is switched from one state to another. When the process makes a transition
from one state to another, the operating system must update information in the process’s PCB.
A process control block (PCB) contains information about the process, i.e. registers, quantum,
priority, etc. The process table is an array of PCB’s, that means logically contains a PCB for all
of the current processes in the system.
● Pointer – It is a stack pointer which is required to be saved when the process is switched
from one state to another to retain the current position of the process.
● Process state – It stores the respective state of the process.
● Process number – Every process is assigned with a unique id known as process ID or
PID which stores the process identifier.
● Program counter – It stores the counter which contains the address of the next
instruction that is to be executed for the process.
● Register – These are the CPU registers which includes: accumulator, base, registers and
general purpose registers.
● Memory limits – This field contains the information about memory management system
used by operating system. This may include the page tables, segment tables etc.
● Open files list – This information includes the list of files opened for a process.