0% found this document useful (0 votes)
86 views32 pages

OS-I Unit

Introduction to Operating system

Uploaded by

Hariharan SK
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
0% found this document useful (0 votes)
86 views32 pages

OS-I Unit

Introduction to Operating system

Uploaded by

Hariharan SK
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 32

UNIT - I Introduction

Concept of Operating Systems- Generations of Operating systems-Types of Operating


Systems-OS Services-System Calls-Structure of an OS - Layered, Monolithic,
Microkernel Operating Systems-Concept of Virtual Machine-Case study on UNIX and
WINDOWS Operating System.

Concept of Operating Systems:


 An operating system acts as an intermediary between the user of a computer and
computer hardware.
 It is a software that manages 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.
 The hardware must provide appropriate mechanisms to ensure the correct operation of the
computer system and to prevent user programs from interfering with the proper operation
of the system.
 Every computer system must have at least one operating system to run other programs.
Applications like Browsers, MS Office, Notepad Games, etc., need some environment to
run and perform its tasks.
 A more common definition is that the operating system is the one program running at
all times on the computer (usually called the kernel), with all else being application
programs.
 An operating system is concerned with the allocation of resources and services, such as
memory, processors, devices, and information.
 The operating system correspondingly includes programs to manage these resources,
such as a traffic controller, a scheduler, memory management module, I/O programs, and
a file system.
 It is not possible for the user to use any computer or mobile device without having an
operating system.
Functions of Operating system – Operating system performs three functions:
1. Convenience: An OS makes a computer more convenient to use.
2. Efficiency: An OS allows the computer system resources to be used in an efficient
manner.
3. Ability to Evolve: An OS should be constructed in such a way as to permit the effective
development, testing and introduction of new system functions at the same time without
interfering with service.
Operating system as User Interface –
Every general-purpose computer consists of the hardware, operating system, system programs,
and application programs. The hardware consists of memory, CPU, ALU, and I/O devices,
peripheral device, and storage device. System program consists of compilers, loaders, editors,
OS, etc. The application program consists of business programs, database programs.

Fig1: Conceptual view of a computer system


The operating system is a set of special programs that run on a computer system that allows it to
work properly. It performs basic tasks such as recognizing input from the keyboard, keeping
track of files and directories on the disk, sending output to the display screen and controlling
peripheral devices.
OS is designed to serve two basic purposes:
1. It controls the allocation and use of the computing System’s resources among the various
user and tasks.
2. It provides an interface between the computer hardware and the programmer that
simplifies and makes feasible for coding, creation, debugging of application programs.
The Operating system must support the following tasks. The task are:
1. Provides the facilities to create, modification of programs and data files using an editor.
2. Access to the compiler for translating the user program from high level language to
machine language.
3. Provide a loader program to move the compiled program code to the computer’s memory
for execution.
4. Provide routines that handle the details of I/O programming.

History of OS (Generations of Operating systems):


A computer is an electronic device that manipulates information or data. It has the ability to
store, retrieve, and process data.
Nowadays, a computer can be used to type documents, send email, play games, and browse the
Web. It can also be used to edit or create spreadsheets, presentations, and even videos. But the
evolution of this complex system started around 1940 with the first Generation of Computer and
evolving ever since.
There are five generations of computers.
1. First Generation
 Introduction:
1. 1946-1959 is the period of first generation computer.
2. J.P.Eckert and J.W.Mauchy invented the first successful electronic
computer called ENIAC, ENIAC stands for “Electronic Numeric
Integrated And Calculator”.
 Few Examples are:
1. ENIAC
2. EDVAC
3. UNIVAC
4. IBM-701
5. IBM-650
 Advantages:
1. It made use of vacuum tubes which are the only electronic component
available during those days.
2. These computers could calculate in milliseconds.
 Disadvantages:
1. These were very big in size, weight was about 30 tones.
2. These computers were based on vacuum tubes.
3. These computers were very costly.
4. It could store only a small amount of information due to the presence of
magnetic drums.
5. As the invention of first generation computers involves vacuum tubes, so
another disadvantage of these computers was, vacuum tubes require a
large cooling system.
6. Very less work efficiency.
7. Limited programming capabilities and punch cards were used to take
inputs.
8. Large amount of energy consumption.
9. Not reliable and constant maintenance is required.

2. Second Generation
 Introduction:
1. 1959-1965 is the period of second-generation computer.
2. 3.Second generation computers were based on Transistor instead of
vacuum tubes.
 Few Examples are:
1. Honeywell 400
2. IBM 7094
3. CDC 1604
4. CDC 3600
5. UNIVAC 1108
 Advantages:
1. Due to the presence of transistors instead of vacuum tubes, the size of
electron component decreased. This resulted in reducing the size of a
computer as compared to first generation computers.
2. Less energy and not produce as much heat as the first genration.
3. Assembly language and punch cards were used for input.
4. Low cost than first generation computers.
5. Better speed, calculate data in microseconds.
6. Better portability as compared to first generation
 Disadvantages:
1. A cooling system was required.
2. Constant maintenance was required.
3. Only used for specific purposes.

3. Third Generation
 Introduction:
1. 1965-1971 is the period of third generation computer.
2. These computers were based on Integrated circuits.
3. IC was invented by Robert Noyce and Jack Kilby In 1958-1959.
4. IC was a single component containing number of transistors.
 Few Examples are:
1. PDP-8
2. PDP-11
3. ICL 2900
4. IBM 360
5. IBM 370
 Advantages:
1. These computers were cheaper as compared to second-generation
computers.
2. They were fast and reliable.
3. Use of IC in the computer provides the small size of the computer.
4. IC not only reduce the size of the computer but it also improves the
performance of the computer as compared to previous computers.
5. This generation of computers has big storage capacity.
6. Instead of punch cards, mouse and keyboard are used for input.
7. They used an operating system for better resource management and used
the concept of time-sharing and multiple programming.
8. These computers reduce the computational time from microseconds to
nanoseconds.
 Disadvantages:
1. IC chips are difficult to maintain.
2. The highly sophisticated technology required for the manufacturing of IC
chips.
3. Air conditioning is required.

4. Fourth Generation
 Introduction:
1. 1971-1980 is the period of fourth generation computer.
2. This technology is based on Microprocessor.
3. A microprocessor is used in a computer for any logical and arithmetic
function to be performed in any program.
4. Graphics User Interface (GUI) technology was exploited to offer more
comfort to users.
 Few Examples are:
1. IBM 4341
2. DEC 10
3. STAR 1000
4. PUP 11
 Advantages:
1. Fastest in computation and size get reduced as compared to the previous
generation of computer.
2. Heat generated is negligible.
3. Small in size as compared to previous generation computers.
4. Less maintenance is required.
5. All types of high-level language can be used in this type of computers.
 Disadvantages:
1. The Microprocessor design and fabrication are very complex.
2. Air conditioning is required in many cases due to the presence of ICs.
3. Advance technology is required to make the ICs.
5. Fifth Generation
 Introduction:
1. The period of the fifth generation in 1980-onwards.
2. This generation is based on artificial intelligence.
3. The aim of the fifth generation is to make a device which could respond to
natural language input and are capable of learning and self-organization.
4. This generation is based on ULSI(Ultra Large Scale Integration)
technology resulting in the production of microprocessor chips having ten
million electronic component.
 Few Examples are:
1. Desktop
2. Laptop
3. NoteBook
4. UltraBook
5. Chromebook
 Advantages:
1. It is more reliable and works faster.
2. It is available in different sizes and unique features.
3. It provides computers with more user-friendly interfaces with multimedia
features.
 Disadvantages:
1. They need very low-level languages.
2. They may make the human brains dull and doomed.
GENERATION YEAR ELECTRONIC DEVICE USED TYPES OF OS DEVICE

First 1945-55 Vaccum Tubes Plug Boards


