1-2. Introduction & OS Structure
1-2. Introduction & OS Structure
Contents
S . No. Topic Slide No
1 Introduction 1
2 Types of OS 6
3 Computer System Structure 11
4 Operating System Services 13
5 Evolution of OS 25
6 System Call & API 43
7 Kernel 60
8 OS Structure 73
9 Booting in OS 81
10 Interrupt 88
What is an operating system?
Definition: An operating system is the most
important software that runs on a computer. It
manages the computer's memory and processes,
as well as all of its software and hardware. It also
allows you to communicate with the computer
without knowing how to speak the computer's
language. Without an operating system, a
computer is useless.
Definition: An Operating System can be defined as an interface between user
and hardware. It is responsible for the execution of all the processes, Resource
Allocation, CPU management, File Management and many other tasks.
Microsoft Windows,
macOS, and
Linux.
Modern operating systems use a graphical user interface, or GUI. A GUI lets you
use your mouse to click icons, buttons, and menus, and everything is clearly
displayed on the screen using a combination of graphics and text.
Microsoft Windows
macOS (previously called OS X) is a line of operating systems created by Apple. It
comes preloaded on all Macintosh computers, or Macs. Some of the specific versions
include Mojave (released in 2018), High Sierra (2017), and Sierra (2016).
According to StatCounter Global Stats, macOS users account for less than 10% of
global operating systems—much lower than the percentage of Windows users (more
than 80%). One reason for this is that Apple computers tend to be more expensive.
However, many people do prefer the look and feel of macOS over Windows.
macOS
Linux (pronounced LINN-ux) is a family of open-source operating systems, which
means they can be modified and distributed by anyone around the world. This is
different from proprietary software like Windows, which can only be modified by the
company that owns it. The advantages of Linux are that it is free, and there are many
different distributions—or versions—you can choose from.
According to StatCounter Global Stats, Linux users account for less than 2% of global
operating systems. However, most servers run Linux because it's relatively easy to
customize.
Linux
The operating systems we've been talking about so far were designed to run
on desktop and laptop computers. Mobile devices such as phones, tablet
computers, and MP3 players are different from desktop and laptop computers, so
they run operating systems that are designed specifically for mobile devices.
Examples of mobile operating systems include Apple iOS and Google Android.
1. Program Execution
The purpose of computer systems is to allow the user to execute programs. So the operating system provides an environment
where the user can conveniently run programs. Running a program involves the allocating and deallocating memory, CPU
scheduling in case of multiprocessing.
2. I/O Operations
Each program requires an input and produces output. This involves the use of I/O. So the operating systems are providing I/O
makes it convenient for the users to run programs.
The output of a program may need to be written into new files or input taken from some files. The operating system provides
this service.
Operating System Services…
4. Communications
The processes need to communicate with each other to exchange information during execution. It may be
between processes running on the same computer or running on the different computers. Communications
can occur in two ways: (i) shared memory or (ii) message passing
5. Error Detection
An error is one part of the system may cause malfunctioning of the complete system. To avoid such a
situation operating system constantly monitors the system for detecting the errors. This relieves the user of
the worry of errors propagating to various part of the system and causing malfunctioning.
Operating System Services
Following are the three services provided by operating systems for ensuring the efficient operation of the system itself.
1. Resource allocation
When multiple users are logged on the system or multiple jobs are running at the same time, resources must be allocated to
each of them. Many different types of resources are managed by the operating system.
2. Accounting
The operating systems keep track of which users use how many and which kinds of computer resources. This record keeping
may be used for accounting (so that users can be billed) or simply for accumulating usage statistics.
3. Protection
When several disjointed processes execute concurrently, it should not be possible for one process to interfere with the others,
or with the operating system itself. Protection involves ensuring that all access to system resources is controlled. Security of
the system from outsiders is also important. Such security starts with each user having to authenticate him to the system,
usually by means of a password, to be allowed access to the resources.
1. Process Management
2. Process Synchronization
3. Memory Management
4. CPU Scheduling
5. File Management
6. Security
A process is a program in execution. A process needs certain resources, including CPU time, memory, files,
and I/O devices, to accomplish its task.
The operating system is responsible for the following activities in connection with process management.
• process synchronization
• process communication
Main-Memory Management
Memory is a large array of words or bytes, each with its own address. It is a repository of quickly
accessible data shared by the CPU and I/O devices. Main memory is a volatile storage device. It loses its
contents in the case of system failure.
The operating system is responsible for the following activities in connections with memory management:
♦ Keep track of which parts of memory are currently being used and by whom.
A file is a collection of related information defined by its creator. Commonly, files represent programs
The operating system is responsible for the following activities in connections with file management:
Since main memory (primary storage) is volatile and too small to accommodate all data and programs
permanently, the computer system must provide secondary storage to back up main memory.
Most modern computer systems use disks as the principle on-line storage medium, for both programs and
data.
The operating system is responsible for the following activities in connection with disk management:
✦ Storage allocation
✦ Disk scheduling
Distributed Systems ( Networking )
A distributed system is a collection processors that do not share memory or a clock. Each processor has its
own local memory.
✦ Computation speed-up
✦ Enhanced reliability
Protection System
Protection refers to a mechanism for controlling access by programs, processes, or users to both
Many commands are given to the operating system by control statements which deal with:
✦ process creation and management
✦ I/O handling
✦ secondary-storage management
✦ main-memory management
✦ file-system access
✦ protection
✦ networking
The program that reads and interprets control statements is called variously:
✦ command-line interpreter
✦ shell (in UNIX) : Its function is to get and execute the next command statement.
Types of Operating Systems
An operating system is a well-organized collection of programs that manages
the computer hardware. It is a type of system software that is responsible for
the smooth functioning of the computer system.
• In the 1970s, Batch processing was very
popular. In this technique, similar types of
jobs were batched together and executed in
time. People were used to having a single
computer which was called a mainframe.
Disadvantages of Batch OS
1. Starvation : Batch processing suffers from starvation.
2. Not Interactive : Batch Processing is not suitable for jobs that are dependent on the user's input.
If a job requires the input of two numbers from the console, then it will never get it in the batch
processing scenario since the user is not present at the time of execution.
• Multiprogramming is an extension to batch
processing where the CPU is always kept
busy. Each process needs two types of
system time: CPU time and IO time.
Disadvantages of Multiprogramming OS
• Multiprogramming systems provide an environment in which various systems resources are
used efficiently, but they do not provide any user interaction with the computer system.
In Multiprocessing, Parallel computing is
achieved. There are more than one processors
present in the system which can execute more
than one process at the same time. This will
increase the throughput of the system.
• Increased reliability: Due to the multiprocessing system, processing tasks can be distributed
among several processors. This increases reliability as if one processor fails, the task can be
given to another processor for completion.
• Increased throughout: As several processors increase, more work can be done in less.
Disadvantages of Multiprocessing OS
• Multiprocessing operating system is more complex and sophisticated as it takes care of multiple
CPUs simultaneously.
The multitasking operating system is a logical
extension of a multiprogramming system that
enables multiple programs simultaneously. It
allows a user to perform more than one computer
task at the same time.
Disadvantages of Multitasking OS
• The multiple processors are busier at the same time to complete any task in a
multitasking environment, so the CPU generates more heat.
An Operating system, which includes
software and associated protocols to
communicate with other computers via a
network conveniently and cost-effectively, is
called Network Operating System.
• In this type of operating system, network traffic reduces due to the division between clients and
the server.
Disadvantages of Network OS
• In this type of operating system, the failure of any node in a system affects the whole system.
• Security and performance are important issues. So trained network administrators are required for
network administration.
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, it will be completely useless. The Application of
a Real-Time system exists in the case of military
applications, if you want to drop a missile, then the missile
is supposed to be dropped with a certain precision.
Disadvantages of RTOS
• Multitasking
• Driver request
• Program crashes
• Task focus
Time Sharing Operating System
In the Time Sharing operating system, computer resources are
allocated in a time-dependent fashion to several programs
simultaneously. Thus it helps to provide a large number of user's
direct access to the main computer. It is a logical extension of
multiprogramming. In time-sharing, the CPU is switched among
multiple programs given by different users on a scheduled basis.
• Security and integrity of user programs loaded in memory and data need to be maintained as
many users access the system at the same time.
The Distributed Operating system is not installed on a single machine, it is divided into parts, and these parts are
loaded on different machines. A part of the distributed Operating system is installed on each machine to make
their communication possible. Distributed Operating systems are much more complex, large, and sophisticated
than Network operating systems because they also have to take care of varying networking protocols.
Disadvantages of Distributed OS
• Protocol overhead can dominate computation cost.
What is a System Call
A computer operates in two modes: User mode and Kernel mode. The execution of a
program is in the user mode. When the program requires RAM or a hardware resource,
it sends a request to the kernel and the mode changes from user mode to kernel mode.
System calls refer to these requests. After completing the task, the mode changes back
to the user mode. Likewise, the mode changes continuously. This transition is also
called context switching.
System Calls
A system call is a method for a computer program to request a service from the kernel of the operating
system on which it is running.
A system call is a method of interacting with the operating system via programs.
The Application Program Interface (API) connects the operating system's functions to user
programs.
It acts as a link between the operating system and a process, allowing user-level programs to request
operating system services.
The kernel system can only be accessed using system calls. System calls are required for any programs
that use resources.
What is an API
Different devices and applications share data between them. Some of them include online reservations
and booking systems. API (Application Programming Interface) helps to establish connectivity among
devices and applications. Moreover, it is an interface that takes the requests from the user and informs
the system about what should be done and return the response back to the user.
System Program
System programs, also known as system utilities, provide a convenient environment for program
development and execution. Some of them are simply user interfaces to system calls. Others are
considerably more complex. They can be divided into these categories:
File modification. Several text editors may be available to create and modify the content of files
stored on disk or other storage devices.
Program loading and execution. Once a program is assembled or compiled, it must be loaded
(loaders) into memory to be executed. Debugging systems for either higher-level languages or
machine language are needed as well.
System Program
Communications. These programs provide the mechanism for creating virtual connections among
processes, users, and computer systems. They allow users to send messages to one another’s screens, to
browse Web pages, to send e-mail messages, to log in remotely, or to transfer files from one machine to
another.
Background services. All general-purpose systems have methods for launching certain system-program
processes at boot time. Some of these processes terminate after completing their tasks, while others
continue to run until the system is halted. Constantly running system-program processes are known as
services, subsystems, or daemons. Example, the network daemon process schedulers, system error
monitoring services, print servers, etc.
Difference Between API and System Call
Definition
An API is a set of protocols, routines, functions that programmers use to develop software to facilitate
interaction between distinct systems. In contrast, a system call is a programmatic way in which a
computer program requests a service from the kernel of the operating system it is executing on. Thus,
these definitions contain the main difference between API and system call.
Usage
Another difference between API and system call is their usage. An API helps to exchange data between
various systems, devices and applications while a system call allows a program to access services from
the kernel of the operating system
Types of System Calls
Process Control
Process control is the system call that is used to direct the processes. Some process control examples include
creating, load, abort, end, execute, process, terminate the process, etc.
File Management
File management is a system call that is used to handle the files. Some file management examples include creating
files, delete files, open, close, read, write, etc.
Device Management
Device management is a system call that is used to deal with devices. Some examples of device
management include read, device, write, get device attributes, release device, etc.
Types of System Calls
Information Maintenance
Information maintenance is a system call that is used to maintain information. There are some examples of
information maintenance, including getting system data, set time or date, get time or date, set system data, etc.
Communication
Communication is a system call that is used for communication. There are some examples of communication,
including create, delete communication connections, send, receive messages, etc.
Examples of
Windows
and Unix
System Calls
Kernel in
Operating System
• Kernel is the core part of an OS(Operating system); hence it has full control over
everything in the system. Each operation of hardware and software is managed and
• It acts as a bridge between applications and data processing done at the hardware level.
• It is the part of the OS that always resides in computer memory and enables the
• It is the computer program that first loaded on start-up the system (After the
• kernel is kept and usually loaded into separate memory space, known as protected
• Other application programs such as browser, word processor, audio & video player use
• As it is a single piece of software hence, it's both sources and compiled forms are smaller.
Disadvantages:
• If any service generates any error, it may crash down the whole system.
• These kernels are not portable, which means for each new architecture, they must be rewritten.
• Inter process-Communication
• Memory Management
• CPU-Scheduling
Microkernel
Advantages:
• The architecture of this kernel is small and isolated hence it can function better.
• Expansion of the system is easier; it is simply added to the system application without disturbing the kernel.
Disadvantages:
• There is more requirement of software for interfacing, which reduces the system performance.
Advantages:
• There is no requirement for a reboot for testing.
Disadvantages:
• There is a possibility of more bugs with more interfaces to pass through.
• It can be a confusing task to maintain the modules for some administrators, especially when dealing with
issues such as symbol differences.
Advantages
A system as large and complex as a modern operating system must be engineered carefully if it is
to function properly and be modified easily.
A common approach is to partition the task into small components, or modules, rather than have
one monolithic system.
Each of these modules should be a well-defined portion of the system, with carefully defined
inputs, outputs, and functions.
Simple Structure
Many operating systems do not have well-defined
structures. Frequently, such systems started as small, simple,
and limited systems and then grew beyond their original
scope.
The layered structure approach breaks up the operating system into different layers and retains much
more control on the system.
The bottom layer (layer 0) is the hardware, and the topmost layer (layer N) is the user interface.
These layers are so designed that each layer uses the functions of the lower-level layers only.
It simplifies the debugging process as if lower-level layers are debugged, and an error occurs during
debugging.
Why use Layered
Structure?
• All the layers can be defined
separately and interact with each
other as required.
• Also, it is easier to create, maintain
and update the system if it is done in
the form of layers.
• Change in one layer specification
does not affect the rest of the layers.
• Each of the layers in the operating
system can only interact with the
above and below layers.
• The lowest layer handles the
hardware, and the uppermost layer
deals with the user applications.
6 layers in Layered Structure
Advantages of Layered Structure
1.Modularity: This design promotes modularity as each layer performs only the tasks it is scheduled to
perform.
2.Easy debugging: As the layers are discrete so it is very easy to debug.
3.Easy update: A modification made in a particular layer will not affect the other layers.
4.No direct access to hardware: The hardware layer is the innermost layer present in the design. So a user
can use the services of hardware but cannot directly modify or access it.
5.Abstraction: Every layer is concerned with its functions. So the functions and implementations of the
other layers are abstract to it.
Disadvantages of Layered Structure
1.Complex and careful implementation: As a layer can access the services of the layers below it, so the
arrangement of the layers must be done carefully. For example, the backing storage layer uses the services of the
memory management layer. So it must be kept below the memory management layer.
2.Slower in execution: If a layer wants to interact with another layer, it requests to travel through all the layers
present between the two interacting layers. Thus it increases response time, unlike the Monolithic system, which
is faster than this. Thus an increase in the number of layers may lead to a very inefficient design.
3.Functionality: It is not always possible to divide the functionalities. Many times, they are interrelated and can't
be separated.
4.Communication: No communication between non-adjacent layers.
Booting in
Operating System
1.Loading of BIOS: The small set on instructions present in the ROM is loaded into the computer
memory and CPU executes those instruction.
2.Power-On Self Test (POST): In order to check the operability of all the hardware connected to our
computer system, BIOS carries out POST which will check the hardware components and if any problem
is found user is alerted with POST beeps and POST screen messaged.
Boot- Sequence in OS
4. System Configuration is Accomplished: After the OS is loaded, device drivers are loaded into the
memory so that our devices can function correctly.
5. System Utilities are Loaded: System utilities like antivirus, volume control etc. are loaded into the
memory in this step
6. User Authentication: If any user authentication is being set, the system will ask the user to enter the
credentials and on receiving the correct credentials the computer system will run GUI shell (in most
cases) or CLI shell.
Type of Booting
2.Warm Booting/ Soft Booting: Warm booting is the process in which the computer gets restart due to
reasons like setting the configuration for newly installed software or hardware. Warm booting is called
as rebooting.
Dual Booting
When we have two different operating system on our computer it is called Dual Booting. But now as we
have multiple OS present, bootloader need to load the Operating System which user selects from the
menu that is being displayed on the monitor. If no action is performed withing few seconds, the default
Operating System is loaded.
We can have multiple Operating System on single bootable device by Creating Partitions.
By creating partition on the bootable device like hard disk, each partition can have its own Operating
System and during run time on selection of the Operating System from user, that particular Operating
System is loaded into the memory of the computer system.
Interrupt
Interrupts are the events that take place to inform the operating system to stop the execution of the
current process and handle the Interrupt Service Routine (ISR).
ISR is responsible to find out which software or hardware caused the interrupt and informing
the CPU about it.
CPU will service the request and after the completion of the request, CPU resumes the execution of
the process which CPU was previously executing.
Interrupts can be caused by hardware as well as software.
Types of Interrupt
Hardware Interrupt
When an external device wants the attention of the operating system to service a certain request, they
raise an interrupt which is called hardware interrupts. All the external devices are connected to a
single Interrupt Request Line and the Interrupt Request Line is used for the interrupts.