0% found this document useful (0 votes)
3 views7 pages

Operating Systems Assignment

The document provides a comprehensive overview of operating systems, detailing their architecture, resource management, and computational models. It discusses the roles of operating systems in managing hardware resources and providing user interfaces, as well as the distinctions between user mode and kernel mode. Additionally, it covers core subsystems, kernel architectures, scheduling algorithms, memory management, and modern trends like virtualization and containerization.

Uploaded by

varshneypawan956
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

Operating Systems Assignment

The document provides a comprehensive overview of operating systems, detailing their architecture, resource management, and computational models. It discusses the roles of operating systems in managing hardware resources and providing user interfaces, as well as the distinctions between user mode and kernel mode. Additionally, it covers core subsystems, kernel architectures, scheduling algorithms, memory management, and modern trends like virtualization and containerization.

Uploaded by

varshneypawan956
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer Applications

Operating Systems: Architecture, Resource


Management, and Computational Models

1 Introduction and Architectural Foundations

An Operating System (OS) is the primary system software architecture that mediates be-
tween physical hardware components and user-level applications. At its core, the sys-
tem acts as a resource manager and an abstract runtime environment. Hardware archi-
tectures—consisting of central processing units (CPUs), volatile physical memory (RAM),
registers, and various I/O peripheral controllers—present raw physical execution models.
Developing software that interfaces directly with these microarchitectural registers would
require custom drivers for every application. The operating system resolves this complex-
ity by introducing logical abstractions.

From an engineering perspective, the operating system serves two primary roles:

- System-Oriented View: It operates as a master resource allocator. It handles CPU


scheduling intervals, structural memory mapping, storage block placement, and de-
vice interrupts, resolving conflicting hardware requests from running processes to
prevent structural deadlock and resource starvation.

- User-Oriented View: It provides a standardized virtual machine environment. Users


and software developers interact with the hardware through simplified, clean system
APIs (Application Programming Interfaces) instead of low-level binary commands.

Modern operating systems execute instructions under two distinct processor execution
modes. The CPU enforces a hard hardware boundary:

1. User Mode: Applications run in a sandboxed, restricted execution space. Direct ac-
cess to system memory blocks or physical hardware is blocked by CPU architecture
constraints.

2. Kernel Mode: Also referred to as privileged or supervisor mode, the processor exe-
cutes instructions with absolute, direct access to all hardware structures, peripheral
controllers, and physical system memory locations.

Transitioning from User Mode to Kernel Mode requires a secure, controlled system gate
called a System Call. When an application needs to read a block of data from a storage
drive or write to a network socket, it executes a programmatic trap instruction. This trans-
fers instruction execution control to the operating system’s kernel, which evaluates system
permissions, executes the request safely in Kernel Mode, and then hands control back to
User Mode.

1
Computer Applications

2 Core Subsystem Management and Operational Mechanics

Modern operating systems are divided into several specialized, highly integrated subsys-
tem modules, each managing a critical hardware resource.

2.1 Process Control and Context Switching

A program is a static, passive entity saved as a set of instructions on a storage drive. A


process, however, is an active instance of that program in physical execution. A process’s
state is tracked inside a dedicated kernel memory structure called the Process Control
Block (PCB). The PCB contains:

- Process State: The current lifecycle status (e.g., New, Ready, Running, Waiting, Ter-
minated).

- Program Counter: The address of the next machine instruction to execute.

- CPU Registers: Temporary storage values inside the CPU core.

- Memory Management Data: Page tables, limit registers, and segment tables.

- I/O Status: A list of open files, network handles, and allocated peripheral devices.

When the OS scheduler pauses a process to run another, it executes a Context Switch.
This process must be highly optimized:

1. Save the CPU register state and program counter of the active process into its PCB.

2. Update the process state from Running to Ready or Waiting.

3. Load the saved register state, memory maps, and program counter of the next sched-
uled process from its PCB into the CPU core.

4. Transition the state of the new process to Running and jump to its program counter
to resume execution.

2.2 Memory Subsystem Architecture

The memory management subsystem coordinates physical memory (RAM). Because mul-
tiple processes run concurrently, the operating system must isolate memory spaces so
that one process cannot read or write to another’s memory.

Modern memory systems use Paging. Physical memory is divided into fixed-size blocks
called Frames. Logical user memory is divided into identical, same-sized blocks called
Pages. A process does not write directly to physical memory addresses. Instead, it writes
to logical addresses that are dynamically translated to physical frames by hardware com-
ponent called the Memory Management Unit (MMU) using a process-specific Page Ta-
ble. This abstraction removes the need for contiguous physical allocation, completely
eliminating external memory fragmentation.

