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

OS Assignment

The document outlines an assignment for a course on Operating Systems, detailing the responsibilities of the OS and kernel in managing multiple applications, storage, and device coordination. It includes specific questions regarding system functionalities such as process management, memory protection, and file system operations. The assignment emphasizes understanding how these components work together to ensure system stability and security in a university computer lab setting.

Uploaded by

rabeyaasif1
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)
4 views7 pages

OS Assignment

The document outlines an assignment for a course on Operating Systems, detailing the responsibilities of the OS and kernel in managing multiple applications, storage, and device coordination. It includes specific questions regarding system functionalities such as process management, memory protection, and file system operations. The assignment emphasizes understanding how these components work together to ensure system stability and security in a university computer lab setting.

Uploaded by

rabeyaasif1
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

INSTITUTE OF BUSINESS MANAGEMENT

Spring Semester 2026

Course Title: Operating Systems Course Code: CSC313


Faculty: Fatima Ali Tabba Section: M-26971
Student ID: 20241-35761 Max Marks =05
Student Name: Rabeya Asif Obtained Marks=
Due Date: 27th Feb, 2026 12:00 am

Assignment should be submitted on LMS within given deadline.

Assignment-1
(CLO_1): (Cognitive Level C2, i.e., Understanding) (GA_2: Knowledge for solving problem) 05 MARKS

Q1. A university computer laboratory contains several desktop systems used by students for
programming, document editing, printing, and multimedia tasks.
The systems must:

 Run multiple applications simultaneously


 Store student files safely
 Share printers and storage devices
 Prevent unauthorized access to data
 Restart properly after shutdown or power failure

You are asked to explain how operating system and kernel responsibilities support these
requirements.

1. how operating system and kernel mechanisms allow multiple applications to run together
while maintaining system stability.
2. Discuss how operating system responsibilities related to storage handling, device
coordination, and access control ensure safe and organized system usage.
3. After powering on a computer, the system loads essential components before applications
start. Explain this initialization sequence and describe how applications communicate with
hardware during normal operation.

The systems must: Run multiple applications simultaneously, store student files safely, share printers
and storage devices, prevent unauthorized access to data, and restart properly after shutdown or power
failure.

Part (a): How the OS and Kernel Support Multiple Applications Running
Simultaneously
An operating system enables multiple applications to run concurrently through a mechanism called
process management and CPU scheduling. The kernel acts as the central authority that allocates
processor time to each running process in turn, creating the illusion that all programs are executing at
the same time.
Process Management:
The kernel creates a separate process for each running application (e.g., a compiler, a text editor, and
a media player). Each process has its own Process Control Block (PCB) that records its state, program
counter, CPU registers, and memory boundaries. When the CPU switches from one process to another
— a procedure called context switching — the kernel saves the outgoing process's PCB and loads the
incoming one, allowing seamless multitasking.
CPU Scheduling:
The OS scheduler uses algorithms such as Round Robin or Priority Scheduling to distribute CPU time
fairly among processes. In a university lab running 20 student programs at once, the scheduler ensures
no single program monopolizes the processor, maintaining system responsiveness and stability.
Memory Management:
Each application is allocated a separate region of RAM. The kernel uses virtual memory and page
tables so that one program cannot read or overwrite another program's memory. If a student's code
contains a bug causing a memory overflow, the OS isolates the damage to that process alone, keeping
all other applications intact.
System Stability:
The kernel enforces user mode vs. kernel mode separation. User applications run in restricted user
mode and must issue system calls to request privileged services (like writing to disk). This prevents
rogue code from directly accessing hardware, ensuring the overall system remains stable even if one
application crashes.

Part (b): Storage Handling, Device Coordination, and Access Control