Second 1955-65 Transistors Batch Systems
Third 1965-80 Integrated Circuits(IC) Multiprogramming
Fourth Since 1980 Large Scale Integration Personal Computers
Summery:
 Operating systems were first developed in the late 1950s to manage tape storage
 The General Motors Research Lab implemented the first OS in the early 1950s for their
IBM 701
 In the mid-1960s, operating systems started to use disks
 In the late 1960s, the first version of the Unix OS was developed
 The first OS built by Microsoft was DOS. It was built in 1981 by purchasing the 86-DOS
software from a Seattle company
 The present-day popular OS Windows first came to existence in 1985 when a GUI was
created and paired with MS-DOS.

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
In the era of 1970s, the Batch processing was very popular. The Jobs were executed in
batches. People were used to have a single computer which was called mainframe.
In Batch operating system, access is given to more than one person; they submit their
respective jobs to the system for the execution.
The system put all of the jobs in a queue on the basis of first come first serve and then
executes the jobs one by one. The users collect their respective output when all the jobs
get executed.
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:
 Starvation: Batch processing suffers from starvation. If there are five jobs J1, J2, J3, J4,
J4 and J5 present in the batch. If the execution time of J1 is very high then other four
jobs will never be going to get executed or they will have to wait for a very high time.
Hence the other processes get starved.
 Not Interactive: Batch Processing is not suitable for the jobs which are dependent on the
user's input. If a job requires the input of two numbers from the console then it will never
be going to get it in the batch processing scenario since the user is not present at the time
of execution.
 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. Multi-Tasking/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. 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.
Types of Distributed Operating Systems
Following are the two types of distributed operating systems used:
1. Client-Server Systems
2. Peer-to-Peer Systems

1. Client-Server Systems
Centralized systems today act as server systems to satisfy requests generated by client
systems. The general structure of a client-server system is depicted in the figure below:

Server Systems can be broadly categorized as: Compute Servers and File Servers.
 Compute Server systems, provide an interface to which clients can send requests to
perform an action, in response to which they execute the action and send back results to
the client.
 File Server systems, provide a file-system interface where clients can create, update,
read, and delete files.
2. Peer-to-Peer Systems
The growth of computer networks - especially the Internet and World Wide Web (WWW) – has
had a profound influence on the recent development of operating systems. When PCs were
introduced in the 1970s, they were designed for personal use and were generally considered
standalone computers. With the beginning of widespread public use of the Internet in the 1990s
for electronic mail and FTP, many PCs became connected to computer networks.
In contrast to the Tightly Coupled systems, the computer networks used in these applications
consist of a collection of processors that do not share memory or a clock. Instead, each processor
has its own local memory. The processors communicate with one another through various
communication lines, such as high-speed buses or telephone lines. These systems are usually
referred to as loosely coupled systems ( or distributed systems). The general structure of a client-
server system is depicted in the figure below:
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.

There are many types of operating system exists in the current scenario:
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. In Real Time systems,
each job carries a certain deadline within which the Job is supposed to be completed, otherwise
the huge loss will be there or even if the result is produced then it will be completely useless.
Real-time systems are used when there are time requirements are very strict like missile systems
(if you want to drop a missile then the missile is supposed to be dropped with certain precision),
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.

