Operating Systems
Module 1
Introduction to operating systems, System structures
Operating System
An Operating System (OS) is system software that acts as an interface between the computer
hardware and the user. It manages hardware resources and provides services for application programs.
What Does an Operating System Do?
An Operating System (OS) performs the following functions:
1. Manages Processes
o Creates, schedules, and terminates programs.
o Enables multitasking.
2. Manages Memory
o Allocates and deallocates memory to programs.
o Ensures efficient use of RAM.
3. Manages Files
o Creates, stores, retrieves, and deletes files and folders.
4. Manages Devices
o Controls hardware devices such as keyboards, printers, monitors, and disks through
device drivers.
5. Provides User Interface
o Allows users to interact with the computer through a Graphical User Interface (GUI) or
Command-Line Interface (CLI).
6. Provides Security
o Protects data and resources using passwords, permissions, and access control.
7. Handles Input and Output Operations
o Coordinates communication between the CPU, memory, and peripheral devices.
Computer System Organization
Computer System Organization refers to the way different hardware components of a
computer are arranged and work together to execute pro grams and process data.
Definition
Computer System Organization is the structure and operational arrangement of computer hardware
components such as CPU, memory, input/output devices, and storage units that work together to
execute programs and process data.
Main Components of a Computer System
1. Central Processing Unit (CPU)
o Known as the "brain" of the computer.
o Executes instructions and processes data.
o Consists of:
Arithmetic Logic Unit (ALU) – Performs arithmetic and logical operations.
Control Unit (CU) – Controls and coordinates all activities.
Registers – Temporary storage locations.
2. Memory Unit
o Stores data and instructions.
o Types:
Primary Memory (RAM, ROM)
Secondary Memory (Hard Disk, SSD, Pen Drive)
3. Input Unit
o Accepts data and instructions from users.
o Examples: Keyboard, Mouse, Scanner.
4. Output Unit
o Displays processed results.
Examples: Monitor, Printer, Speakers.
o
5. System Bus
o Connects CPU, memory, and I/O devices.
o Types:
Data Bus
Address Bus
Control Bus
Working of Computer System Organization
1. Input devices provide data to the computer.
2. Data is stored in memory.
3. CPU fetches instructions from memory.
4. CPU processes the data.
5. Results are sent to output devices or stored for future use.
Computer System Architecture
Computer System Architecture is the conceptual design and structure of a computer system that
defines how hardware components are organized and how they interact to execute instructions.
Definition
Computer System Architecture refers to the design of a computer system, including the CPU, memory,
input/output devices, and the instruction set used to process data and execute programs.
Components of Computer Architecture
1. Central Processing Unit (CPU)
The CPU is the "brain" of the computer.
It consists of:
Arithmetic Logic Unit (ALU) – Performs arithmetic and logical operations.
Control Unit (CU) – Controls and coordinates all activities in the computer.
Registers – Small, high-speed storage locations inside the CPU.
2. Memory Unit
Stores data and instructions.
Types:
Primary Memory
o RAM (Random Access Memory)
o ROM (Read Only Memory)
Secondary Memory
o Hard Disk Drives (HDD)
o Solid State Drives (SSD)
2. Memory Unit
Stores data and instructions.
Types:
Primary Memory
o RAM (Random Access Memory)
o ROM (Read Only Memory)
Secondary Memory
o Hard Disk Drives (HDD)
o Solid State Drives (SSD)
5. System Bus
Provides communication between components.
Types:
Data Bus – Transfers data.
Address Bus – Transfers memory addresses.
Control Bus – Transfers control signals.
Operating System Operations
1. Process Management
Creates and terminates processes.
Schedules CPU time among processes.
Supports multitasking.
Handles process synchronization and communication.
2. Memory Management
Keeps track of memory usage.
Allocates memory to programs when needed.
Deallocates memory after program execution.
Manages virtual memory.
3. File System Management
Creates, deletes, and organizes files and folders.
Controls access permissions.
Maintains file storage on secondary devices.
4. Device Management
Manages input and output devices.
Uses device drivers to communicate with hardware.
Allocates and releases devices to processes.
5. Secondary Storage Management
Manages hard disks and SSDs.
Allocates storage space.
Performs disk scheduling and data organization.
6. Security and Protection
Authenticates users through login credentials.
Prevents unauthorized access.
Protects data and system resources.
7. User Interface Management
Provides a way for users to interact with the computer.
Types:
o Command Line Interface (CLI)
o Graphical User Interface (GUI)
8. Networking Management
Enables communication between computers.
Manages network connections and resource sharing.
9. Error Detection and Handling
Detects hardware and software errors.
Takes corrective actions and generates reports.
Resource Management In OS
Resource Management is one of the main functions of an Operating System. It manages and allocates
computer resources efficiently among different programs and users.
Types of Resources Managed by an OS
1. CPU Management
o Allocates CPU time to processes.
o Schedules processes for execution.
2. Memory Management
o Allocates and deallocates memory to programs.
o Prevents memory conflicts between processes.
3. Device Management
o Controls input/output devices such as keyboards, printers, and disks.
o Coordinates device access among multiple processes.
4. File Management
o Organizes files and directories.
o Controls access permissions and storage allocation.
Objectives of Resource Management
Efficient utilization of resources.
Fair allocation among users and processes.
Improved system performance.
Prevention of resource conflicts and deadlocks.
Protection and Security in OS
Protection and Security are important functions of an Operating System that ensure system resources
and data are safe from unauthorized access and misuse.
Protection
Protection controls how processes and users access system resources.
Functions:
Restricts unauthorized access to files, memory, and devices.
Defines access rights for users and programs.
Prevents one process from interfering with another.
Security
Security protects the system from external and internal threats.
Functions:
User authentication through usernames and passwords.
Data encryption and secure communication.
Protection against malware, viruses, and cyberattacks.
Monitoring and auditing user activities.
Objectives
Ensure data confidentiality.
Maintain data integrity.
Provide system availability.
Prevent unauthorized access and misuse.
Distributed system in OS
A Distributed Operating System is an operating system that manages a group of independent
computers connected through a network and makes them appear to users as a single computer system.
Features
Resource sharing among multiple computers.
Communication through a network.
Transparency (users do not know where resources are located).
Load balancing to improve performance.
Fault tolerance and reliability.
Advantages
Faster processing through parallel execution.
Better resource utilization.
Increased reliability and availability.
Easy expansion by adding more computers.
Disadvantages
Complex design and maintenance.
Network failures can affect performance.
Security and synchronization issues.
Examples
Distributed cloud systems
Distributed database systems
Google distributed services
Hadoop clusters
Computing environments in OS
A Computing Environment refers to the type of computing system in which an operating system
operates and provides services to users and applications.
Types of Computing Environments
1. Traditional Computing
o Uses standalone computers such as desktops and laptops.
o Resources are available locally.
2. Mobile Computing
o Uses portable devices such as smartphones and tablets.
o Supports wireless communication and mobility.
3. Client-Server Computing
o Clients request services from a central server.
o Common in web applications and databases.
4. Peer-to-Peer (P2P) Computing
o All computers act as both clients and servers.
o Resources are shared directly among systems.
5. Distributed Computing
o Multiple computers work together to perform tasks.
o Appears as a single system to users.
6. Cloud Computing
o Computing resources are provided over the Internet.
o Offers on-demand access to storage, software, and processing power.
Benefits
Efficient resource utilization.
Easy data sharing and communication.
Scalability and flexibility.
Improved performance and reliability.
Operating System Structures
Operating System Services
Operating System Services are the functions provided by an operating system to help users and
programs execute efficiently.
1. User Interface (UI)
Provides interaction between the user and the computer.
Examples: Graphical User Interface (GUI) and Command Line Interface (CLI).
2. Program Execution
Loads programs into memory and executes them.
Terminates programs after completion.
3. I/O Operations
Manages input and output devices such as keyboards, printers, and disks.
4. File System Manipulation
Creates, deletes, reads, writes, and organizes files and directories.
5. Communication
Enables data exchange between processes and computers through networks.
6. Error Detection
Detects and handles hardware, software, and system errors.
7. Resource Allocation
Allocates CPU, memory, storage, and devices to processes.
8. Accounting
Tracks resource usage and system performance.
9. Protection and Security
Prevents unauthorized access to data and system resources.
Provides authentication and access control.
User–Operating System Interface
A User–Operating System Interface is the medium through which a user interacts with the operating
system to perform tasks and access system resources.
Types of User–OS Interfaces
1. Command Line Interface (CLI)
o Users type commands using a keyboard.
o Requires knowledge of commands.
o Example: Command Prompt, Terminal.
2. Graphical User Interface (GUI)
o Uses windows, icons, menus, and pointers.
o Easy and user-friendly.
o Example: Microsoft Windows, macOS.
3. Touchscreen Interface
o Users interact by touching the screen.
o Common in smartphones and tablets.
Functions
Accepts user commands and inputs.
Provides access to files, applications, and devices.
Displays output and system information.
Acts as a bridge between the user and the computer hardware.
System Calls in Operating System
A System Call is a mechanism that allows a user program to request services from the operating
system kernel.
It acts as an interface between a user process and the operating system.
Why System Calls are Needed
To access hardware resources safely.
To perform operations that require OS support.
To communicate with the kernel.
Working of a System Call
1. User program requests a service.
2. System call transfers control to the OS kernel.
3. Kernel performs the requested operation.
4. Control returns to the user program.
Types of System Calls
1. Process Control
o Create, execute, and terminate processes.
o Example: fork(), exit()
2. File Management
o Create, open, read, write, and delete files.
o Example: open(), read(), write()
3. Device Management
o Request and release devices.
o Read from or write to devices.
4. Information Maintenance
o Get or set system information such as date, time, and process details.
5. Communication
o Exchange data between processes.
o Example: message passing, shared memory.
6. Protection
o Control access permissions and security settings.
System Programs in Operating System
System Programs are software utilities provided by the operating system that help users and
programmers perform various tasks and manage the computer system.
Functions of System Programs
1. File Management
o Create, delete, copy, rename, and organize files and directories.
2. Status Information
o Display system information such as date, time, memory usage, and performance.
3. File Modification
o Edit and modify the contents of files.
4. Programming Support
o Provide tools such as compilers, assemblers, debuggers, and interpreters.
5. Program Loading and Execution
o Load programs into memory and execute them.
6. Communication
o Enable communication between users and systems through networking tools.
7. Background Services
o Perform routine tasks such as printing, updating, and system monitoring.
Examples of System Programs
File Explorer
Command Prompt/Terminal
Text Editors
Compilers (GCC, Java Compiler)
Debuggers
System Monitoring Tools
Operating System Design and Implementation
Operating System Design and Implementation refers to the process of developing an
operating system to efficiently manage computer hardware and provide services to users and
applications.
Operating System Design Goals
1. User Goals
o Easy to use
o Reliable
o Fast and convenient
2. System Goals
o Efficient resource utilization
o Easy maintenance and modification
o High performance and security
Operating System Implementation
Most operating systems are written using high-level languages such as C and C++.
Some hardware-specific parts are written in Assembly Language.
Using high-level languages makes the OS easier to develop, debug, and maintain.
Design Considerations
1. Process Management – Managing execution of processes.
2. Memory Management – Allocating and controlling memory.
3. File System Design – Organizing and storing files.
4. Security and Protection – Preventing unauthorized access.
5. Device Management – Handling input/output devices.
Advantages of Good OS Design
Better performance.
Improved reliability.
Easy maintenance and upgrades.
Enhanced security.
Users
Application Program
Operating System
(Kernel)
Hardware
Operating System structure
Operating system can be implemented with the help of various structures. The structure of the OS
depends mainly on how the various common components of the operating system are interconnected
and melded into the kernel.
Depending on this we have following structures of the operating system:
Monolithic Structure
Layered Approach
Microkernels
Modules
Hybrid Systems
macOS and iOS
Android
Monolithic structure
Simple Structure
Characteristics
● monolithic
● poor separation between interfaces and levels of functionality
● ill-suited design, difficult to maintain and extend
Reasons
● growth beyond original scope and vision
● lack of necessary hardware features during initial design
● guided more by initial hardware constraints than by sound software engineering principles
● eg., MS-DOS, UNIX
Layered Approach
OS division into a number of layers (levels)
upper layers use functions and services provided by lower-level layers
Benefits
more modular, extensible, and maintainable design
achieves information hiding
simple construction, debugging, and verification
● Drawbacks
interdependencies make it difficult to cleanly separate functionality among layers
eg., backing-store drivers and CPU scheduler ●
less efficient than monolithic designs
Microkernels
Moves as much functionality from the kernel into “user” space
communicate between user modules using message passing
Benefits
easier to extend (user level drivers)
easier to port to new architectures
more reliable (less code is running in kernel mode)
more secure
Drawbacks
no consensus regarding services that should remain in the kernel
performance overhead of user space to kernel space communication
Modules
uses object-oriented approach
kernel provides core functionality, like communications, device drivers
additional services are modules linked dynamically
services talk directly over interfaces bypassing the kernel
Benefits
advantages of layered structure but with more flexible
advantages of microkernel approach, without message passing overhead
Drawbacks
not as clean a design as the layered approach
not as small a kernel as a microkernel
but, achieves best of both worlds as far as possible
Hybrid Systems
● combine multiple approaches to address performance, security, usability
● Linux
Monolithic, since OS is in a single address space
Modular, since can be extended dynamically
● Windows
Monolithic, but some microkernel aspects
● Hybrid OS – Android OS structure
modified Linux kernel for process, memory, device driver management
Runtime provided higher-level libraries and ART runtime
Uses bionic, rather than glibc 27 OS Structure – Hybrid Systems
● Example – Apple Mac OS X
hybrid, layered
Mach microkernel and BSD Unix, plus I/O kit, and dynamically loadable modules for kernel
extensions