2
Computer Applications

2.3 Storage and Device I/O Control

The file system translates raw disk blocks into user-friendly abstractions of files and di-
rectories. File systems use control structures called Inodes (Index Nodes) to store critical
file metadata, including owner permissions, size, modification timestamps, and direct/in-
direct block pointers indicating where the file data sits on the storage media.

The I/O subsystem handles the differences between varied peripheral hardware devices
using device-specific software modules called Device Drivers. To maintain high processor
efficiency, the system leverages three distinct operational mechanics:

- Interrupts: Hardware devices signal the CPU when an I/O operation completes, al-
lowing the CPU to execute other tasks in the meantime.

- Direct Memory Access (DMA): High-speed I/O controllers transfer data directly be-
tween device buffers and physical memory without passing every single byte through
the CPU core.

- Spooling: Devices like printers, which process tasks sequentially, use spooling queues
to buffer incoming jobs on disk, letting application processes complete immediately
without waiting for slow physical mechanisms.

3 Kernel Architectures: Comparative Structural Analysis

The kernel is the foundational engine of the operating system that runs continuously in
memory. Its design heavily influences system performance, extensibility, and fault toler-
ance.

3.1 Monolithic Kernels vs. Microkernels

The two primary design philosophies are Monolithic Kernels and Microkernels.

Table 1: Comparative Design Metrics of Kernel Architectures

Architectural Metric Monolithic Architecture Microkernel Architectu


Component Placement All subsystems run inside Kernel Space Only core IPC, memory, a
Driver Location Run in privileged Kernel Mode Run in sandboxed User M
System Performance Extremely high due to fast direct calls Lower due to message-p
Extensibility Harder; requires recompiling the kernel Easy; add services as use
System Stability High risk; one driver crash can crash the system Extremely high; crashed
Examples Linux, FreeBSD, Unix Mach, QNX, L4, GNU Hur

In a Monolithic Kernel (such as Linux), services like virtual memory management, device
drivers, network protocols, and file systems run inside a single, unified kernel address
space. Communications between components happen via fast, direct internal function
calls. While highly efficient, this model is vulnerable to driver failures: a single bug in a

3
Computer Applications

third-party graphics driver can corrupt memory structures, triggering a total system crash
(kernel panic).

The Microkernel model solves this by stripping the kernel down to its absolute essen-
tials: low-level memory allocation, thread scheduling, and basic Inter-Process Commu-
nication (IPC). All other services—including file systems and device drivers—are moved
to User Space as independent user-level daemons. While highly stable and modular, this
design incurs performance overhead. Subsystems must communicate using message-
passing systems, which require repeated, costly CPU transitions and context switches.

3.2 Hybrid and Specialized Architectures

To balance stability and speed, modern commercial operating systems like Windows NT
and macOS (XNU) use a Hybrid Kernel. This design runs critical, high-performance drivers
and file systems inside kernel space to avoid performance bottlenecks, while keeping
other modules sandboxed in user space to maintain system reliability.

For safety-critical, time-sensitive applications, engineers use a Real-Time Operating Sys-


tem (RTOS). Unlike standard time-sharing systems where task execution is optimized for
average throughput, an RTOS guarantees that critical tasks complete within strict, microsecond-
level deadlines. These systems are optimized for absolute predictability rather than overall
system speed.

4 Computational Scheduling and Synchronization Models

To run multiple applications concurrently on a finite number of physical CPU cores, the
operating system uses scheduling and synchronization algorithms.

4.1 Process Scheduling Algorithms

The short-term scheduler decides which ready process in memory gets CPU execution
time. Scheduler efficiency is evaluated using key performance metrics:

- CPU Utilization: The percentage of time the processor is executing user tasks.

- Throughput: The total number of processes completed per unit of time.

- Turnaround Time (Ttr ): The total time elapsed from process submission to comple-
tion.

- Waiting Time (Tw ): The total time a process spends waiting in the ready queue.

Schedulers use distinct mathematical algorithms to manage processes:

1. First-Come, First-Served (FCFS): A simple, non-preemptive scheduling model where


processes execute in the order they arrive. This model is vulnerable to the Convoy

4
Computer Applications

Effect, where short processes get blocked behind a single, slow, CPU-heavy process,
causing high average waiting times.
2. Shortest Job First (SJF): This algorithm maps the next CPU execution slot to the pro-
cess with the shortest CPU burst time. Mathematically, SJF minimizes average wait-
ing times. However, predicting future CPU burst lengths requires complex historical
heuristics.
3. Round Robin (RR): Designed for interactive, multi-user systems. Each process is
allocated a small, fixed slice of CPU execution time called a Time Quantum (typically
10 to 100 milliseconds). If the running process does not complete within its time
quantum, the CPU preempts it, sends it to the back of the ready queue, and loads
the next process.

