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

Operating Systems Module 1 - Comprehensive Notes

This document provides a comprehensive overview of operating systems, detailing their functions, operations, and types, including dual-mode operation and various computing environments. It discusses open-source operating systems, system services, user interfaces, system calls, and the architecture of operating systems, such as monolithic and microkernel structures. Additionally, it covers virtual machines, the system boot process, and debugging techniques used in operating systems.

Uploaded by

AMAN KUMAR SHAW
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 views6 pages

Operating Systems Module 1 - Comprehensive Notes

This document provides a comprehensive overview of operating systems, detailing their functions, operations, and types, including dual-mode operation and various computing environments. It discusses open-source operating systems, system services, user interfaces, system calls, and the architecture of operating systems, such as monolithic and microkernel structures. Additionally, it covers virtual machines, the system boot process, and debugging techniques used in operating systems.

Uploaded by

AMAN KUMAR SHAW
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

MODULE 1: INTRODUCTION TO OPERATING

SYSTEMS ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ~ Aman Kumar Shaw

Complete Deep-Dive Study Notes for [Link] CSE

1. Operating Systems Overview


1.1 Operating System Functions
In Simple Terms: Imagine a computer as a massive, chaotic factory. The CPU is the workers, the
memory is the warehouse, and the I/O devices (printers, keyboards) are the delivery trucks. The
Operating System (OS) is the Factory Manager. It ensures workers aren't fighting over the same tools,
the warehouse is organized, and deliveries happen on time.

Academic Definition: An Operating System is system software that acts as an intermediary between
the computer user and the computer hardware. It is a resource allocator and a control program.

Extensive Description:
The OS has two primary perspectives:
1.​ Resource Manager (System View): The OS dynamically allocates resources like CPU time,
memory space, file-storage space, and I/O devices to conflicting programs. It ensures efficiency
and fairness.
2.​ Control Program (User View): It provides a user-friendly environment (abstraction) and controls
the execution of user programs to prevent errors and improper use of the hardware.
Real-Life Example & Software Implementation:
●​ Real-Life: A government. It doesn't build roads itself, but it provides the environment, rules, and
budget for contractors to build them.
●​ Implementation: When you run Google Chrome, the OS (like Windows 11) allocates a specific
chunk of RAM to it. If Chrome tries to read memory belonging to your Antivirus, the OS functions
as a control program and blocks it (resulting in a crash or error, protecting the system).

1.2 Operating Systems Operations (Dual-Mode)


In Simple Terms: You (the user) are allowed to look at the menu and order food at a restaurant, but you
are absolutely not allowed to go into the kitchen and cook it yourself. You must ask the waiter.

Academic Definition:

Modern operating systems are interrupt-driven and rely on a Dual-Mode Operation to protect the
system from malicious or buggy software. This is achieved via a hardware "Mode Bit" (0 for Kernel, 1 for
User).

Extensive Description:
●​ User Mode (Mode bit = 1): When the computer is executing a normal application (like MS Word), it
runs in User Mode. It cannot directly access hardware.
●​ Kernel Mode (Mode bit = 0): Also called supervisor or privileged mode. The OS runs in this mode.
It has total access to all hardware and memory.
●​ The Transition: If a user program needs hardware access (e.g., reading a file), it generates a Trap
(a software interrupt). The hardware switches the mode bit to 0, transfers control to the OS, the OS
performs the action, changes the bit back to 1, and returns control to the user.
Real-Life Example & Software Implementation:
●​ Real-Life: A bank customer (User Mode) cannot open the vault. They must fill out a slip and give it
to the Bank Teller (Kernel Mode), who safely gets the money.
●​ Implementation: When a Java Spring Boot application wants to read a database file from the SSD,
it triggers a trap. The CPU switches from User Mode to Kernel Mode, the Linux Kernel reads the
SSD, and then hands the data back to the Java app in User Mode.

1.3 Computing Environments


In Simple Terms: Computers aren't just desktops anymore. An OS must adapt whether it's running a
tiny smartwatch, a massive server farm, or a car's braking system.

Extensive Description & Types:


1.​ Traditional Computing: Standalone PCs or office networks. (e.g., Windows 10).
2.​ Mobile Computing: OS optimized for battery life, touch interfaces, and limited memory. (e.g.,
Android, iOS).
3.​ Distributed Systems: A collection of separate computers connected via a network that appears to
the user as a single system. (e.g., A Hadoop cluster).
4.​ Client-Server Computing: Dumb or smart clients request data from a powerful central server.
(e.g., Your web browser talking to an AWS Web Server).
5.​ Real-Time Embedded Systems: Systems with rigid time constraints. If the OS misses a deadline
by a millisecond, the system fails. (e.g., VxWorks running an airplane's flight control system).

1.4 Open-Source Operating Systems


In Simple Terms: The blueprints (source code) for the OS are free for anyone in the world to download,
read, modify, and improve.

Extensive Description:
Unlike closed-source (proprietary) systems like Microsoft Windows or Apple macOS, open-source
operating systems thrive on community collaboration. Bugs are found and fixed rapidly.
●​ Advantages: Free, highly secure (because thousands of developers audit the code), and endlessly
customizable.
●​ Real-World Implementation: Linux is the king of open source. The Linux kernel powers the vast
majority of the internet's backend servers, all Android phones, and Docker containers.

2. System Structures
2.1 Operating System Services
In Simple Terms: These are the amenities provided by the hotel (OS) to the guests (Programs).

Extensive Description:
An OS provides services for the convenience of the programmer:
●​ Program Execution: Loading a program into RAM and running it.
●​ I/O Operations: Handling keyboards, mice, screens, and network cards.
●​ File-System Manipulation: Creating, deleting, reading, and writing files/directories.
●​ Communications: Allowing Process A to talk to Process B (Inter-Process Communication).
●​ Error Detection: Catching CPU, memory, or hardware errors to prevent full system crashes.

2.2 User and Operating-System Interface


In Simple Terms: How humans talk to the machine.

Types:
1.​ Command-Line Interface (CLI): Text-based. The user types commands directly. Highly efficient,
uses very little RAM, preferred by backend engineers. (e.g., Bash in Linux, Command Prompt in
Windows).
2.​ Graphical User Interface (GUI): Visual-based. Uses Windows, Icons, Menus, and a Pointer (WIMP).
User-friendly but consumes more CPU and RAM. (e.g., Windows Desktop, macOS Aqua interface).

2.3 System Calls


(Note: This is one of the most frequently asked topics in interviews!)

In Simple Terms: System Calls are the exact "function calls" or "API calls" that a user program uses to
ask the Operating System for a favor.

Academic Definition: System calls provide the programming interface to the services provided by the
operating system. They act as the bridge between User Space and Kernel Space.

Extensive Description:

Application developers almost never write direct System Calls in assembly language. Instead, they use
an API (Application Programming Interface) like the Win32 API (for Windows) or POSIX API (for
Linux/macOS).

When you call printf() in C or [Link]() in Java, the standard library intercepts this, prepares
the data, and triggers the actual system call (like write()) to the OS.

Real-Life Example & Software Implementation:


●​ Real-Life: You go to a pharmacy and hand a prescription to the pharmacist. The prescription is the
"System Call". You don't grab the medicine yourself.
●​ Implementation: When a [Link] server needs to create a new file, it uses the [Link]() method.
Under the hood, this triggers the open() POSIX system call, trapping into the Linux Kernel to
allocate disk space.
2.4 Types of System Calls
System calls are categorized into six main types. Here are the categories with their POSIX (Linux/Unix)
and Windows implementations:
1.​ Process Control: Create/terminate processes. (e.g., Linux: fork(), exit(), wait(). Windows:
CreateProcess()).
2.​ File Management: Create, read, write, delete files. (e.g., Linux: open(), read(), write(). Windows:
ReadFile()).
3.​ Device Management: Request/release hardware devices. (e.g., Linux: ioctl(). Windows:
SetConsoleMode()).
4.​ Information Maintenance: Get system time, date, or process attributes. (e.g., Linux: getpid(),
sleep(). Windows: GetSystemTime()).
5.​ Communications: Send/receive messages over a network or between processes. (e.g., Linux:
pipe(), shmget(). Windows: CreatePipe()).
6.​ Protection: Manage file permissions. (e.g., Linux: chmod(), chown(). Windows: SetFileSecurity()).

2.5 System Programs (System Utilities)


In Simple Terms: These are the apps that come pre-installed with the OS to help manage the
computer. They are not the kernel itself, but they sit right on top of it.

Extensive Description:
System programs provide a convenient environment for program development and execution.
Categories include:
●​ File management: Programs to format disks, copy files (e.g., cp, rm in Linux).
●​ Status information: Task Manager (Windows) or top (Linux) to see RAM/CPU usage.
●​ File modification: Text editors like Notepad or Vim.
●​ Programming-language support: Compilers (GCC), Assemblers.

2.6 Operating System Structure (Architecture)


(Note: Essential for understanding modern software architecture vs. legacy systems).

In Simple Terms: How is the OS code organized? Is it one giant messy file of code, or neatly organized
folders?

Types of Structures:

A. Monolithic Kernel
●​ Description: The entire operating system (file system, memory manager, CPU scheduler, device
drivers) runs as a single, massive program in Kernel Space.
●​ Advantages: Extremely Fast. Because everything is in one place, components communicate
instantly via direct function calls.
●​ Disadvantages: Hard to maintain. If a single audio driver crashes, it can bring down the entire OS
(a kernel panic or Blue Screen of Death).
●​ Implementation: Linux and MS-DOS use monolithic structures. (Though Linux uses "Loadable
Kernel Modules" to make it slightly more flexible).
B. Microkernel
●​ Description: The OS is stripped down to the bare minimum. The kernel only handles basic CPU
scheduling and memory. Everything else (file system, device drivers) runs in User Space as separate
"Servers".
●​ Advantages: Highly Secure and Stable. If the file system crashes, only the file system restarts;
the OS survives.
●​ Disadvantages: Slower. Because components are separated, they must communicate via
message passing through the microkernel, which creates overhead.
●​ Implementation: QNX (used in BlackBerry and modern car dashboards) and MINIX. macOS
(Darwin) uses a hybrid approach incorporating the Mach microkernel.
C. Layered Approach
●​ Description: The OS is broken into layers. Layer 0 is the hardware. Layer N is the User Interface.
Layer M can only use the functions of Layer M-1.
●​ Advantages: Very easy to debug. If layer 2 works but layer 3 fails, you know the bug is in layer 3.
●​ Disadvantages: Too rigid and slow. An application at Layer 5 might have to pass through 4, 3, 2,
and 1 just to read a disk.

2.7 Virtual Machines (VM)


In Simple Terms: Software that fakes being hardware. You can run a whole computer inside your
computer.

Extensive Description:
A Virtual Machine Monitor (VMM) or Hypervisor creates an illusion that a process has its own
dedicated CPU, memory, and disk.
●​ Type 1 Hypervisor (Bare-Metal): Runs directly on the hardware. Highly efficient. (e.g., VMware
ESXi, Microsoft Hyper-V). Used in massive Cloud Data Centers like AWS.
●​ Type 2 Hypervisor (Hosted): Runs as an application inside a host OS (like Windows). It then hosts
guest OSs. (e.g., Oracle VirtualBox, VMware Workstation).
●​ Implementation: If your company uses microservices, they are likely deploying them on AWS EC2
instances, which are essentially Type 1 Virtual Machines.

2.8 System Boot


In Simple Terms: The step-by-step process of waking a computer up from a dead, powered-off state
to displaying your desktop.

Extensive Description (The Boot Sequence):


1.​ Power On: Electric current is sent to the motherboard.
2.​ BIOS/UEFI & POST: The CPU executes a tiny firmware program on a ROM chip called BIOS (Basic
Input/Output System). It runs a POST (Power-On Self Test) to ensure RAM and keyboards are
physically working.
3.​ Find the Bootloader: The BIOS looks for a bootable drive (SSD/HDD) and reads its first sector
(Master Boot Record - MBR).
4.​ Bootloader Execution (e.g., GRUB): This small program (Stage 1) loads a larger bootloader (Stage
2) which understands file systems.
5.​ Load the Kernel: The bootloader grabs the OS Kernel (e.g., vmlinuz in Linux) from the disk and
loads it into RAM.
6.​ Init Process: The Kernel initializes hardware drivers and starts the very first User Space process
(often called init or systemd with a Process ID of 1). The system is now booted!

2.9 Operating System Debugging


In Simple Terms: The tools used by engineers to figure out why a program or the whole OS crashed.

Extensive Description:
●​ Core Dump: If a user application (like your Java backend) crashes due to a bug (like accessing
restricted memory), the OS saves the exact state of that program's memory into a file called a
"core dump". Developers can later open this file to see exactly which line of code caused the crash.
●​ Crash Dump: If the OS Kernel itself crashes, it dumps its memory state.
●​ Trace Tools: Tools like strace in Linux. As a backend engineer, if your app is running slowly, you can
use strace to watch every single System Call your app is making to the OS in real-time to find the
bottleneck.

You might also like