The BSP provides a common application programming interface (API) and a stable environment
for the real-time operating system.
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.
6. Mobile OS
Mobile operating systems are those OS which is especially that are designed to power
smartphones, tablets, and wearables devices. Some most famous mobile operating systems are
Android and iOS, but others include BlackBerry, Web, and watchOS.
7. Multiprogramming Operating System
Multiprogramming is an extension to the batch processing where the CPU is kept always busy.
Each process needs two types of system time: CPU time and IO time.
In multiprogramming environment, for the time a process does its I/O, The CPU can start the
execution of other processes. Therefore, multiprogramming improves the efficiency of the
system.
8. Multiprocessing Operating System
In Multiprocessing, Parallel computing is achieved. It consists of several processors that share a
common physical memory. in the system which can execute more than one process at the same
time. This will increase the throughput of the system. This system provides higher computing
power and speed. In multiprocessor system all processors operate under single operating system.
Multiplicity of the processors and how they do act together are transparent to the others.
Advantages of Multiprocessor Systems
1. Enhanced performance
2. Execution of several tasks by different processors concurrently, increases the system's
throughput without speeding up the execution of a single task.
3. If possible, system divides task into many subtasks and then these subtasks can be
executed in parallel in different processors. Thereby speeding up the execution of single
tasks.
9. Desktop Systems
Earlier, CPUs and PCs lacked the features needed to protect an operating system from user
programs. PC operating systems therefore were neither multiuser nor multitasking. However,
the goals of these operating systems have changed with time; instead of maximizing CPU and
peripheral utilization, the systems opt for maximizing user convenience and responsiveness.
These systems are called Desktop Systems and include PCs running Microsoft Windows and
the Apple Macintosh. Operating systems for these computers have benefited in several ways
from the development of operating systems for mainframes.
Microcomputers were immediately able to adopt some of the technology developed for larger
operating systems. On the other hand, the hardware costs for microcomputers are
sufficiently low that individuals have sole use of the computer, and CPU utilization is no longer
a prime concern. Thus, some of the design decisions made in operating systems for mainframes
may not be appropriate for smaller systems.
10. Clustered Systems
 Like parallel systems, clustered systems gather together multiple CPUs to accomplish
computational work.
 Clustered systems differ from parallel systems, however, in that they are composed of
two or more individual systems coupled together.
 The definition of the term clustered is not concrete; the general accepted definition is
that clustered computers share storage and are closely linked via LAN networking.
 Clustering is usually performed to provide high availability.
 A layer of cluster software runs on the cluster nodes. Each node can monitor one or more
of the others. If the monitored machine fails, the monitoring machine can take ownership
of its storage, and restart the application(s) that were running on the failed machine. The
failed machine can remain down, but the users and clients of the application would only
see a brief interruption of service.
 Asymmetric Clustering - In this, one machine is in hot standby mode while the other is
running the applications. The hot standby host (machine) does nothing but monitor the
active server. If that server fails, the hot standby host becomes the active server.
 Symmetric Clustering - In this, two or more hosts are running applications, and they are
monitoring each other. This mode is obviously more efficient, as it uses all of the
available hardware.
 Parallel Clustering - Parallel clusters allow multiple hosts to access the same data on the
shared storage. Because most operating systems lack support for this simultaneous data
access by multiple hosts, parallel clusters are usually accomplished by special versions of
software and special releases of applications.
Clustered technology is rapidly changing. Clustered system's usage and it's features should
expand greatly as Storage Area Networks(SANs). SANs allow easy attachment of multiple
hosts to multiple storage units. Current clusters are usually limited to two or four hosts due to the
complexity of connecting the hosts to shared storage.
Microcomputers were immediately able to adopt some of the technology developed for larger
operating systems. On the other hand, the hardware costs for microcomputers are
sufficiently low that individuals have sole use of the computer, and CPU utilization is no longer
a prime concern. Thus, some of the design decisions made in operating systems for mainframes
may not be appropriate for smaller systems.
11. Handheld Systems
Handheld systems include Personal Digital Assistants(PDAs), such as Palm-Pilots or Cellular
Telephones with connectivity to a network such as the Internet. They are usually of limited size
due to which most handheld devices have a small amount of memory, include slow processors,
and feature small display screens.
 Many handheld devices have between 512 KB and 8 MB of memory. As a result, the
operating system and applications must manage memory efficiently. This includes
returning all allocated memory back to the memory manager once the memory is no
longer being used.
 Currently, many handheld devices do not use virtual memory techniques, thus forcing
program developers to work within the confines of limited physical memory.
 Processors for most handheld devices often run at a fraction of the speed of a processor in
a PC. Faster processors require more power. To include a faster processor in a handheld
device would require a larger battery that would have to be replaced more frequently.
 The last issue confronting program designers for handheld devices is the small display