Storage Handling — File System Management:
The OS provides a file system (e.g., NTFS, ext4) that organizes all data on disk into files and
directories. Students do not need to know which physical disk blocks their files occupy; the OS maps
logical file names to physical locations transparently. Operations such as creating, reading, writing,
and deleting files are performed through file management system calls (e.g., open(), read(), write(),
close() in Unix; CreateFile(), ReadFile() in Windows). The OS also maintains file metadata
(ownership, timestamps, permissions) to keep storage organized and consistent.
Device Coordination — I/O and Device Drivers:
The kernel uses device drivers — specialized software modules — to communicate with hardware
devices such as printers, USB drives, and network cards. When a student prints a document, the OS
queues the print job and communicates with the printer driver without requiring the student to
understand the printer's internal protocol. The kernel also handles device interrupts: when a USB drive
is plugged in, the hardware sends an interrupt signal to the CPU, which pauses its current task, invokes
the interrupt service routine (ISR), recognizes the new device, loads its driver, and mounts the file
system — all automatically.
Access Control — Security and Authorization:
The OS enforces access control by associating permissions with every file and directory. In a multi-
user lab environment, each student is assigned a user account with a unique User ID (UID). Files are
tagged with an owner and permission bits (read/write/execute for owner, group, and others). If Student
A tries to open Student B's private folder, the kernel checks the permissions and denies access,
preventing unauthorized data access. Additionally, kernel mode isolation ensures that no user-space
application can bypass these permission checks by directly accessing disk hardware.

Part (c): Boot Initialization Sequence and Application–Hardware Communication


The Boot Initialization Sequence:
When a lab computer is powered on, the following sequence occurs:
Step 1 — Power-On & POST: The CPU initializes and immediately reads code from the
ROM/EEPROM firmware chip (BIOS or UEFI). The firmware runs the Power-On Self-Test (POST),
which checks that the CPU, RAM, storage, and other essential hardware components are functioning
correctly. If POST fails, the system halts and emits error beeps.
Step 2 — Bootstrap / Bootloader: After a successful POST, the BIOS/UEFI searches its configured
boot order (e.g., SSD first, then USB) and reads the first 512 bytes of the boot device, known as the
Master Boot Record (MBR) — or the GPT header on modern UEFI systems. This contains the primary
bootloader code, which in turn locates and loads a secondary bootloader (e.g., GRUB on Linux,
Windows Boot Manager on Windows).
Step 3 — Kernel Load: The bootloader finds the OS kernel on disk and loads it into RAM. It also
loads essential initial device drivers and data structures needed by the kernel.
Step 4 — Kernel Initialization: The kernel initializes subsystems: memory management, process
scheduler, interrupt handlers, and file systems. It starts daemon/system processes (background services
like networking daemons, print spoolers) that provide ongoing services.
Step 5 — Login Screen: Once all services are started, the OS presents the login interface (CLI shell
or GUI desktop), and the system is ready for student use.
How Applications Communicate with Hardware During Normal Operation:
After boot, applications never communicate with hardware directly. Instead, they use system calls —
a controlled interface that switches the CPU from user mode to kernel mode. For example:
• When a student's program calls printf() to display output, the C library translates this into a
write() system call.
• The kernel receives the system call, verifies the request, and invokes the appropriate device
driver (e.g., the display driver).
• The driver sends commands to the hardware (GPU/monitor) and returns the result to the
kernel, which returns it to the application.
• The CPU switches back to user mode, and the application continues executing.
This system call mechanism ensures that hardware access is always mediated, verified, and safe —
preventing crashes and security breaches.

Q2. Answer the following Questions

1. A user connects a USB drive and immediately accesses its contents.


Identify the OS and kernel responsibility involved.
2. Two programs attempt to use the CPU at the same time. State how the system
handles this situation.
3. A program crashes without affecting other running [Link] which
OS feature enables this behavior.
4. A user copies files from one folder to another without managing disk blocks
manually. Mention the OS functionality responsible.
5. An application requests keyboard input while another program prints
documents. Identify the kernel duty supporting simultaneous device usage.