4.2 Process Synchronization and Deadlock Mitigation

When multiple concurrent processes share access to common memory structures or re-
sources, they can encounter a Race Condition. This occurs when multiple threads read
and write to the same memory space, leaving the final value dependent on the exact order
of thread execution.

To prevent this, critical code regions that update shared resources must be protected
by synchronization mechanisms like Mutexes (mutual exclusion locks) or Semaphores.
These tools block multiple threads from entering a critical region simultaneously.

However, improper synchronization can lead to a system Deadlock. Deadlock occurs


when two or more processes are permanently blocked because each holds a resource
the other needs to proceed. A deadlock can only occur if all four of Coffman’s conditions
are met simultaneously:

- Mutual Exclusion: At least one resource must be held in a non-shareable state.


- Hold and Wait: A process must hold at least one resource while waiting to acquire
another.
- No Preemption: Resources cannot be forcibly taken from a process; they must be
released voluntarily.
- Circular Wait: A closed chain of processes exists, where each process holds a re-
source needed by the next process in the chain.

Operating systems prevent or resolve deadlocks using structural detection algorithms,


resource-allocation graphs, or the Bankers’ Algorithm, which dynamically evaluates whether
resource requests keep the system in a safe execution state.

5 Advanced Memory Allocation and Virtual Memory Mechanics

The virtual memory subsystem allows operating systems to execute processes whose total
memory requirements exceed the physical RAM installed in the computer.

5
Computer Applications

5.1 Paging Mechanics and Virtual-to-Physical Translation

When a CPU executes an instruction that accesses memory, it generates a virtual address.
This virtual address is divided into two parts: a Page Number (p) and a Page Offset (d).

The CPU’s Memory Management Unit uses the page number as an index into the active
process’s page table. The table lookup yields the physical Frame Number (f ). The physical
memory address is then calculated by combining the frame number with the offset:

Physical Address = (f × Page Size) + d

This lookup must run at hardware speed. To prevent the CPU from having to access the
page table in RAM for every single memory instruction, processors use a specialized, high-
speed hardware cache called the Translation Lookaside Buffer (TLB). The TLB caches
recent virtual-to-physical address mappings, achieving hit rates over 99%.

5.2 Page Faults and Allocation Strategies

If a process requests a virtual page that is not currently loaded in physical RAM, the page
table entry flags a Page Fault. This triggers a sequence of hardware and software steps:

1. The MMU traps to the operating system kernel.

2. The OS pauses the process and checks if the memory request is valid.

3. The OS locates a free physical frame in RAM. If RAM is full, it runs a page replacement
algorithm to select an active page to swap out to disk.

4. The selected page is written to disk, its page table entry is cleared, and the requested
page is read into the now-vacant frame.

5. The page table is updated, and the CPU resumes the process at the exact instruction
that triggered the page fault.

To balance swap space usage and system performance, operating systems use page re-
placement algorithms like Least Recently Used (LRU), which swaps out the page that has
not been accessed for the longest period. If the swap rate becomes too high, the system
can experience Thrashing. Thrashing occurs when a process spends more time swapping
pages in and out of disk than executing instructions, causing overall system performance
to crash.

6 Modern Trends: Virtualization and Cloud Paradigms

Operating system architectures have evolved to support highly distributed and abstracted
infrastructure.

6
Computer Applications

Through Virtualization, a specialized software layer called a Hypervisor allows multiple


virtual operating systems (Guest OSs) to run concurrently on a single physical host ma-
chine.

- Type-1 (Bare-Metal) Hypervisors: Run directly on the host machine’s physical hard-
ware (e.g., VMware ESXi, KVM). This design provides high resource efficiency and is
widely used in enterprise data centers.

- Type-2 (Hosted) Hypervisors: Run as applications on top of a traditional host oper-


ating system (e.g., VirtualBox).

Modern cloud infrastructures rely heavily on Containerization (such as Docker). Unlike


virtual machines, which package a complete guest operating system, containers share
the host operating system’s kernel. The kernel uses lightweight virtualization features
like Linux namespaces (to isolate process trees, network interfaces, and file mounts) and
cgroups (control groups, to limit CPU, memory, and I/O resource usage). This approach
minimizes performance overhead, allowing applications to start instantly and scale effi-
ciently across high-density server clusters.

You might also like