screens typically available. One approach for displaying the content in web pages is web
clipping, where only a small subset of a web page is delivered and displayed on the
handheld device.
Some handheld devices may use wireless technology such as BlueTooth, allowing remote access
to e-mail and web browsing. Cellular telephones with connectivity to the Internet fall into this
category. Their use continues to expand as network connections become more available and
other options such as cameras and MP3 players, expand their utility.
System Call
In computing, a system call is the programmatic way in which a computer program requests a
service from the kernel of the operating system it is executed on. A system call is a way for
programs to interact with the operating system. A computer program makes a system call
when it makes a request to the operating system’s kernel. System call provides the services of
the operating system to the user programs via Application Program Interface (API). It provides
an interface between a process and operating system to allow user-level processes to request
services of the operating system. System calls are the only entry points into the kernel system.
All programs needing resources must use system calls.
A figure representing the execution of the system call is given as follows


As can be seen from this diagram, the processes execute normally in the user mode until a
system call interrupts this. Then the system call is executed on a priority basis in the kernel
mode. After the execution of the system call, the control returns to the user mode and execution
of user processes can be resumed.
Services Provided by System Calls:
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 −
a. Program execution
b. I/O operations
c. File System manipulation
d. Communication
e. Error Detection
f. Resource Allocation
g. Protection

a. Program execution
Operating systems handle many kinds of activities from user programs to system
programs like printer spooler, name servers, file server, etc. Each of these activities is
encapsulated as a process.
A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use). Following are the major activities of an operating system
with respect to program management −
 Loads a program into memory.
 Executes the program.
 Handles program's execution.
 Provides a mechanism for process synchronization.
 Provides a mechanism for process communication.
 Provides a mechanism for deadlock handling.

b. 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 the users.
An Operating System manages the communication between user and device drivers.
 I/O operation means read or write operation with any file or any specific I/O
device.
 Operating system provides the access to the required I/O device when
required.
c. File system manipulation
A file represents a collection of related information. Computers 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 −
 Program needs to read a file or write a file.
 The operating system gives the permission to the program for operation on file.
 Permission varies from read-only, read-write, denied and so on.
 Operating System provides an interface to the user to create/delete files.
 Operating System provides an interface to the user to create/delete directories.
 Operating System provides an interface to create the backup of file system.
d. 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 −
 Two processes often require data to be transferred between them
 Both the processes can be on one computer or on different computers, but are connected
through a computer network.
 Communication may be implemented by two methods, either by Shared Memory or by
Message Passing.
e. 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 handling −
 The OS constantly checks for possible errors.
 The OS takes an appropriate action to ensure correct and consistent computing.
f. 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 −
 The OS manages all kinds of resources using schedulers.
 CPU scheduling algorithms are used for better utilization of CPU.
g. 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 −
 The OS ensures that all access to system resources is controlled.
 The OS ensures that external I/O devices are protected from invalid access attempts.
 The OS provides authentication features for each user by means of passwords.
Types of System Calls: There are 5 different categories of system calls –
1. Process control: end, abort, create, terminate, allocate and free memory.
2. File management: create, open, close, delete, read file etc.
3. Device management: reading from device buffers, writing into device buffers etc.
4. Information maintenance: handle information and its transfer between the operating
system and the user program.
5. Communication: useful for interprocess communication and also deal with creating
and deleting a communication connection.
Examples of Windows and Unix System Calls –

WINDOWS UNIX

CreateProcess() fork()
ExitProcess() exit()
Process Control WaitForSingleObject() wait()

CreateFile() open()
ReadFile() read()
WriteFile() write()
File Manipulation CloseHandle() close()

SetConsoleMode() ioctl()
ReadConsole() read()
Device Manipulation WriteConsole() write()

Information GetCurrentProcessID() getpid()


Maintenance SetTimer() alarm()
Sleep() sleep()

CreatePipe() pipe()
CreateFileMapping() shmget()
Communication MapViewOfFile() mmap()

