Unit 1: Introduction
1.1. Concept and function of operating systems
=> An Operating System (OS) is a system software that acts as an interface
between the user and the computer hardware.
It manages all the hardware and software resources of a computer
system and enables users to run applications efficiently.
OS = Manager of the entire computer system
Examples: Windows, Linux, macOS, Android, iOS.
Functions of Operating System
The main functions of OS include:
1. Process Management
Manages execution of programs (processes).
Performs process creation, scheduling, and termination.
Ensures CPU is used efficiently.
2. Memory Management
Allocates memory to programs.
Tracks which part of memory is being used.
Frees memory when no longer needed.
3. File Management
Manages creation, deletion, reading, and writing of files.
Organizes files into directories/folders.
Controls file permissions and access.
4. Device Management
Controls and coordinates peripheral device (keyboard, mouse,
printer, disk, etc.).
Uses device drivers to communicate with hardware.
Handles input/output (I/O) operations.
5. Security and Protection
Protects data and resources from unauthorized access.
Provides authentication (passwords, biometrics).
Manages permissions and encryption.
6. User Interface Management
Provides user interfaces such as:
GUI (Graphical User Interface) – Windows, icons, menus.
CLI (Command Line Interface) – Command prompt, terminal.
7. File System and Storage Management
Manages disk storage.
Maintains file systems like NTFS, FAT, EXT4.
Keeps track of free and used space.
8. Networking
Manages communication between computers.
Supports protocols like TCP/IP.
9. Error Detection and Handling
Detects hardware or software errors.
Takes appropriate action (warnings, logs, recovery).
10. Resource Allocation
Distributes resources (CPU time, memory, I/O devices) among
multiple users or programs.
1.2. Operating systems concept and functionality
1. Processes:
A process is a program in execution.
Key concepts of Processes
Process creation: OS creates a process when a program starts.
Process states: New Ready Running Waiting Terminated.
Process scheduling: OS decides which process runs on the CPU.
Context switching: Switching CPU from one process to another.
PCB (Process Control Block): Data structure storing process
information.
Functionality of OS in Process Management
Allocates CPU time.
Manages process communication (IPC).
Handles synchronization and deadlocks.
Supervises process execution.
2. Files
A file is a collection of related data stored on a disk.
Types of Files
Text files
Binary files
Executable files
Multimedia files (audio/video)
File system Functions
File creation and deletion
Opening, reading, writing, closing files
Managing directories
Access control (permissions)
Maintaining file metadata (name, size, type, timestamps)
The OS uses file systems like NTFS, FAT32, ext4, etc., to organize data.
3. System Calls
=> A system call is a request made by a program to the OS kernel for a
service it cannot perform on its own.
Why System calls?
User programs cannot directly access hardware for safety and
security, so they use system calls.
Common Types of System Calls
1. Process control
Fork(), exec(), exit(), wait()
2. File management
open(), read(), write(), close()
3. Device management
ioctl(), read(), write()
4. Information maintenance
getpid(), gettimeofday()
5. Communication
pipe(), socket(), send(), recv()
System calls act as the interface between user programs and OS Kernel.
4. The Shell
The shell is a command interpreter that allows users to interact with the
OS.
Roles of Shell
Accepts commands from the user.
Interprets and executes them.
Provides scripting capability.
Types of Shells
CLI Shells: Bash, sh, zsh, Powershell
GUI Shells: Windows Explorer, KDE Plasma
Shell Functions
Command execution
Program launching
I/O redirection(>,<)
Piping (|)
Environment variable management
Shell scripting (automation)
1.3. Operating System Structure
An operating system is organized in different ways depending on
functionality, performance, and design complexity. The structure defines
how components interact, how services are provided, and how the OS
manages resources.
Some of the OS structures are as follows:
1. Monolithic Structure
Concept
Entire OS is one large program running in kernel mode.
All OS services (file system, memory management, device drivers,
system calls) run as part of the kernel.
Features
Fast performance
Strong interaction between components
Examples
MS-DOS
Early UNIX
2. Layered Structure
Concept
OS is divided into multiple layers, each built on top of the other.
Each layer uses services of the layer below it.
Advantages
Easy to design, debug, and modify
Each layer is independent
Disadvantages
Slower due to multiple layer interactions
Examples
THE OS (by Dijkstra)
Modern variations in some UNIX systems
3. MicroKernel Structure
Concept
Only the most essential features run in the kernel:
o Interprocess communication (IPC)
o Low-level hardware management
o Basic scheduling
Other services run in user space (file system, device drivers, etc.).
Advantages
Highly secure
Easily extendable
More stable (fault isolation)
Disadvantages
More overhead (frequent user-kernel communication)
Examples
Minix
QNX
macOS (uses hybrid microkernel)
4. Modular Structure (Modern OS)
Concept
OS is divided into modules that can be loaded/unloaded dynamically.
Combines benefits of monolithic and microkernel structures.
Features
Flexibility
Faster development
Better maintainability
Examples
Linux Kernel (Loadable Kernel Modules)
Windows NT-based systems
5. Hybrid Structure
Concept
Combination of monolithic + microkernel designs.
Core system is microkernel-like, but some services run in kernel
mode for performance.
Examples
Windows NT, 2000, XP, 10, 11
macOS (XNU kernel)
6. Virtual Machine Structure
Concept
OS provides an interface that stimulates hardware creates
multiple virtual machines.
Each VM runs its own OS instance.
Advantages
Strong isolation
Useful for testing and development
Examples
VMware
VirtualBox
Hyper-V
7. Client-Server Structure
Concept
OS services are split into clients (requesters) and servers (providers).
Often found in distributed and microkernel environments.
Examples
Some microkernel-based OS
Modern distributed operating systems.
“The End”