Topic: Understanding OS Architecture
1. Introduction to OS Architecture
OS architecture refers to the fundamental structure and organization of an operating system. It
encompasses the arrangement and interaction of various components and modules within the
OS, determining how they work together to manage hardware resources and provide services to
users and applications.
Key Elements of OS Architecture
1. Components and Modules
o The OS architecture defines different components such as the kernel, device
drivers, system libraries, and user interfaces. These components are
organized into modules that perform specific functions.
2. Interaction and Communication
o The architecture specifies how these components communicate with each
other. This includes the mechanisms for inter-process communication (IPC),
message passing, and system calls.
3. Resource Management
o The OS architecture outlines how resources like CPU, memory, and I/O
devices are managed and allocated to various processes. It ensures efficient
utilization and fair distribution of resources.
4. System Services
o The architecture defines the system services provided by the OS, such as file
management, process scheduling, and security. It organizes these services to
ensure they operate efficiently and effectively.
5. User and Application Interfaces
o The architecture specifies the interfaces through which users and
applications interact with the OS. This includes command-line interfaces,
graphical user interfaces, and application programming interfaces (APIs).
Key Elements in the Diagram
1. User Applications
o Software programs that perform specific tasks for users. They interact with the
OS through the user interface and system libraries.
2. User Interface (UI)
o The layer that facilitates interaction between the user and the OS.
Command-line Interface (CLI): Allows users to type commands.
Graphical User Interface (GUI): Provides graphical elements like
windows, icons, and buttons.
3. System Libraries
o Collections of standard functions and routines that applications can use to
perform common tasks.
o Application Programming Interfaces (APIs): Provide a set of functions and
procedures that allow the creation of applications that access the features or
data of the OS or other services.
4. System Services
o Core services provided by the OS to manage various system resources.
File Management
Process Management
Memory Management
I/O Management
Security
5. Kernel
o The core part of the OS that manages system resources and communication
between hardware and software.
Process Scheduling: Decides which process runs at any given time.
Memory Allocation: Manages memory usage by processes.
Device Drivers: Facilitate communication between the OS and hardware
devices.
Inter-Process Communication (IPC): Allows processes to communicate
and synchronize with each other.
6. Hardware Abstraction Layer (HAL)
o Provides an abstraction layer between the hardware and the OS.
o Abstracts hardware details and provides uniform interfaces for device drivers,
making it easier to support different hardware configurations.
7. Hardware
o The physical components of a computer system, including the CPU, memory, I/O
devices, and storage
Purpose and Importance of OS Architecture
i. Efficiency: A well-designed OS architecture optimizes performance by ensuring
efficient resource management and minimizing overhead.
ii. Modularity: Modular architectures allow for easier updates, maintenance, and
debugging by isolating different functionalities into separate components.
iii. Scalability: A scalable architecture can handle increasing workloads and expand
to accommodate new features and functionalities.
iv. Security: The architecture provides a framework for implementing robust
security measures to protect the system from unauthorized access and
vulnerabilities.
v. Reliability: By defining clear interactions and dependencies, the architecture
enhances the stability and reliability of the operating system.
Importance of understanding the OS architecture
Understanding OS architecture is crucial for optimizing performance, ensuring security, and
managing system resources effectively.
2. Types of OS Architectures
1. Monolithic Architecture
Description: The entire OS runs as a single program in kernel mode. All OS services operate
within a single address space. Examples include UNIX, early versions of Linux.
Characteristics
o High performance due to direct communication between components.
o Complex and difficult to debug.
Advantages
o Efficient system calls.
o Direct interaction between OS components.
Disadvantages
o Lack of modularity.
o Hard to maintain and extend.
2. Layered Architecture
Description: The OS is divided into layers, each built on top of the lower layers. Each layer
provides services to the layer above it and receives services from the layer below. Examples
include THE operating system, Windows NT, etc.
Characteristics
o Clear separation of concerns.
o Easier to understand and maintain.
Advantages
o Modularity enhances maintainability.
o Simplified debugging and testing.
Disadvantages
o Potential performance overhead due to layer interactions.
o Rigid structure can limit flexibility.
3. Microkernel Architecture
Description: Only essential OS functions run in kernel mode, such as communication between
hardware and software. Other services run in user mode. Examples include Mach, QNX
Characteristics
o Minimalist approach to the kernel.
o High modularity.
Advantages
o Improved security and stability.
o Easier to extend and maintain.
Disadvantages
o Performance overhead due to user mode/kernel mode transitions.
o Increased complexity in communication between modules.
4. Modular Architecture
Description: Similar to layered architecture but more flexible. Modules can be loaded or
unloaded dynamically as needed e.g., Modern versions of Linux
Characteristics
o Dynamic extensibility.
o Plug-and-play capability for OS components.
Advantages
o High flexibility and adaptability.
o Easier to update and enhance specific modules.
Disadvantages
o Potential for compatibility issues between modules.
o Managing dependencies can be complex.
3. Components of an OS Architecture
1. Kernel
Role
o The kernel is the core part of the operating system, responsible for managing system
resources and facilitating communication between hardware and software components.
It acts as a bridge between applications and the physical hardware of the computer.
Types
o Monolithic Kernel: All OS services (e.g., file system, device drivers) run in kernel mode.
Example: UNIX, early Linux.
o Microkernel: Only essential services (e.g., communication, basic I/O) run in kernel mode,
while other services run in user mode. Example: Mach, QNX.
o Hybrid Kernel: Combines aspects of both monolithic and microkernel architectures.
Example: Windows NT, modern Linux.
2. Shell
Role
o The shell provides the user interface to interact with the operating system. It interprets
user commands and requests, passing them to the kernel for execution.
Types
o Command-line Shell: Users interact with the system by typing commands. It is powerful
and flexible for advanced users. Example: Bash (Linux), Command Prompt (Windows).
o Graphical Shell: Users interact with the system through graphical elements like windows,
icons, and menus. It is user-friendly and intuitive. Example: GNOME (Linux), Windows
Explorer (Windows).
3. File System
Role
o The file system manages the storage, retrieval, and organization of data on storage
devices. It provides a structured way to store and access files and directories.
Features
o File Creation and Deletion: Allows users to create and remove files and directories.
o Access Control: Manages permissions to ensure only authorized users can access specific
files.
o Storage Management: Handles the allocation and deallocation of space on storage
devices, ensuring efficient use of available space.
o File Organization: Provides a hierarchical structure for organizing files and directories.
4. Device Drivers
Role
o Device drivers are specialized software components that enable the operating system
to communicate with hardware peripherals. They translate OS commands into
specific actions for the hardware devices.
Function:
o Compatibility: Ensure that different hardware devices can operate smoothly with the
OS, regardless of manufacturer.
o Operation: Facilitate the operation of hardware devices by managing their
functionality and translating software instructions into hardware actions. Examples:
Printer drivers, graphics card drivers.
5. System Utilities
Role
o System utilities are programs that perform maintenance and administrative tasks to
keep the operating system running efficiently and securely.
Examples
o Disk Cleanup: Frees up space on storage devices by removing unnecessary files.
o Antivirus Software: Protects the system from malware and viruses by detecting and
removing harmful programs.
o System Monitors: Track system performance and resource usage, providing
information and alerts about system health and potential issues.
o Backup Utilities: Help create and manage backups of important data to prevent loss
due to hardware failure or other issues.
o System Updates: Ensure the OS and installed applications are up-to-date with the
latest features and security patches.
4. Detailed Look at Each Architecture
Monolithic Architecture
Internal Structure
o Core Components: Process management, memory management, file systems, and device
drivers.
o Direct Interaction: All components interact directly with the hardware and each other.
Use Cases: High-performance computing environments where efficiency is critical.
Layered Architecture
Internal Structure
o Layer Design: Lower layers handle hardware interactions, and upper layers manage user
interfaces and application services.
o Service Abstraction: Each layer provides specific services to the layer above.
Use Cases: Systems where maintainability and modularity are essential, such as educational and
research systems.
Microkernel Architecture
Internal Structure
o Minimal Kernel: Core functions like IPC (Inter-Process Communication) and basic
scheduling.
o User Space Services: Additional services like file systems and device drivers run in user
space.
Use Cases: Systems requiring high reliability and security, such as embedded systems and critical
infrastructure.
Modular Architecture
Internal Structure:
o Dynamic Modules: Components can be added or removed without affecting the core
system.
o Plug-and-Play: Flexibility to adapt to changing requirements.
Use Cases: Modern operating systems like Linux that need to support a wide range of
applications and hardware configurations.
5. Examples of Operating Systems with Different Architectures
Monolithic Architecture:
UNIX: A powerful, multiuser OS widely used in servers and workstations.
Linux (Early Versions): An open-source OS known for its robustness and performance.
Layered Architecture:
THE Operating System: A pioneer in layered OS design.
Windows NT: A versatile OS used in both consumer and enterprise environments.
Microkernel Architecture:
Mach: An influential microkernel used in academic research and some commercial systems.
QNX: A real-time operating system used in embedded systems like automotive and industrial
applications.
Modular Architecture:
Modern Linux: A highly adaptable OS used in servers, desktops, and embedded systems.
Solaris: An enterprise OS known for its scalability and reliability.
Group Assignments
6. Activities and Discussion
Activity 1: Comparing Architectures
Objective: Understand the strengths and weaknesses of different OS architectures.
Task: Compare monolithic, layered, microkernel, and modular architectures in terms of
performance, security, and maintainability.
Discussion: Present findings and discuss real-world examples where each architecture is best
suited.
Activity 2: Case Study Analysis
Objective: Analyze the architecture of a specific operating system.
Task: Choose an OS (e.g., UNIX, Windows NT, Linux) and create a detailed report on its
architecture.
Discussion: Share reports and discuss how the chosen architecture impacts the OS’s performance
and usability.
Activity 3: Designing an OS
Objective: Apply knowledge of OS architectures to design a simple operating system.
Task: In groups, design an OS for a specific purpose (e.g., an embedded system for a smart home
device). Choose an appropriate architecture and justify your choice.
Discussion: Present designs and discuss the rationale behind the chosen architecture.
IT220 Operating Systems - Week 4 Student Notes
Topic: Process Model
1. Introduction to Processes
A process is a program in execution. It is the basic unit of work in an operating system, consisting of
the program code, current activity, and the associated resources such as memory and I/O devices.
Importance
Understanding processes is fundamental to comprehending how operating systems manage
multitasking and resource allocation.
2. Process States
Processes can exist in different states throughout their lifecycle. The primary states include:
1. New
The process is being created.
2. Ready
The process is waiting to be assigned to a CPU.
3. Running
The process is currently being executed by the CPU.
4. Waiting
The process is waiting for some event to occur (e.g., I/O completion).
5. Terminated
The process has finished execution.
State Diagram:
3. Process Control Block (PCB)
The Process Control Block (PCB) is a data structure used by the operating system to store information
about a process.
Components:
1. Process ID (PID):
o A unique identifier for the process.
2. Process State:
o Current state of the process (e.g., ready, running).
3. Program Counter:
o Address of the next instruction to be executed.
4. CPU Registers:
o Contents of all process-centric registers.
5. Memory Management Information:
o Details about memory allocated to the process.
6. I/O Status Information:
o List of I/O devices allocated to the process.
7. Accounting Information:
o Information for accounting and billing purposes.
4. Process Scheduling
Definition
Process scheduling is the activity of the operating system that handles the execution of processes
by the CPU.
Types of Schedulers
1. Long-Term Scheduler:
o Decides which processes should be brought into the ready queue.
2. Short-Term Scheduler:
o Decides which process from the ready queue should be executed next by the CPU.
3. Medium-Term Scheduler:
o Handles the swapping of processes between main memory and disk storage.
Scheduling Criteria
CPU Utilization: Keeping the CPU as busy as possible.
Throughput: Number of processes completed per time unit.
Turnaround Time: Total time taken from submission to completion of the process.
Waiting Time: Total time a process spends waiting in the ready queue.
Response Time: Time from submission of a request until the first response is produced.
Scheduling Algorithms
1. First-Come, First-Served (FCFS):
o Processes are scheduled in the order they arrive.
2. Shortest Job Next (SJN):
o Processes with the shortest execution time are scheduled next.
3. Priority Scheduling:
o Processes are scheduled based on priority.
4. Round Robin (RR):
o Each process gets an equal share of CPU time in a cyclic order.
5. Multilevel Queue Scheduling:
o Processes are divided into different queues based on priority and type.
5. Process Synchronization
Definition:
Process synchronization refers to the coordination of processes to ensure they execute in a safe
sequence when accessing shared resources.
Critical Section Problem
Critical Section: A part of the program where the process accesses shared resources.
Problem: Ensuring that only one process enters the critical section at a time to prevent race
conditions.
Synchronization Mechanisms
1. Mutex Locks:
o Mutual exclusion locks that prevent simultaneous access to a resource.
2. Semaphores:
o Variables used to solve the critical section problem by signaling mechanisms.
3. Monitors:
o High-level synchronization constructs that provide a mechanism to safely access shared
resources.
6. Process Communication
Definition:
Inter-Process Communication (IPC) allows processes to communicate and synchronize their
actions.
IPC Mechanisms:
1. Pipes:
o Unidirectional communication channel.
2. Message Queues:
o Allows processes to send and receive messages.
3. Shared Memory:
o Allows multiple processes to access the same memory space.
4. Sockets:
o Provides communication between processes over a network.
Example:
Activities and Discussions
Activity 1: Process State Simulation
Objective: Understand process state transitions.
Task: Simulate different process states (new, ready, running, waiting, terminated) using role-play
or software simulation tools.
Discussion: Discuss how processes move between different states and the impact on system
performance.
Activity 2: PCB Analysis
Objective: Explore the components of the Process Control Block.
Task: Analyze and create a PCB for a sample process, including all essential information.
Discussion: Discuss the importance of each component and how it helps in process management.
Activity 3: Scheduling Algorithm Simulation
Objective: Compare different scheduling algorithms.
Task: Simulate various scheduling algorithms (FCFS, SJN, RR, etc.) using software tools or manual
calculations.
Discussion: Evaluate the performance based on criteria like CPU utilization, throughput, and
response time.
Activity 4: Critical Section Problem
Objective: Understand process synchronization.
Task: Implement a solution to the critical section problem using mutex locks or semaphores in a
programming exercise.
Discussion: Discuss the importance of synchronization mechanisms and their real-world
applications.
Activity 5: IPC Mechanisms
Objective: Learn different IPC mechanisms.
Task: Implement IPC using pipes, message queues, or shared memory in a programming exercise.
Discussion: Discuss the advantages and disadvantages of each IPC mechanism.