SetFileSecurity() chmod()
InitlializeSecurityDescriptor() umask()
Protection SetSecurityDescriptorGroup() chown()

There are many different system calls as shown above. Details of some of those system calls are
as follows −
open()
The open() system call is used to provide access to a file in a file system. This system call
allocates resources to the file and provides a handle that the process uses to refer to the file. A
file can be opened by multiple processes at the same time or be restricted to one process. It all
depends on the file organisation and file system.
read()
The read() system call is used to access data from a file that is stored in the file system. The file
to read can be identified by its file descriptor and it should be opened using open() before it can
be read. In general, the read() system calls takes three arguments i.e. the file descriptor, buffer
which stores read data and number of bytes to be read from the file.
write()
The write() system calls writes the data from a user buffer into a device such as a file. This
system call is one of the ways to output data from a program. In general, the write system calls
takes three arguments i.e. file descriptor, pointer to the buffer where data is stored and number of
bytes to write from the buffer.
close()
The close() system call is used to terminate access to a file system. Using this system call means
that the file is no longer required by the program and so the buffers are flushed, the file metadata
is updated and the file resources are de-allocated.
Structure of an OS:
A structure of an Operating System determines how it has been designed and how it functions.
There are numerous ways of designing a new structure of an Operating system. Here, we will
learn about six combinations that have been tested and tried. These six combinations
are monolithic systems, layered systems, microkernels, client-server models, virtual
machines, and exokernels.
Note: Before we get started it’s important to understand what a kernel is.
 When your computer is running in kernel mode, all the permissions are available (think
of it as an administrator).
 In macOS, this is known as giving ‘root’ access. In Windows, you invoke this by running
applications as ‘administrator.’
 If not the kernel mode, the computer normally runs in user mode, where a lot of
permissions are not given to the user that may damage the system files.
Simple Structure

In MS-DOS, applications may bypass the operating system.


 Operating systems such as MS-DOS and the original UNIX did not have well-defined
structures.
 There was no CPU Execution Mode (user and kernel), and so errors in applications could
cause the whole system to crash.
I. Monolithic System structure in an Operating System
In monolithic kernel based systems, each application has its own address
space. Therefore, each application is secure. Also, the kernel contains all the
OS services. Therefore, the applications can request services from the
kernel. Some OS services are file system, CPU Scheduler, network access,
memory manager etc. However, the OS is in a separate address space.
Therefore, it is secure from the normal applications and malfunctioned
applications.


If an application requires a service, the hardware address space of the
application switches to the hardware address space of the operating system
to execute it.

In this organizational structure, the entire operating system runs as a single program in the kernel
mode. An operating system is a collection of various procedures linked together in a binary file.
In this system, any procedure can call any other procedure. Since it is running in kernel mode
itself, it has all the permissions to call whatever it wants.
In terms of information hiding, there is none. All procedures are running in kernel mode, so they
have access to all modules and packages of other procedures.
However, using this approach without any restrictions can lead to thousands of procedure calls,
and this can lead to a messy system. For this purpose, the actual OS is constructed in a hierarchy.
All the individual procedures are compiled into a single executable file using the system linker.
Even a monolithic system has a structure in which it can run in user mode. There already is a
basic structure given by the organization
1. The main procedure that invokes the requested service procedures.
2. A set of service procedures that carry out system calls.
3. A set of utility procedures that help out the system procedures.
Simple Monolithic Operating Systems Example
CP/M and DOS are simple examples of monolithic operating systems. Both CP/M and DOS are
operating systems that share a single address space with the applications. In CP/M, the 16 bit
address space starts with system variables and the application area and ends with three parts of
the operating system, namely CCP (Console Command Processor), BDOS (Basic Disk Operating
System) and BIOS (Basic Input/Output System). In DOS, the 20 bit address space starts with the
array of interrupt vectors and the system variables, followed by the resident part of DOS and the
application area and ending with a memory block used by the video card and BIOS.