(i) A user connects a USB drive and immediately accesses its contents.
OS and Kernel Responsibility Involved:
This scenario involves Device Management and Interrupt Handling. When the USB drive is physically
connected:
• The USB controller sends a hardware interrupt to the CPU.
• The CPU pauses its current task and executes the Interrupt Service Routine (ISR) associated
with the USB controller.
• The kernel detects the new device, loads the appropriate USB device driver, and mounts the
USB file system so its contents appear as a folder.
The OS responsibilities involved are: I/O device management (recognizing and initializing the device),
interrupt handling (responding to the hardware signal), and file system mounting (making the drive's
contents accessible to the user). This is handled entirely by the kernel's device manager without
requiring any action from the user beyond plugging in the drive.

(ii) Two programs attempt to use the CPU at the same time.
How the System Handles This:
The operating system handles simultaneous CPU requests through CPU Scheduling (Process
Management). Since a single CPU core can execute only one instruction stream at a time, the kernel's
scheduler manages concurrent processes as follows:
• Each process is assigned a time slice (quantum) by the scheduler.
• The scheduler uses an algorithm such as Round Robin — giving each process a fixed turn on
the CPU — or Priority Scheduling — giving higher-priority processes more CPU time.
• When a process's time slice expires, a timer interrupt fires, the kernel saves that process's
state (via context switching), and the next process is loaded.
From the user's perspective, both programs appear to run simultaneously because the switching
happens thousands of times per second. The kernel ensures fairness, prevents any one program from
starving others, and maintains system responsiveness.

(iii) A program crashes without affecting other running applications.


OS Feature Enabling This Behavior:
This behavior is enabled by Process Isolation and Memory Protection, which are core features of the
OS's memory management subsystem. Specifically:
• Each process runs in its own virtual address space, meaning it can only see and modify its
own allocated memory.
• The CPU hardware (using the MMU — Memory Management Unit) enforces these
boundaries. If a crashing program tries to access memory outside its space, the CPU raises a
segmentation fault or access violation exception.
• The kernel catches this exception, terminates only the offending process, and frees its
resources — without touching other processes.
Additionally, the user mode / kernel mode separation means that user-level applications cannot directly
corrupt kernel memory or other processes. This is why, in a modern OS, a crashed browser does not
take down the entire system or affect a simultaneously running document editor.

(iv) A user copies files from one folder to another without managing disk blocks
manually.
OS Functionality Responsible:
This is handled by File System Management, a key OS responsibility. The OS provides a file system
abstraction layer that completely hides the complexity of physical disk management from the user.
Specifically:
• The OS maintains a file system (e.g., NTFS, ext4, FAT32) that maps human-readable file
names and folder paths to physical disk sectors.
• When the user initiates a copy operation, the OS translates this into file management system
calls: open() the source file, read() its contents into a buffer, create()/write() to the
destination, and close() both file handles.
• The OS's disk scheduler determines which physical disk blocks to allocate for the copied file,
handles fragmentation, and updates the file allocation table — all transparently.
The OS functionality responsible is the File Management System Call interface combined with the
Virtual File System (VFS) layer, which abstracts physical disk operations into simple, high-level file
operations that any user or program can perform without specialized hardware knowledge.

(v) An application requests keyboard input while another program prints documents.
Kernel Duty Supporting Simultaneous Device Usage:
This scenario is supported by the kernel's Device Management and I/O Management functions,
specifically through interrupt-driven I/O and device driver isolation. Here is how both devices operate
concurrently:
• Each hardware device (keyboard, printer) is managed by its own device driver, operating
independently in the kernel.
• When the user presses a key, the keyboard controller fires a hardware interrupt. The CPU
briefly suspends its current work, the keyboard ISR reads the key code and places it in a
keyboard buffer, and the CPU resumes — all within microseconds.
• Simultaneously, the print spooler (a daemon process) is sending data to the printer driver,
which manages the print queue and communicates with the printer hardware asynchronously.
The kernel duty responsible is Interrupt-Driven Device Management combined with Buffered I/O. The
kernel maintains separate buffers for each device and uses interrupts to service them without blocking
one another. This means keyboard input is not blocked while printing occurs, and printing is not
interrupted by typing — both devices operate concurrently and independently under the kernel's
coordination.

You might also like