Module-1
Fundamentals of Operating System
Introduction of Operating Systems:
System Boot, Objectives of Operating System, Functions of Operating System, Operating System
Structure and Operations, Operating System Services, Multiprogramming, Multitasking,
Multithreading, Types of Operating System, Types of System Calls.
Self-learning Topics: Study of various Operating System Architecture like IoT, Android.
Introduction of Operating Systems
An Operating System (OS) is a program that acts as an intermediary between a user of a
computer and the computer hardware.
The primary purpose of an operating system is to provide an environment in which a user can
execute programs conveniently and efficiently.
Fig 1- Operating System Structure
An operating system can be viewed from two different perspectives:
1. User View
The user view focuses on ease of use and convenience.
The OS hides hardware complexity from the user.
It provides interfaces such as Graphical User Interface (GUI) or Command Line
Interface (CLI).
2. System View
The system view focuses on resource management.
The OS controls and allocates CPU time, memory, storage, and I/O devices.
It ensures fair and efficient sharing of resources among processes and users.
For the operating system to perform above mentioned functions, it must first be loaded into the
main memory and start executing. This loading of the operating system is not automatic and
requires a specific startup procedure known as the system boot process.
System Boot
System boot refers to the process of starting a computer system and loading the operating system
into memory.
Fig 2- System Boot Process
The process of System Boot is as follows:
1. When the system is powered on, a small program stored in firmware (BIOS (Basic
Input/Output System) or UEFI(Unified Extensible Firmware Interface)) begins execution.
This firmware initializes hardware components and performs diagnostic tests known as
POST (Power-On Self Test).
2. After successful initialization, the firmware locates and loads a bootstrap program (boot
loader) from secondary storage.
3. The bootstrap program loads the operating system kernel into memory.
4. Once loaded, the kernel initializes system data structures, device drivers, and system
services, after which the system becomes ready to accept user requests.
Types of Boot
Cold Boot – Booting the system from a powered-off state.
Warm Boot – Restarting the system without turning off power.
Goals and Objectives of Operating System
1. Convenience
The operating system makes a computer system easy and convenient to use. It provides a user-
friendly interface and hides the complexity of hardware operations, allowing users to run
programs without needing detailed knowledge of the hardware.
2. Efficient Use of Resources
An operating system ensures the efficient utilization of system resources such as CPU,
memory, storage, and I/O devices. It manages and allocates these resources among various
programs and users to maximize system performance.
3. Ability to Evolve
The operating system should be designed in such a way that it can adapt to new hardware and
software developments. This objective allows new features and system improvements to be
added without interrupting existing services.
Functions of Operating System
Following are the functions of Operating System:
1. Process Management
The operating system is responsible for managing processes. This includes:
Creation and termination of processes
Scheduling processes on the CPU
Providing mechanisms for process synchronization and communication
Handling deadlocks
Process management ensures that multiple programs can execute efficiently.
2. Memory Management
The operating system manages the main memory by:
Keeping track of which parts of memory are in use
Allocating and deallocating memory space to processes
Supporting virtual memory techniques such as paging
Efficient memory management allows programs to run smoothly without interference.
3. File-System Management
The operating system manages files stored on secondary storage. It performs:
Creation and deletion of files and directories
Management of file access permissions
Mapping of files onto physical storage
This function ensures organized and secure data storage.
4. I/O Device Management
The operating system controls input and output devices through:
Device drivers
Buffering, caching, and spooling
Providing a uniform interface to devices
This simplifies the use of hardware devices for users and programs.
5. Secondary-Storage Management
The operating system manages storage devices such as hard disks by:
Managing free disk space
Allocating storage space
Scheduling disk access
This ensures efficient use of secondary storage.
6. Protection and Security
The operating system provides protection by:
Controlling access to system resources
Ensuring user authentication
Protecting processes and data from unauthorized access
Security mechanisms maintain system integrity.
7. Networking
The operating system supports networking by:
Managing communication between systems
Providing protocols and services for data exchange
This allows resource sharing and communication across networks.
8. Command Interpreter System
The operating system provides a command interpreter or user interface:
Allows users to execute commands
Translates user instructions into system actions
Examples include shell and graphical interfaces.
Operating System Structure
Operating System structure refers to how the different parts of an operating system are
arranged and work together to perform system functions.
A proper structure makes the OS easy to develop, maintain, modify, and customize for
different applications.
1. Simple Structure
The simple structure is the earliest and most basic OS structure. It has no clear separation
between system components. This structure was used in the MS-DOS operating system.
Fig 3-Simple Operating System Structure
MS-DOS has four layers: ROM BIOS device drivers, MS-DOS device drivers, system
programs, and application programs. This layered arrangement makes the system
easier to design, manage, and update, so it is suitable for small and less complex
systems. However, if a user program fails, the entire operating system may crash.
Advantages
Easy to design and implement
Fast execution due to direct hardware access
Low memory and resource usage
Suitable for small or embedded systems
Disadvantages
Poor security due to lack of abstraction
Difficult to debug and maintain
One failure can crash the whole system
Not suitable for large or complex systems
2. Monolithic Structure
In a monolithic structure, the entire operating system runs as a single large program in kernel
mode.
Fig 4: Monolithic Kernel Structure
The monolithic OS manages all system functions through the kernel, which acts as the main
interface between hardware and software. It supports batch processing and time-sharing,
allowing multiple users to access the system. This type of OS was used in older systems like
banks for simple tasks. (Used in early UNIX systems.)
Advantages
High performance due to direct hardware access
Simple design with one large codebase
Fast execution (no inter-layer communication)
Disadvantages
A bug in one part can crash the entire system
Difficult to debug and maintain
Large kernel makes upgrades risky
Poor scalability
3. Layered Structure
Fig 5- Layered Structure
In a layered OS the system is split into levels where hardware is at the bottom and the user
interface is at the top and each layer uses the one below it which makes the system easier to
manage and debug.
Advantages
Easy to design, test, and debug
Clear separation of functions
Better security due to restricted access
Easy to modify or upgrade layers
Disadvantages
Slower performance due to multiple layers
Difficult to design efficient layer interactions
Less flexibility in accessing lower layers
5. Microkernel Structure
Fig 6: MicroKernel Structure
A microkernel OS removes unnecessary parts from the kernel and moves most services to user-
level applications. The kernel only handles core functions like memory management, process
scheduling, and basic communication.
This makes the system more secure and reliable because if a service crashes, the entire system
is not affected. Microkernels are used in modern OSs like macOS and QNX as they allow easier
updates and better system stability.
Advantages
Better security and reliability
Failure of one service does not crash the system
Easy to update and extend
Portable across hardware platforms
Disadvantages
Slower performance due to message passing
Frequent context switching
Complex initial design
6. Exokernel Structure
Fig 7- ExoKernel Structure
The Exokernel OS was developed at MIT and it provides application-level
control of hardware by separating resource management from protection.
It uses a tiny kernel that moves hardware abstractions to library operating
systems, avoiding forced abstractions.
This design gives developers more freedom, improves application control,
ensures security, and supports compatibility and portability.
Advantages
Very high performance
Fine-grained resource control
Flexible and customizable
Minimal kernel overhead
Disadvantages
Complex to develop and maintain
Security risks due to direct hardware access
Difficult debugging
Not suitable for general-purpose systems
6. Virtual Machine Structure
A Virtual Machine (VM) creates an illusion of multiple computers on a single physical
machine.
Each VM runs its own OS and applications.
It uses CPU scheduling and virtual memory.
Example: VirtualBox, VMware.
Advantages
Multiple OS on one machine
Strong isolation and security
Easy backup and recovery
Ideal for testing and development
Disadvantages
Performance overhead
High CPU, memory, and storage usage
Requires advanced management tools
Depends heavily on hypervisor security
Difference between Monolithic and MicroKernel
Monolithic Kernel Microkernel
All operating system services run in kernel space as Only essential services run in kernel space;
a single large program. others run in user space.
Large kernel size. Small and compact kernel.
Process management, memory management, file Only core services like IPC, basic
system, device drivers, system calls, etc. scheduling, and memory management.
Faster performance due to direct communication Slightly slower due to message passing
between services. between user and kernel space.
Less reliable; a failure in one service can crash the More reliable; failure of a service does not
entire system. crash the kernel.
Lower security due to large kernel code base. Higher security due to minimal kernel code.
Message passing (Inter-Process
Function calls within kernel.
Communication).
Difficult to extend or modify. Easy to extend and maintain.
Monolithic Kernel Microkernel
Difficult to debug due to large kernel. Easier to debug due to modular design.
UNIX, Linux (traditional design). Mach, MINIX, QNX.
Operating System Services
Program Execution
The operating system loads programs into memory and executes them.
It manages the execution of programs by providing mechanisms to start, pause, and
terminate them efficiently.
Ensures that programs run without interfering with each other.
I/O Operations
OS provides a uniform interface for input and output devices, such as keyboards,
printers, and disk drives.
Programs can perform I/O operations without worrying about hardware details.
Includes buffering, caching, and spooling to improve performance.
File System Manipulation
OS allows programs to create, delete, read, and write files.
Manages directories, file access permissions, and storage allocation.
Provides abstraction so programs do not deal directly with physical storage.
Communication Services
Enables processes to communicate and share data efficiently.
Supports shared memory and message-passing mechanisms for interprocess
communication.
Important in multiprogramming and distributed systems.
Error Detection and Handling
Monitors the system for hardware and software errors.
Detects errors in CPU, memory, I/O devices, and programs.
Takes corrective actions or notifies users to prevent system failures.
Resource Allocation
Allocates system resources like CPU, memory, and I/O devices among multiple
processes.
Ensures fair and efficient utilization of all system resources.
Handles conflicts when multiple processes compete for the same resource.
Protection and Security
Protects programs, files, and data from unauthorized access.
Ensures that only authorized users or processes can access certain resources.
Provides mechanisms for authentication, permissions, and encryption.
Multiprogramming
Multiprogramming is a technique used in operating systems where multiple programs or jobs are
kept in the main memory at the same time. The main idea is to maximize CPU utilization by
ensuring that the CPU always has a program to execute while other programs wait for I/O
operations.
In single-program systems, the CPU often remains idle while waiting for I/O. Multiprogramming
solves this problem by overlapping CPU and I/O operations, allowing another job to use the CPU
while one job waits for I/O.
How Multiprogramming Works
1. Several programs are loaded into memory simultaneously.
2. The operating system maintains a ready queue of jobs that are ready to execute.
3. While one program performs I/O, the CPU is allocated to another program.
4. Job scheduling is used to decide which program gets the CPU next.
5. This process continues, ensuring high CPU utilization and efficient use of resources.
Characteristics
Multiple Jobs in Memory: The OS keeps more than one program in memory to
minimize idle CPU time.
CPU Utilization: The CPU never remains idle as long as there are jobs in memory.
Job Scheduling: The OS schedules jobs intelligently to ensure smooth execution.
I/O Overlap: While one program waits for I/O, another can execute, reducing system
idle time.
Transparency: Users are unaware of multiprogramming; it occurs in the background.
Advantages of Multiprogramming
Higher CPU Utilization: Reduces idle CPU time by executing another job during I/O
waits.
Better Throughput: More jobs are completed in a given time.
Efficient Resource Usage: Memory, CPU, and I/O devices are used more effectively.
Foundation for Modern OS: Multiprogramming is the basis for multitasking and time-
sharing systems.
Disadvantages / Limitations
Complex OS Management: Requires sophisticated scheduling and memory
management.
Resource Contention: Multiple programs may compete for CPU, memory, and I/O
devices.
No Direct User Interaction: Users do not control the order of execution; it is managed
by the OS.
Security Risks: Running multiple programs simultaneously may lead to interference if
not properly managed.
Multitasking
Multitasking is a technique in which multiple tasks or processes share the CPU simultaneously,
giving the illusion that all tasks are executing at the same time. It is an extension of
multiprogramming where the operating system rapidly switches the CPU between tasks so that
users can interact with each program in real time.
Unlike simple multiprogramming, multitasking focuses on user convenience and interactive
computing, rather than just maximizing CPU utilization. It is often implemented in time-sharing
systems, where each process gets a small time slice (quantum) of the CPU.
How Multitasking Works
1. Several processes are loaded into memory simultaneously.
2. The OS maintains a ready queue of processes that are ready to execute.
3. The CPU executes a process for a fixed time slice (time quantum).
4. When the time slice expires, the OS performs a context switch to run the next process in
the queue.
5. This cycle continues, giving all processes the impression of running concurrently.
Characteristics
Rapid CPU Switching: The OS switches between processes quickly to simulate parallel
execution.
Time Sharing: Each process gets a small, fixed time slice for execution.
Interactive Systems: Users can interact with multiple programs at the same time.
Context Switching: The OS saves the state of a running process and restores the state of
the next process.
Advantages of Multitasking
Better User Experience: Multiple applications can run concurrently, making the system
interactive.
Efficient Resource Utilization: CPU and other resources are shared efficiently among
processes.
Reduced Response Time: Users get quicker responses from applications.
Foundation for Modern OS: Forms the basis of desktop, mobile, and server operating
systems.
Disadvantages / Limitations
Overhead of Context Switching: Frequent switching between processes adds CPU
overhead.
Complex OS Design: Requires sophisticated scheduling and memory management.
Resource Contention: Multiple processes may compete for CPU, memory, or I/O
devices.
Security and Stability Risks: Errors in one process may affect others if not properly
isolated.
Multithreading
Multithreading is a technique in which a single process is divided into multiple threads, each of
which can execute independently while sharing the same process resources such as memory and
open files.
Threads are sometimes called lightweight processes because they have lower overhead than full
processes. Multithreading allows a process to perform multiple tasks concurrently, improving
performance and responsiveness.
How Multithreading Works
1. A process is split into multiple threads.
2. Each thread has its own program counter, stack, and registers but shares memory and
resources with other threads of the same process.
3. Threads can run concurrently on a single CPU by time-slicing, or on multiple CPUs in
parallel.
4. Threads can communicate easily because they share the same memory space, making
data exchange faster than inter-process communication.
Characteristics
Lightweight: Threads require fewer resources than full processes.
Concurrent Execution: Threads of a process can run simultaneously.
Shared Memory: Threads share code, data, and resources of their parent process.
Independent Flow: Each thread has its own execution flow, stack, and registers.
Advantages of Multithreading
Faster Execution: Multiple threads can perform tasks in parallel.
Efficient Resource Use: Threads share memory and resources, reducing overhead.
Improved Responsiveness: Applications remain responsive while performing
background tasks.
Better CPU Utilization: Threads can utilize CPU time efficiently, especially in multi-
core systems.
Disadvantages / Limitations
Complex Programming: Writing and managing multi-threaded programs is challenging.
Synchronization Issues: Shared memory may cause race conditions and data
inconsistency.
Debugging Difficulty: Errors in threads are harder to detect and fix.
Security Risks: Shared resources may be accessed improperly if not protected.
Types of Operating System
1. Batch Operating System
A Batch Operating System is designed in the 1950 and 1960s to handle large groups of similar
jobs efficiently. It does not interact with the computer directly but instead processes jobs that
are grouped by an operator. These jobs are queued and executed one after the other, without
user interaction during the process.
Processes groups of similar jobs automatically in batches without user interaction.
Advantages of Batch Operating System
Minimal Idle Time: The system minimizes idle time by processing jobs in a continuous
sequence without human intervention.
Handling Repetitive Tasks: Ideal for managing large, repetitive tasks, such as payroll and
billing, with minimal effort.
Improved Throughput: Batch systems can handle high volumes of jobs at once,
improving overall system throughput.
Disadvantages of Batch Operating System
Inefficient CPU Utilization: When a job is waiting for input/output (I/O), the CPU
remains idle, leading to poor utilization of resources.
Increased Response Time: The time between job submission and output can be high as
all jobs are processed sequentially.
Lack of Real-Time Feedback: Users cannot interact with the system in real-time, making
it less suitable for interactive tasks.
Examples:
Payroll Systems
Bank Statements
2. Multi-Programming Operating System
In a Multi-Programming Operating System, multiple programs run in memory at the same
time. The CPU switches between programs, utilizing its resources more effectively and
improving overall system performance.
Runs multiple programs in memory at the same time to maximize CPU usage.
Advantages
Better CPU Utilization: CPU stays busy by switching to another job during I/O wait.
Improved Throughput: Multiple jobs run concurrently, increasing work done per unit
time.
Efficient Resource Use: CPU, memory, and I/O devices are shared effectively among
processes.
Disadvantages
Complex Design: Requires advanced memory management and CPU scheduling.
Security Issues: More programs in memory increase chances of unauthorized access.
High Memory Requirement: Needs larger RAM to run multiple programs together.
Banking systems
Railway servers
Billing machines
3. Multi-tasking/Time-sharing Operating systems
Multitasking OS is a type of multiprogramming system where each process runs in a round-
robin manner. Every task gets a fixed time slice called a quantum. After the quantum ends,
the OS switches to the next task, allowing multiple tasks—whether from one user or many—to
run smoothly on a single system.
Allows multiple tasks to run by giving each a small time slice for smooth, shared system use.
Advantages
Equal CPU Access: Each task gets a fair share of CPU time.
Reduced Software Duplication: Many users can run the same software without needing
separate copies.
Low CPU Idle Time: Efficient scheduling keeps the CPU busy.
Disadvantages
Lower Reliability: System failures affect all users.
Security Concerns: Multiple users increase risks to data integrity and privacy.
Communication Issues: Data sharing between users can cause conflicts.
IBM VM/CMS
TSO (Time Sharing Option
Windows Terminal Services
4. Multi-Processing Operating System
A Multi-Processing Operating System is a type of Operating System in which more than one
CPU is used for the execution of resources. It betters the throughput of the System.
Uses two or more CPUs simultaneously to increase speed and reliability.
Advantages
Faster Processing: Multiple CPUs work simultaneously, increasing overall system speed.
High Reliability: If one processor fails, others can continue working (fault tolerance).
Supports Heavy Tasks: Ideal for computation-intensive applications like scientific or
industrial tasks.
Disadvantages
High Cost: Multiple processors and complex hardware increase system cost.
Complex Design: Requires advanced OS support for communication and task distribution.
Not Always Efficient: Poor task distribution can lead to idle processors and wasted resources.
UNIX
Linux (Ubuntu, Red Hat, Debian)
macOS
5. Distributed Operating System
Distributed operating systems connects multiple independent computers through a shared
communication network. Each system has its own CPU and memory but works together as a
single unit. The main benefit is remote access, allowing users to use files and software stored
on other connected systems.
Connects multiple independent computers to function as a single coordinated system.
Advantages
Independent Systems: Failure of one machine does not affect others.
Easily Scalable: New systems can be added to the network easily.
Lower Processing Delays: Tasks are handled faster across multiple machines.
Disadvantages
Network Dependency: If the main network fails, communication stops.
Lack of Standardization: No well-defined language or model for building such systems.
High Cost & Complexity: Hardware is expensive, and the software is complex and not
widely understood.
Issues With Distributed Operating System
Networking causes delays in the transfer of data between nodes of a distributed system.
Such delays may lead to an inconsistent view of data located in different nodes and make it
difficult to know the chronological order in which events occurred in the system.