Most contemporary operating systems, including Linux and Windows, are also considered
monolithic, even though their structure is certainly significantly different from the simple
examples of CP/M and DOS.

II. Microkernels system in an operating system


Microkernel is a type of kernel that allows customization of the operating
system. It runs on privileged mode and provides low-level address space
management and Inter Process Communication (IPC). Moreover, OS services
such as file system, virtual memory manager, and CPU scheduler are on top
of the microkernel. Each service has its own address space to make them
secure. Besides, the applications also have their own address spaces.
Therefore, there is protection among applications, OS Services and kernel.

When the application requests the OS services for a service, the OS services
communicate with each other to provide the required service to the
application. Here, the Inter Process Communication (IPC) helps to establish
this communication. Overall, microkernel-based OS provides a great level of
extensibility. It is also possible to customize the services of the operating
system depending on the requirements of the application.

Traditionally, all the layers of the OS in a layered system went into the kernel. So they all had
root access to the OS, and any small bug in any layer could be fatal to the OS. Famous examples
of a microkernel system include Integrity, K42, PikeOS, Symbian, and MINIX 3.

The primary purpose of this system is to provide high reliability. Because of the high reliability
that it provides, the applications of microkernels can be seen in real-time, industrial, avionics
(electronics fitted in aircraft and aviation), and military applications that are mission-critical and
require high reliability.
Working
 The operating system is split into small, well-defined modules, of which only one, the
microkernel, runs in kernel mode. The rest of the modules run as powerless ordinary user
processes.
 Running each device driver and file system as separate user processes is a fail-safe
method as a bug in one of the drivers, will fail only that component.
 A bug easily references an invalid memory address and brings the system to a grinding
halt instantly.
A Microkernel architecture
Example: MINIX 3
 The MINIX 3 is an OS written in C with 3200 lines of code and about 800 lines of code
for the assembler to handle low-level functions like catching interrupts or switching
processes.
 The C code handles managing and scheduling processes, handles interprocess
communication.
 It also provides a set of 35 kernel calls to allow the rest of the operating system to do its
work. These calls perform functions like hooking handlers to interrupts, moving data
between address spaces, and installing new memory maps for newly created processes.
The process structure of MINIX 3 is divided into three parts above the kernel.
 The lowest layer contains device drivers.
 The middle layer includes servers.
Difference between Microkernel and Monolithic Kernel
Comparison Chart

BASIS FOR
MICROKERNEL MONOLITHIC KERNEL
COMPARISON

Basic In microkernel user services and In monolithic kernel, both user


kernel, services are kept in separate services and kernel services are
address space. kept in the same address space.

Size Microkernel are smaller in size. Monolithic kernel is larger than


microkernel.

Execution Slow execution. Fast execution.

Extendible The microkernel is easily extendible. The monolithic kernel is hard to


extend.

Security If a service crashes, it does effect on If a service crashes, the whole


working of microkernel. system crashes in monolithic
kernel.

Code To write a microkernel, more code is To write a monolithic kernel, less


required. code is required.

Example QNX, Symbian, L4Linux, Singularity, Linux, BSDs (FreeBSD,


K42, Mac OS X, Integrity, PikeOS, OpenBSD, NetBSD), Microsoft
HURD, Minix, and Coyotos. Windows (95,98,Me), Solaris, OS-
9, AIX, HP-UX, DOS, OpenVMS,
XTS-400 etc.

III. Layered Systems Structure in Operating Systems


As the name suggests, this system works in layers. It was designed by E.W. Dijkstra in 1968,
along with some help from his students. This system was first implemented in THE system built
at the Technische Hogeschool Eindhoven in the Netherlands. The THE system was a simple
batch system for a Dutch computer, the Extralogica X8.

Working
There are six layers in the system, each with different purposes.

Layer Function

5 The operator

4 User Programs

3 Input/Output Management

2 Operator-process communication

1 Memory and drum management

0 Processor allocation and multiprogramming


Layer 0 – Processor Allocation and Multiprogramming – This layer deals with the allocation
of processor, switching between the processes when interrupts occur or when the timers expire.
The sequential processes can be programmed individually without having to worry about other
processes running on the processor. That is, layer 0 provides that basic multiprogramming of the
CPU
Layer 1 – Memory and Drum Management – This layer deals with allocating memory to the
processes in the main memory. The drum is used to hold parts of the processes (pages) for which
space couldn’t be provided in the main memory. The processes don’t have to worry if there is
available memory or not as layer 1 software takes care of adding pages wherever necessary.
Layer 2 – Operator-Process communication – In this layer, each process communicates with
the operator (user) through the console. Each process has its own operator console and can
directly communicate with the operator.
Layer 3 – Input/Output Management – This layer handles and manages all the I/O devices,
and it buffers the information streams that are made available to it. Each process can
communicate directly with the abstract I/O devices with all of its properties.
Layer 4 – User Programs – The programs used by the user are operated in this layer, and they
don’t have to worry about I/O management, operator/processes communication, memory
management, or the processor allocation.
Layer 5 – The Operator – The system operator process is located in the outer most layer.
IV. Client-Server Model in Operating Systems
The client-server model in an operating system is a variation of the microkernel system. The
middle layer in the microkernel system is the one with servers. These servers provide some kind
of service to clients. This makes up the client-server model.
Communication between clients and servers is obtained by message passing. To receive a
service, one of the client processes constructs a message saying what it wants and sends it to the
appropriate service. The service then does it work and sends back the answer.
If the clients and servers are on the same machine, then some optimizations are possible. But
generally speaking, they are on different systems and are connected via a network link like LAN
or WAN.
The best example of this model is you reading this article learning about it right now. You are
the client, and you are requesting this page from whatever host this article has been uploaded to.
The internet is basically the example since much of the web operates this way.

V. Virtual Machines in Operating System


Virtual Machine abstracts the hardware of our personal computer such as CPU, disk drives,
memory, NIC (Network Interface Card) etc, into many different execution environments as per
our requirements, hence giving us a feel that each execution environment is a single computer.
For example, VirtualBox.
When we run different processes on an operating system, it creates an illusion that each process
is running on a different processor having its own virtual memory, with the help of CPU
scheduling and virtual-memory techniques. There are additional features of a process that cannot
be provided by the hardware alone like system calls and a file system. The virtual machine
approach does not provide these additional functionalities but it only provides an interface that is
same as basic hardware. Each process is provided with a virtual copy of the underlying computer
system.
We can create a virtual machine for several reasons, all of which are fundamentally related to the
ability to share the same basic hardware yet can also support different execution environments,
i.e., different operating systems simultaneously.
The main drawback with the virtual-machine approach involves disk systems. Let us suppose
that the physical machine has only three disk drives but wants to support seven virtual machines.
Obviously, it cannot allocate a disk drive to each virtual machine, because virtual-machine
software itself will need substantial disk space to provide virtual memory and spooling. The
solution is to provide virtual disks.
Users are thus given their own virtual machines. After which they can run any of the operating
systems or software packages that are available on the underlying machine. The virtual-machine
software is concerned with multi-programming multiple virtual machines onto a physical
machine, but it does not need to consider any user-support software. This arrangement can
provide a useful way to divide the problem of designing a multi-user interactive system, into two
smaller pieces.
Advantages:
1. There are no protection problems because each virtual machine is completely isolated
from all other virtual machines.
2. Virtual machine can provide an instruction set architecture that differs from real
computers.
3. Easy maintenance, availability and convenient recovery.
Disadvantages:
1. When multiple virtual machines are simultaneously running on a host computer, one
virtual machine can be affected by other running virtual machines, depending on the
workload.
2. Virtual machines are not as efficient as a real one when accessing the hardware.
VI. Exokernels
Exokernels are a subset of virtual machines. In this, the disks are actually partitioned, and
resources are allocated while setting it up. The different OS may be installed on different
partitions. Beneath both, the partition is what we call the exokernel.

You might also like