From 3ae75cef50ebd8e31010e7a500e60d2bae9b09c3 Mon Sep 17 00:00:00 2001 From: Shivani Date: Fri, 15 May 2026 14:12:37 +0530 Subject: [PATCH 1/7] Added Operating System chapter-1 --- app/sem4/os/[chapter]/page.tsx | 12 +- app/sem4/os/components/sidebar.tsx | 2 +- app/sem4/os/content/chapter1.tsx | 407 +++++++++++++++++++++++++++++ 3 files changed, 414 insertions(+), 7 deletions(-) create mode 100644 app/sem4/os/content/chapter1.tsx diff --git a/app/sem4/os/[chapter]/page.tsx b/app/sem4/os/[chapter]/page.tsx index ae35026..aa4932d 100644 --- a/app/sem4/os/[chapter]/page.tsx +++ b/app/sem4/os/[chapter]/page.tsx @@ -1,6 +1,6 @@ import Link from "next/link"; import { Ch0Content } from "../content/chapter0"; -// import { Ch1Content } from "../content/chapter1"; +import { Ch1Content } from "../content/chapter1"; // import { Ch2Content } from "../content/chapter2"; // import { Ch3Content } from "../content/chapter3"; // import { Ch4Content } from "../content/chapter4"; @@ -22,11 +22,11 @@ const righteous = Righteous({ const chapters = [ { id: "ch0", title: "Course Outline", component: Ch0Content }, - // { - // id: "ch1", - // title: "Introduction to Operating Systems", - // component: Ch1Content, - // }, + { + id: "ch1", + title: "Introduction to Operating Systems", + component: Ch1Content, + }, // { // id: "ch2", diff --git a/app/sem4/os/components/sidebar.tsx b/app/sem4/os/components/sidebar.tsx index 65cc299..b04a717 100644 --- a/app/sem4/os/components/sidebar.tsx +++ b/app/sem4/os/components/sidebar.tsx @@ -16,7 +16,7 @@ export default function Sidebar() { const chapters = [ { id: "ch0", title: "Course Outline" }, - // { id: "ch1", title: "Introduction to Operating Systems" }, + { id: "ch1", title: "Introduction to Operating Systems" }, // { id: "ch2", title: "Process Management" }, // { id: "ch3", title: "CPU Scheduling" }, // { id: "ch4", title: "Process Synchronization" }, diff --git a/app/sem4/os/content/chapter1.tsx b/app/sem4/os/content/chapter1.tsx new file mode 100644 index 0000000..e31fd08 --- /dev/null +++ b/app/sem4/os/content/chapter1.tsx @@ -0,0 +1,407 @@ +import React from "react"; + +export const Ch1Content = () => { + return ( +
+ + {/* Introduction */} +

+ + Introduction to Operating Systems + {" "} + is one of the most important foundations in Computer Science. + An Operating System (OS) acts as an interface between the user + and computer hardware. It manages system resources, controls + program execution, handles memory, files, devices, and ensures + smooth functioning of the computer system. +

+ +

+ Every modern device — laptops, smartphones, servers, ATMs, + and smart TVs — uses an operating system. Common examples include + Windows, Linux, macOS, Android, and iOS. +

+ +
+ + {/* What is OS */} +
+

+ What is an Operating System? +

+ +
    +
  • + An Operating System is system software that manages hardware + and software resources. +
  • + +
  • + It provides an environment for executing application programs. +
  • + +
  • + It acts as an interface between the user and hardware. +
  • + +
  • + Without an operating system, computers cannot function properly. +
  • +
+ + {/* Diagram */} +
+
+ +
+ User +
+ +
+ +
+ Operating System +
+ +
+ +
+ Computer Hardware +
+ +
+
+ +
+ +
+ + {/* Objectives */} +
+

+ Objectives of Operating System +

+ +
    +
  • To make the computer system convenient to use.
  • + +
  • + To manage hardware resources efficiently. +
  • + +
  • + To improve system performance. +
  • + +
  • + To provide security and protection. +
  • + +
  • + To allow multitasking and resource sharing. +
  • +
+ +
+ +
+

+ Convenience +

+

+ Makes the system easier for users to interact with. +

+
+ +
+

+ Efficiency +

+

+ Ensures optimal utilization of hardware resources. +

+
+ +
+ +
+ +
+ + {/* Functions */} +
+

+ Major Functions of an Operating System +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Function + + Description +
+ Process Management + + Handles creation and scheduling of processes. +
+ Memory Management + + Allocates and manages system memory. +
+ File Management + + Organizes and controls files and directories. +
+ Device Management + + Controls input and output devices. +
+ Security + + Protects system and user data. +
+ +
+ +
+ +
+ + {/* Types */} +
+

+ Types of Operating Systems +

+ +
+ + {[ + "Batch Operating System", + "Multiprogramming Operating System", + "Multitasking Operating System", + "Real-Time Operating System", + "Distributed Operating System", + "Mobile Operating System", + ].map((type, index) => ( +
+

{type}

+
+ ))} + +
+ +
+ +
+ + {/* Structure */} +
+

+ Basic Structure of Operating System +

+ +

+ The Operating System sits between hardware and application programs. + It provides services that help applications communicate with hardware. +

+ + {/* Structure Diagram */} +
+ +
+ +
+ User +
+ +
+ Application Programs +
+ +
+ Operating System +
+ +
+ Hardware +
+ +
+ +
+ +
+ +
+ + {/* System Calls */} +
+

+ System Calls +

+ +

+ System calls provide communication between user programs + and the operating system. +

+ +
+ +
+ Examples of System Calls +
+ +
    +
  • File handling
  • +
  • Process creation
  • +
  • Memory allocation
  • +
  • Input and output operations
  • +
  • Communication between processes
  • +
+ +
+ +
+ +
+ + {/* Kernel and Shell */} +
+

+ Kernel and Shell +

+ +
    + +
  • + Kernel: Core part of the operating system + responsible for managing hardware resources. +
  • + +
  • + Shell: Interface through which users interact + with the operating system. +
  • + +
+ +
+ +
+ +
+ User +
+ +
+ +
+ Shell +
+ +
+ +
+ Kernel +
+ +
+ +
+ Hardware +
+ +
+ +
+ +
+ +
+ + {/* Advantages */} +
+

+ Advantages of Operating System +

+ +
    +
  • Efficient hardware utilization
  • +
  • Better user convenience
  • +
  • Supports multitasking
  • +
  • Provides security and protection
  • +
  • Improves overall system performance
  • +
+ + +
+ +
+ + {/* Summary */} +
+

+ Summary +

+ +

+ Operating Systems are the backbone of modern computing systems. + They manage hardware resources, execute programs, provide security, + and make computers convenient and efficient to use. Understanding + Operating Systems is essential for advanced computer science, + system programming, networking, and cybersecurity. +

+ +
+ +
+ ); +}; \ No newline at end of file From 64605ed44bb6d80e4762afa41a22de10e08b1569 Mon Sep 17 00:00:00 2001 From: Shivani Date: Fri, 15 May 2026 14:26:19 +0530 Subject: [PATCH 2/7] Added Operating System chapter2 --- app/sem4/os/[chapter]/page.tsx | 12 +- app/sem4/os/components/sidebar.tsx | 2 +- app/sem4/os/content/chapter2.tsx | 451 +++++++++++++++++++++++++++++ 3 files changed, 458 insertions(+), 7 deletions(-) create mode 100644 app/sem4/os/content/chapter2.tsx diff --git a/app/sem4/os/[chapter]/page.tsx b/app/sem4/os/[chapter]/page.tsx index aa4932d..296d494 100644 --- a/app/sem4/os/[chapter]/page.tsx +++ b/app/sem4/os/[chapter]/page.tsx @@ -1,7 +1,7 @@ import Link from "next/link"; import { Ch0Content } from "../content/chapter0"; import { Ch1Content } from "../content/chapter1"; -// import { Ch2Content } from "../content/chapter2"; +import { Ch2Content } from "../content/chapter2"; // import { Ch3Content } from "../content/chapter3"; // import { Ch4Content } from "../content/chapter4"; // import { Ch5Content } from "../content/chapter5"; @@ -28,11 +28,11 @@ const chapters = [ component: Ch1Content, }, - // { - // id: "ch2", - // title: "Process Management", - // component: Ch2Content, - // }, + { + id: "ch2", + title: "Process Management", + component: Ch2Content, + }, // { // id: "ch3", diff --git a/app/sem4/os/components/sidebar.tsx b/app/sem4/os/components/sidebar.tsx index b04a717..2ec16a9 100644 --- a/app/sem4/os/components/sidebar.tsx +++ b/app/sem4/os/components/sidebar.tsx @@ -17,7 +17,7 @@ export default function Sidebar() { const chapters = [ { id: "ch0", title: "Course Outline" }, { id: "ch1", title: "Introduction to Operating Systems" }, - // { id: "ch2", title: "Process Management" }, + { id: "ch2", title: "Process Management" }, // { id: "ch3", title: "CPU Scheduling" }, // { id: "ch4", title: "Process Synchronization" }, // { id: "ch5", title: "Deadlocks" }, diff --git a/app/sem4/os/content/chapter2.tsx b/app/sem4/os/content/chapter2.tsx new file mode 100644 index 0000000..b1841d7 --- /dev/null +++ b/app/sem4/os/content/chapter2.tsx @@ -0,0 +1,451 @@ +import React from "react"; + +export const Ch2Content = () => { + return ( +
+ + {/* Introduction */} +

+ + Process Management + {" "} + is one of the core responsibilities of an Operating System. + A process is simply a program that is currently being executed. + The operating system manages multiple processes efficiently + so that users can run several applications simultaneously + without conflicts. +

+ +

+ Whenever you open a browser, play music, edit documents, + or run games, the operating system creates and manages processes + for each task. +

+ +
+ + {/* What is a Process */} +
+

+ What is a Process? +

+ +
    + +
  • + A process is an instance of a program in execution. +
  • + +
  • + It contains program code, data, stack, registers, + and memory allocated during execution. +
  • + +
  • + Multiple processes can exist for the same program. +
  • + +
  • + Each process has its own Process ID (PID). +
  • + +
+ + {/* Diagram */} +
+ +
+ +

+ Process Memory Layout +

+ +
+ +
+ Stack +
+ +
+ Heap +
+ +
+ Data Section +
+ +
+ Code Section +
+ +
+ +
+ +
+ +
+ +
+ + {/* Process States */} +
+

+ Process States +

+ +

+ During execution, a process moves through different states + depending on CPU availability and execution status. +

+ +
    + +
  • + New: Process is being created. +
  • + +
  • + Ready: Process is waiting for CPU allocation. +
  • + +
  • + Running: Instructions are currently executing. +
  • + +
  • + Waiting: Process waits for I/O or events. +
  • + +
  • + Terminated: Process execution is completed. +
  • + +
+ + {/* Process State Diagram */} +
+ +
+ +
+ New +
+ +
+ +
+ Ready +
+ +
+ +
+ Running +
+ +
+ +
+ Waiting +
+ +
+ +
+ Terminated +
+ +
+ +
+ +
+ +
+ + {/* PCB */} +
+

+ Process Control Block (PCB) +

+ +

+ The Process Control Block is a data structure maintained + by the operating system for every process. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ PCB Component + + Purpose +
+ Process ID + + Unique identification number +
+ Process State + + Current status of process +
+ Program Counter + + Address of next instruction +
+ CPU Registers + + Stores register information +
+ Memory Information + + Details about allocated memory +
+ +
+ +
+ +
+ + {/* Scheduling */} +
+

+ Process Scheduling +

+ +

+ Process scheduling determines which process gets CPU time. + The scheduler ensures efficient CPU utilization and fairness. +

+ +
    + +
  • + Long-Term Scheduler: Selects processes from job pool. +
  • + +
  • + Short-Term Scheduler: Chooses process for CPU execution. +
  • + +
  • + Medium-Term Scheduler: Handles swapping processes. +
  • + +
+ + {/* Scheduling Diagram */} +
+ +
+ +
+ Job Queue +
+ +
+ +
+ Ready Queue +
+ +
+ +
+ CPU +
+ +
+ +
+ +
+ +
+ + {/* Context Switching */} +
+

+ Context Switching +

+ +

+ Context switching occurs when the CPU switches from one process + to another. The operating system saves the current process state + and loads the next process state. +

+ +
+ +
+ Steps in Context Switching +
+ +
    + +
  1. Save current process state
  2. + +
  3. Store PCB information
  4. + +
  5. Select next process
  6. + +
  7. Load next process state
  8. + +
  9. Resume execution
  10. + +
+ +
+ +
+ +
+ + {/* Threads */} +
+

+ Threads +

+ +

+ A thread is the smallest unit of CPU execution within a process. + Multiple threads can exist inside a single process. +

+ +
    + +
  • + Threads share memory and resources of the same process. +
  • + +
  • + Threads improve responsiveness and performance. +
  • + +
  • + Examples include browser tabs and multiplayer games. +
  • + +
+ +
+ +
+ +
+ Process +
+ +
+ +
+ Thread 1 +
+ +
+ Thread 2 +
+ +
+ Thread 3 +
+ +
+ +
+ +
+ +
+ +
+ + {/* Advantages */} +
+

+ Advantages of Process Management +

+ +
    + +
  • Efficient CPU utilization
  • + +
  • Supports multitasking
  • + +
  • Improves system responsiveness
  • + +
  • Allows concurrent execution
  • + +
  • Provides better resource sharing
  • + +
+ + +
+ +
+ + {/* Summary */} +
+

+ Summary +

+ +

+ Process Management is responsible for creating, scheduling, + executing, and terminating processes efficiently. + It ensures smooth multitasking, proper CPU utilization, + and effective resource sharing in modern operating systems. +

+ +
+ +
+ ); +}; \ No newline at end of file From c403078dcbf898d4eade477f3b1d38a8eece2e71 Mon Sep 17 00:00:00 2001 From: Shivani Date: Fri, 15 May 2026 14:31:51 +0530 Subject: [PATCH 3/7] Added Operating System chapter3 --- app/sem4/os/[chapter]/page.tsx | 12 +- app/sem4/os/components/sidebar.tsx | 2 +- app/sem4/os/content/chapter3.tsx | 530 +++++++++++++++++++++++++++++ 3 files changed, 537 insertions(+), 7 deletions(-) create mode 100644 app/sem4/os/content/chapter3.tsx diff --git a/app/sem4/os/[chapter]/page.tsx b/app/sem4/os/[chapter]/page.tsx index 296d494..aab363b 100644 --- a/app/sem4/os/[chapter]/page.tsx +++ b/app/sem4/os/[chapter]/page.tsx @@ -2,7 +2,7 @@ import Link from "next/link"; import { Ch0Content } from "../content/chapter0"; import { Ch1Content } from "../content/chapter1"; import { Ch2Content } from "../content/chapter2"; -// import { Ch3Content } from "../content/chapter3"; +import { Ch3Content } from "../content/chapter3"; // import { Ch4Content } from "../content/chapter4"; // import { Ch5Content } from "../content/chapter5"; // import { Ch6Content } from "../content/chapter6"; @@ -34,11 +34,11 @@ const chapters = [ component: Ch2Content, }, - // { - // id: "ch3", - // title: "CPU Scheduling", - // component: Ch3Content, - // }, + { + id: "ch3", + title: "CPU Scheduling", + component: Ch3Content, + }, // { // id: "ch4", diff --git a/app/sem4/os/components/sidebar.tsx b/app/sem4/os/components/sidebar.tsx index 2ec16a9..5795a6e 100644 --- a/app/sem4/os/components/sidebar.tsx +++ b/app/sem4/os/components/sidebar.tsx @@ -18,7 +18,7 @@ export default function Sidebar() { { id: "ch0", title: "Course Outline" }, { id: "ch1", title: "Introduction to Operating Systems" }, { id: "ch2", title: "Process Management" }, - // { id: "ch3", title: "CPU Scheduling" }, + { id: "ch3", title: "CPU Scheduling" }, // { id: "ch4", title: "Process Synchronization" }, // { id: "ch5", title: "Deadlocks" }, // { id: "ch6", title: "Memory Management" }, diff --git a/app/sem4/os/content/chapter3.tsx b/app/sem4/os/content/chapter3.tsx new file mode 100644 index 0000000..26501b9 --- /dev/null +++ b/app/sem4/os/content/chapter3.tsx @@ -0,0 +1,530 @@ +import React from "react"; + +export const Ch3Content = () => { + return ( +
+ + {/* Introduction */} +

+ + CPU Scheduling + {" "} + is the process used by an Operating System to decide + which process should use the CPU at a particular time. + Since multiple processes compete for CPU resources, + scheduling helps in maximizing CPU utilization, + improving system performance, and reducing waiting time. +

+ +

+ Efficient scheduling ensures that all processes get + fair access to the CPU while maintaining responsiveness + and system stability. +

+ +
+ + {/* Objectives */} +
+

+ Objectives of CPU Scheduling +

+ +
    + +
  • Maximize CPU utilization
  • + +
  • Reduce waiting time
  • + +
  • Improve turnaround time
  • + +
  • Increase throughput
  • + +
  • Provide fairness among processes
  • + +
  • Improve response time for interactive systems
  • + +
+ +
+ CPU scheduling is important because the CPU is one + of the most expensive and heavily used resources + in a computer system. +
+ +
+ +
+ + {/* Scheduling Queues */} +
+

+ Scheduling Queues +

+ +

+ Processes move through different queues during execution. +

+ +
    + +
  • + Job Queue: Contains all processes in the system. +
  • + +
  • + Ready Queue: Contains processes waiting for CPU. +
  • + +
  • + Device Queue: Contains processes waiting for I/O devices. +
  • + +
+ + {/* Queue Diagram */} +
+ +
+ +
+ Job Queue +
+ +
+ +
+ Ready Queue +
+ +
+ +
+ CPU +
+ +
+ +
+ Device Queue +
+ +
+ +
+ +
+ +
+ + {/* Types */} +
+

+ Types of Scheduling +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Type + + Description +
+ Long-Term + + Selects processes from job pool into memory +
+ Short-Term + + Chooses process for CPU execution +
+ Medium-Term + + Handles process swapping +
+ +
+ +
+ +
+ + {/* Criteria */} +
+

+ Scheduling Criteria +

+ +
    + +
  • + CPU Utilization: Keep CPU busy as much as possible. +
  • + +
  • + Throughput: Number of completed processes. +
  • + +
  • + Turnaround Time: Total time taken to execute process. +
  • + +
  • + Waiting Time: Time spent waiting in ready queue. +
  • + +
  • + Response Time: Time until first response is produced. +
  • + +
+ +
+ +
+ + {/* FCFS */} +
+

+ First Come First Serve (FCFS) +

+ +

+ FCFS executes processes in the order they arrive. + It is the simplest scheduling algorithm. +

+ +
    + +
  • Non-preemptive scheduling algorithm
  • + +
  • Easy to implement
  • + +
  • Can cause long waiting times
  • + +
+ + {/* FCFS Diagram */} +
+ +
+ +
+ P1 +
+ +
+ P2 +
+ +
+ P3 +
+ +
+ +
+ +
+ +
+ + {/* SJF */} +
+

+ Shortest Job First (SJF) +

+ +

+ SJF selects the process with the shortest burst time first. +

+ +
    + +
  • Provides minimum average waiting time
  • + +
  • Can be preemptive or non-preemptive
  • + +
  • Difficult to predict burst time accurately
  • + +
+ +
+ Example: + If processes have burst times 2ms, 5ms, and 8ms, + SJF executes the 2ms process first. +
+ +
+ +
+ + {/* Priority */} +
+

+ Priority Scheduling +

+ +

+ In Priority Scheduling, CPU is assigned according + to process priority. +

+ +
    + +
  • Higher priority processes execute first
  • + +
  • Can be preemptive or non-preemptive
  • + +
  • May cause starvation of low priority processes
  • + +
+ + {/* Priority Diagram */} +
+ +
+ +
+ P1 - Priority 1 +
+ +
+ P2 - Priority 2 +
+ +
+ P3 - Priority 3 +
+ +
+ +
+ +
+ +
+ + {/* Round Robin */} +
+

+ Round Robin Scheduling +

+ +

+ Round Robin assigns CPU to each process + for a fixed time quantum. +

+ +
    + +
  • Preemptive scheduling algorithm
  • + +
  • Provides fairness among processes
  • + +
  • Widely used in time-sharing systems
  • + +
+ + {/* RR Diagram */} +
+ +
+ +
+ P1 +
+ +
+ +
+ P2 +
+ +
+ +
+ P3 +
+ +
+ +
+ +
+ +
+ + {/* Dispatcher */} +
+

+ Dispatcher +

+ +

+ The dispatcher is responsible for giving control + of the CPU to the selected process. +

+ +
    + +
  • Performs context switching
  • + +
  • Switches CPU to user mode
  • + +
  • Starts execution of selected process
  • + +
+ +
+ +
+ + {/* Comparison */} +
+

+ Comparison of Scheduling Algorithms +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Algorithm + + Type + + Advantage + + Disadvantage +
+ FCFS + + Non-Preemptive + + Simple + + Long waiting time +
+ SJF + + Both + + Minimum waiting time + + Burst time prediction difficult +
+ Round Robin + + Preemptive + + Fair scheduling + + High context switching +
+ +
+ +
+ +
+ + {/* Summary */} +
+

+ Summary +

+ +

+ CPU Scheduling is an essential function of Operating Systems. + It determines how processes are allocated CPU time efficiently. + Different scheduling algorithms are used depending on system + requirements such as fairness, responsiveness, and throughput. +

+ +
+ +
+ ); +}; \ No newline at end of file From 7ac0c6b5fec1053cc69deba66a2c0f10a8fe0e2f Mon Sep 17 00:00:00 2001 From: Shivani Date: Fri, 15 May 2026 14:36:08 +0530 Subject: [PATCH 4/7] Added Operating System chapter4 --- app/sem4/os/[chapter]/page.tsx | 12 +- app/sem4/os/components/sidebar.tsx | 2 +- app/sem4/os/content/chapter4.tsx | 528 +++++++++++++++++++++++++++++ 3 files changed, 535 insertions(+), 7 deletions(-) create mode 100644 app/sem4/os/content/chapter4.tsx diff --git a/app/sem4/os/[chapter]/page.tsx b/app/sem4/os/[chapter]/page.tsx index aab363b..8dddb3f 100644 --- a/app/sem4/os/[chapter]/page.tsx +++ b/app/sem4/os/[chapter]/page.tsx @@ -3,7 +3,7 @@ import { Ch0Content } from "../content/chapter0"; import { Ch1Content } from "../content/chapter1"; import { Ch2Content } from "../content/chapter2"; import { Ch3Content } from "../content/chapter3"; -// import { Ch4Content } from "../content/chapter4"; +import { Ch4Content } from "../content/chapter4"; // import { Ch5Content } from "../content/chapter5"; // import { Ch6Content } from "../content/chapter6"; // import { Ch7Content } from "../content/chapter7"; @@ -40,11 +40,11 @@ const chapters = [ component: Ch3Content, }, - // { - // id: "ch4", - // title: "Process Synchronization", - // component: Ch4Content, - // }, + { + id: "ch4", + title: "Process Synchronization", + component: Ch4Content, + }, // { // id: "ch5", diff --git a/app/sem4/os/components/sidebar.tsx b/app/sem4/os/components/sidebar.tsx index 5795a6e..7590d5b 100644 --- a/app/sem4/os/components/sidebar.tsx +++ b/app/sem4/os/components/sidebar.tsx @@ -19,7 +19,7 @@ export default function Sidebar() { { id: "ch1", title: "Introduction to Operating Systems" }, { id: "ch2", title: "Process Management" }, { id: "ch3", title: "CPU Scheduling" }, - // { id: "ch4", title: "Process Synchronization" }, + { id: "ch4", title: "Process Synchronization" }, // { id: "ch5", title: "Deadlocks" }, // { id: "ch6", title: "Memory Management" }, // { id: "ch7", title: "Paging and Segmentation" }, diff --git a/app/sem4/os/content/chapter4.tsx b/app/sem4/os/content/chapter4.tsx new file mode 100644 index 0000000..eff77cb --- /dev/null +++ b/app/sem4/os/content/chapter4.tsx @@ -0,0 +1,528 @@ +import React from "react"; + +export const Ch4Content = () => { + return ( +
+ + {/* Introduction */} +

+ + Process Synchronization + {" "} + is a mechanism used by Operating Systems to coordinate + multiple processes or threads that access shared resources. + When several processes execute simultaneously, improper + access to shared data may lead to inconsistent results. +

+ +

+ Synchronization ensures that processes execute in a safe, + controlled, and coordinated manner without causing conflicts, + data corruption, or unexpected behavior. +

+ +
+ + {/* Critical Section */} +
+

+ Critical Section Problem +

+ +

+ A critical section is a part of a program where shared + resources such as variables, files, or memory are accessed. + Only one process should execute inside the critical section + at a time. +

+ +
    + +
  • + Shared resources must be protected from simultaneous access. +
  • + +
  • + Multiple processes entering together may produce incorrect output. +
  • + +
  • + Synchronization techniques solve this problem. +
  • + +
+ + {/* Diagram */} +
+ +
+ +
+ Process P1 +
+ +
+ → +
+ +
+ Critical Section +
+ +
+ ← +
+ +
+ Process P2 +
+ +
+ +
+ +
+ +
+ + {/* Requirements */} +
+

+ Requirements for a Good Synchronization Solution +

+ +
    + +
  • + Mutual Exclusion: Only one process enters critical section at a time. +
  • + +
  • + Progress: Waiting processes should eventually get access. +
  • + +
  • + Bounded Waiting: No process should wait forever. +
  • + +
+ +
+ These three conditions are very important for exam answers. +
+ +
+ +
+ + {/* Race Condition */} +
+

+ Race Condition +

+ +

+ A race condition occurs when multiple processes access + and modify shared data simultaneously, causing unpredictable results. +

+ +
+ +
+ +

+ Race Condition Example +

+ +
+ +
+ +
+ Process P1 +
+ +
    +
  • Read X = 5
  • +
  • Increment X
  • +
  • Write X = 6
  • +
+ +
+ +
+ +
+ Process P2 +
+ +
    +
  • Read X = 5
  • +
  • Increment X
  • +
  • Write X = 6
  • +
+ +
+ +
+ +

+ Expected Value = 7
+ Actual Value = 6 +

+ +
+ +
+ +
+ +
+ + {/* Mutex */} +
+

+ Mutex Lock +

+ +

+ Mutex stands for Mutual Exclusion. + A mutex lock allows only one process to access + the critical section at a time. +

+ +
    + +
  • Process must acquire lock before entering critical section.
  • + +
  • Lock is released after execution.
  • + +
  • Other processes wait until lock becomes free.
  • + +
+ + {/* Diagram */} +
+ +
+ +
+ Lock Acquired +
+ +
+ ↓ +
+ +
+ Execute Critical Section +
+ +
+ ↓ +
+ +
+ Release Lock +
+ +
+ +
+ +
+ +
+ + {/* Semaphore */} +
+

+ Semaphore +

+ +

+ A semaphore is a synchronization tool used + to manage access to shared resources. +

+ +
    + +
  • + Integer variable used for synchronization. +
  • + +
  • + Two operations: + wait() and + signal(). +
  • + +
  • + Helps avoid race conditions. +
  • + +
+ + {/* Semaphore Table */} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Operation + + Purpose +
+ wait() + + Decreases semaphore value +
+ signal() + + Increases semaphore value +
+ +
+ +
+ +
+ + {/* Types */} +
+

+ Types of Semaphores +

+ +
+ +
+ +
+ +

+ Binary Semaphore +

+ +
    + +
  • Value can be 0 or 1
  • + +
  • Works similar to mutex
  • + +
  • Allows single process access
  • + +
+ +
+ +
+ +

+ Counting Semaphore +

+ +
    + +
  • Value can be greater than 1
  • + +
  • Controls multiple resources
  • + +
  • Used in resource allocation
  • + +
+ +
+ +
+ +
+ +
+ +
+ + {/* Producer Consumer */} +
+

+ Producer Consumer Problem +

+ +

+ This classic synchronization problem occurs + when producers generate data while consumers use it. +

+ +
    + +
  • Producer adds items to buffer
  • + +
  • Consumer removes items from buffer
  • + +
  • Synchronization prevents overflow and underflow
  • + +
+ + {/* Diagram */} +
+ +
+ +
+ Producer +
+ +
+ → +
+ +
+ Shared Buffer +
+ +
+ → +
+ +
+ Consumer +
+ +
+ +
+ +
+ +
+ + {/* Dining Philosophers */} +
+

+ Dining Philosophers Problem +

+ +

+ This synchronization problem demonstrates + deadlock and resource sharing among processes. +

+ +
    + +
  • Five philosophers sit around a table.
  • + +
  • Each philosopher needs two forks to eat.
  • + +
  • Improper synchronization can cause deadlock.
  • + +
+ +
+ The Dining Philosophers Problem is commonly asked + in Operating System interviews and exams. +
+ +
+ +
+ + {/* Monitor */} +
+

+ Monitor +

+ +

+ A monitor is a high-level synchronization construct + that allows only one process to execute inside it at a time. +

+ +
    + +
  • Provides automatic mutual exclusion
  • + +
  • Simplifies synchronization programming
  • + +
  • Used in modern programming languages
  • + +
+ +
+ +
+ + {/* Advantages */} +
+

+ Advantages of Synchronization +

+ +
    + +
  • Prevents data inconsistency
  • + +
  • Avoids race conditions
  • + +
  • Ensures proper resource sharing
  • + +
  • Improves system reliability
  • + +
  • Supports concurrent execution safely
  • + +
+ +
+ +
+ + {/* Summary */} +
+

+ Summary +

+ +

+ Process Synchronization is essential in multi-tasking + operating systems where multiple processes share resources. + Synchronization mechanisms such as mutexes, semaphores, + and monitors help maintain data consistency and prevent + conflicts during concurrent execution. +

+ +
+ +
+ ); +}; \ No newline at end of file From 9c05b1975c8d486747c6769e81f139be0b8bf664 Mon Sep 17 00:00:00 2001 From: Shivani Date: Sat, 16 May 2026 07:50:00 +0530 Subject: [PATCH 5/7] Added Operating System chapter5 --- app/sem4/os/content/chapter5.tsx | 600 +++++++++++++++++++++++++++++++ 1 file changed, 600 insertions(+) create mode 100644 app/sem4/os/content/chapter5.tsx diff --git a/app/sem4/os/content/chapter5.tsx b/app/sem4/os/content/chapter5.tsx new file mode 100644 index 0000000..6984ff2 --- /dev/null +++ b/app/sem4/os/content/chapter5.tsx @@ -0,0 +1,600 @@ +import React from "react"; + +export const Ch5Content = () => { + return ( +
+ + {/* Introduction */} +

+ + Deadlock + {" "} + is a situation in an Operating System where two or more + processes wait indefinitely for resources held by each other. + Since none of the processes can proceed, the entire system + or a part of it becomes stuck. +

+ +

+ Deadlocks are one of the most important concepts in + Operating Systems because they directly affect system + performance, multitasking, and resource management. +

+ +
+ + {/* Real Life Analogy */} +
+

+ Real Life Example of Deadlock +

+ +

+ Imagine two cars meeting on a narrow bridge. + Both drivers wait for the other to move first. + Since neither moves backward, traffic becomes blocked. +

+ + {/* Diagram */} +
+ +
+ +

+ Deadlock Analogy +

+ +
+ +
+ 🚗 Car A +
+ +
+ ↔ +
+ +
+ 🚗 Car B +
+ +
+ +

+ Both cars wait forever → Deadlock +

+ +
+ +
+ +
+ +
+ + {/* Conditions */} +
+

+ Necessary Conditions for Deadlock +

+ +

+ Deadlock occurs only if all four conditions + are true simultaneously. +

+ +
+ +
+ +

+ 1. Mutual Exclusion +

+ +

+ Only one process can use a resource at a time. +

+ +
+ +
+ +

+ 2. Hold and Wait +

+ +

+ Process holds one resource while waiting for another. +

+ +
+ +
+ +

+ 3. No Preemption +

+ +

+ Resources cannot be forcefully removed. +

+ +
+ +
+ +

+ 4. Circular Wait +

+ +

+ Processes form a circular chain waiting for resources. +

+ +
+ +
+ +
+ +
+ + {/* Resource Allocation Graph */} +
+

+ Resource Allocation Graph (RAG) +

+ +

+ A Resource Allocation Graph visually represents + processes and resources in the system. +

+ +
    + +
  • Circle → Process
  • + +
  • Rectangle → Resource
  • + +
  • Arrow from Process to Resource → Request
  • + +
  • Arrow from Resource to Process → Allocation
  • + +
+ + {/* Graph Diagram */} +
+ +
+ +

+ Resource Allocation Graph +

+ +
+ +
+ P1 +
+ +
+ → +
+ +
+ R1 +
+ +
+ → +
+ +
+ P2 +
+ +
+ +
+ +
+ +
+ +
+ + {/* Deadlock Prevention */} +
+

+ Deadlock Prevention +

+ +

+ Deadlock prevention ensures that at least one + of the four necessary conditions never occurs. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Condition + + Prevention Method +
+ Mutual Exclusion + + Make resources sharable where possible +
+ Hold and Wait + + Request all resources at once +
+ No Preemption + + Force release resources if needed +
+ Circular Wait + + Assign resource ordering +
+ +
+ +
+ +
+ + {/* Avoidance */} +
+

+ Deadlock Avoidance +

+ +

+ Deadlock avoidance dynamically checks resource allocation + to ensure the system never enters an unsafe state. +

+ +
    + +
  • Requires advance information about resource needs
  • + +
  • Uses Safe State concept
  • + +
  • Most famous algorithm: Banker’s Algorithm
  • + +
+ + {/* Safe vs Unsafe */} +
+ +
+ +

+ Safe State +

+ +

+ Processes can complete execution safely. +

+ +
+ +
+ +

+ Unsafe State +

+ +

+ System may eventually enter deadlock. +

+ +
+ +
+ +
+ +
+ + {/* Banker's Algorithm */} +
+

+ Banker’s Algorithm +

+ +

+ Banker’s Algorithm is used for deadlock avoidance. + It checks whether resource allocation leaves + the system in a safe state. +

+ +
    + +
  • Developed by Edsger Dijkstra
  • + +
  • Based on maximum resource demand
  • + +
  • Allocates resources only if system remains safe
  • + +
+ + {/* Flow */} +
+ +
+ +
+ Resource Request +
+ +
+ → +
+ +
+ Safety Check +
+ +
+ → +
+ +
+ Allocate / Reject +
+ +
+ +
+ +
+ +
+ + {/* Detection */} +
+

+ Deadlock Detection +

+ +

+ Instead of preventing deadlocks, + some systems allow deadlocks to occur + and later detect them. +

+ +
    + +
  • System periodically checks for cycles
  • + +
  • Used when deadlocks are rare
  • + +
  • Requires additional overhead
  • + +
+ +
+ +
+ + {/* Recovery */} +
+

+ Deadlock Recovery +

+ +

+ Once deadlock is detected, + the system must recover from it. +

+ +
+ +
+ +

+ Process Termination +

+ +
    +
  • Abort all deadlocked processes
  • +
  • Abort one process at a time
  • +
+ +
+ +
+ +

+ Resource Preemption +

+ +
    +
  • Temporarily remove resources
  • +
  • Rollback process state
  • +
+ +
+ +
+ +
+ +
+ + {/* Comparison */} +
+

+ Prevention vs Avoidance +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Prevention + + Avoidance +
+ Blocks one deadlock condition + + Checks safe state dynamically +
+ Simpler approach + + More complex +
+ Lower resource utilization + + Better resource utilization +
+ +
+ +
+ +
+ + {/* Important Points */} +
+

+ Important Exam Points +

+ +
+ +
    + +
  • + All four conditions are necessary for deadlock. +
  • + +
  • + Banker’s Algorithm is the most important avoidance algorithm. +
  • + +
  • + Resource Allocation Graph is frequently asked in exams. +
  • + +
  • + Difference between prevention and avoidance is important. +
  • + +
+ +
+ +
+ +
+ + {/* Summary */} +
+

+ Summary +

+ +

+ Deadlocks occur when processes wait indefinitely + for resources held by each other. + Operating Systems use prevention, avoidance, + detection, and recovery techniques to manage deadlocks. + Proper resource allocation and synchronization + help ensure smooth and efficient system execution. +

+ +
+ +
+ ); +}; \ No newline at end of file From 49e33f1cc1cadfcbac04299802dede28e1f50546 Mon Sep 17 00:00:00 2001 From: Shivani Date: Sat, 16 May 2026 07:53:01 +0530 Subject: [PATCH 6/7] Added Operating System chapter6 --- app/sem4/os/content/chapter6.tsx | 637 +++++++++++++++++++++++++++++++ 1 file changed, 637 insertions(+) create mode 100644 app/sem4/os/content/chapter6.tsx diff --git a/app/sem4/os/content/chapter6.tsx b/app/sem4/os/content/chapter6.tsx new file mode 100644 index 0000000..28cd8e0 --- /dev/null +++ b/app/sem4/os/content/chapter6.tsx @@ -0,0 +1,637 @@ +import React from "react"; + +export const Ch6Content = () => { + return ( +
+ + {/* Introduction */} +

+ + Memory Management + {" "} + is one of the most important functions of an Operating System. + It is responsible for managing primary memory (RAM), + allocating memory to processes, tracking memory usage, + and ensuring efficient utilization of system resources. +

+ +

+ Since multiple programs run simultaneously in modern systems, + memory management helps prevent conflicts between processes + while improving speed, multitasking, and overall performance. +

+ +
+ + {/* Need */} +
+

+ Need for Memory Management +

+ +
    + +
  • + Efficient utilization of main memory +
  • + +
  • + Proper allocation and deallocation of memory +
  • + +
  • + Protection between processes +
  • + +
  • + Support for multitasking +
  • + +
  • + Faster execution of programs +
  • + +
+ +
+ Without memory management, processes may overwrite + each other’s data causing system crashes. +
+ +
+ +
+ + {/* Memory Hierarchy */} +
+

+ Memory Hierarchy +

+ +

+ Computer systems use different types of memory + organized in a hierarchy based on speed, cost, + and storage capacity. +

+ + {/* Diagram */} +
+ +
+ +

+ Memory Hierarchy +

+ +
+ +
+ Registers +
+ +
+ ↓ +
+ +
+ Cache Memory +
+ +
+ ↓ +
+ +
+ Main Memory (RAM) +
+ +
+ ↓ +
+ +
+ Secondary Storage +
+ +
+ +
+ +
+ +
+ +
+ + {/* Contiguous */} +
+

+ Contiguous Memory Allocation +

+ +

+ In contiguous memory allocation, + each process occupies a single continuous block of memory. +

+ +
    + +
  • + Simple and easy to implement +
  • + +
  • + Fast memory access +
  • + +
  • + Can lead to fragmentation problems +
  • + +
+ + {/* Diagram */} +
+ +
+ +
+ Operating System +
+ +
+ Process P1 +
+ +
+ Process P2 +
+ +
+ Free Space +
+ +
+ +
+ +
+ +
+ + {/* Fragmentation */} +
+

+ Fragmentation +

+ +

+ Fragmentation occurs when memory becomes inefficiently used. +

+ +
+ +
+ +

+ Internal Fragmentation +

+ +

+ Wasted memory inside allocated partition. +

+ +
+ +
+ +

+ External Fragmentation +

+ +

+ Free memory exists but not in contiguous form. +

+ +
+ +
+ +
+ +
+ + {/* Paging */} +
+

+ Paging +

+ +

+ Paging is a memory management technique + where processes are divided into fixed-size pages + and memory is divided into frames. +

+ +
    + +
  • + Eliminates external fragmentation +
  • + +
  • + Allows non-contiguous memory allocation +
  • + +
  • + Uses page tables for mapping +
  • + +
+ + {/* Paging Diagram */} +
+ +
+ +

+ Paging Structure +

+ +
+ +
+ +
+ Process Pages +
+ +
+ +
+ Page 0 +
+ +
+ Page 1 +
+ +
+ Page 2 +
+ +
+ +
+ +
+ +
+ Memory Frames +
+ +
+ +
+ Frame 5 +
+ +
+ Frame 2 +
+ +
+ Frame 9 +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + {/* Segmentation */} +
+

+ Segmentation +

+ +

+ Segmentation divides programs into logical units + such as functions, arrays, or modules. +

+ +
    + +
  • + Supports logical program structure +
  • + +
  • + Segment sizes can vary +
  • + +
  • + Easier sharing and protection +
  • + +
+ + {/* Diagram */} +
+ +
+ +
+ Code Segment +
+ +
+ Data Segment +
+ +
+ Stack Segment +
+ +
+ +
+ +
+ +
+ + {/* Virtual Memory */} +
+

+ Virtual Memory +

+ +

+ Virtual memory allows execution of programs + larger than physical memory by using disk storage + as an extension of RAM. +

+ +
    + +
  • + Increases multiprogramming +
  • + +
  • + Improves memory utilization +
  • + +
  • + Uses demand paging technique +
  • + +
+ + {/* Diagram */} +
+ +
+ +
+ RAM +
+ +
+ ↔ +
+ +
+ Disk Storage +
+ +
+ +
+ +
+ +
+ + {/* Page Replacement */} +
+

+ Page Replacement Algorithms +

+ +

+ When memory becomes full, + Operating Systems replace existing pages + to load new pages. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Algorithm + + Description +
+ FIFO + + Replaces oldest page first +
+ LRU + + Replaces least recently used page +
+ Optimal + + Replaces page not needed for longest future time +
+ +
+ +
+ +
+ + {/* Thrashing */} +
+

+ Thrashing +

+ +

+ Thrashing occurs when the system spends more time + swapping pages between RAM and disk + instead of executing processes. +

+ +
    + +
  • + Causes severe performance degradation +
  • + +
  • + Happens when insufficient frames are allocated +
  • + +
  • + High paging activity indicates thrashing +
  • + +
+ +
+ Thrashing reduces CPU utilization significantly + because the CPU waits for memory operations frequently. +
+ +
+ +
+ + {/* Comparison */} +
+

+ Paging vs Segmentation +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Paging + + Segmentation +
+ Fixed size memory blocks + + Variable size logical units +
+ Eliminates external fragmentation + + May suffer external fragmentation +
+ Hardware oriented + + User/program oriented +
+ +
+ +
+ +
+ + {/* Summary */} +
+

+ Summary +

+ +

+ Memory Management is essential for efficient execution + of modern operating systems. + Techniques such as paging, segmentation, + virtual memory, and page replacement + help improve performance, multitasking, + and resource utilization while ensuring + smooth execution of processes. +

+ +
+ +
+ ); +}; \ No newline at end of file From d57a05eb27cb1cbade5184bece483e4a6aebaa6c Mon Sep 17 00:00:00 2001 From: Shivani Date: Sat, 16 May 2026 07:54:15 +0530 Subject: [PATCH 7/7] Added Operating System chapter7 & 8 --- app/sem4/os/[chapter]/page.tsx | 54 +++--- app/sem4/os/components/sidebar.tsx | 8 +- app/sem4/os/content/chapter7.tsx | 215 +++++++++++++++++++++ app/sem4/os/content/chapter8.tsx | 290 +++++++++++++++++++++++++++++ 4 files changed, 536 insertions(+), 31 deletions(-) create mode 100644 app/sem4/os/content/chapter7.tsx create mode 100644 app/sem4/os/content/chapter8.tsx diff --git a/app/sem4/os/[chapter]/page.tsx b/app/sem4/os/[chapter]/page.tsx index 8dddb3f..7bda27d 100644 --- a/app/sem4/os/[chapter]/page.tsx +++ b/app/sem4/os/[chapter]/page.tsx @@ -4,10 +4,10 @@ import { Ch1Content } from "../content/chapter1"; import { Ch2Content } from "../content/chapter2"; import { Ch3Content } from "../content/chapter3"; import { Ch4Content } from "../content/chapter4"; -// import { Ch5Content } from "../content/chapter5"; -// import { Ch6Content } from "../content/chapter6"; -// import { Ch7Content } from "../content/chapter7"; -// import { Ch8Content } from "../content/chapter8"; +import { Ch5Content } from "../content/chapter5"; +import { Ch6Content } from "../content/chapter6"; +import { Ch7Content } from "../content/chapter7"; +import { Ch8Content } from "../content/chapter8"; import { ArrowBigLeft, ArrowBigRight } from "lucide-react"; import { Righteous } from "next/font/google"; @@ -46,29 +46,29 @@ const chapters = [ component: Ch4Content, }, - // { - // id: "ch5", - // title: "Deadlocks", - // component: Ch5Content, - // }, - - // { - // id: "ch6", - // title: "Memory Management", - // component: Ch6Content, - // }, - - // { - // id: "ch7", - // title: "Paging and Segmentation", - // component: Ch7Content, - // }, - - // { - // id: "ch8", - // title: "File Systems and I/O Management", - // component: Ch8Content, - // }, + { + id: "ch5", + title: "Deadlocks", + component: Ch5Content, + }, + + { + id: "ch6", + title: "Memory Management", + component: Ch6Content, + }, + + { + id: "ch7", + title: "Paging and Segmentation", + component: Ch7Content, + }, + + { + id: "ch8", + title: "File Systems and I/O Management", + component: Ch8Content, + }, ]; type ChapterProps = { diff --git a/app/sem4/os/components/sidebar.tsx b/app/sem4/os/components/sidebar.tsx index 7590d5b..9179201 100644 --- a/app/sem4/os/components/sidebar.tsx +++ b/app/sem4/os/components/sidebar.tsx @@ -20,10 +20,10 @@ export default function Sidebar() { { id: "ch2", title: "Process Management" }, { id: "ch3", title: "CPU Scheduling" }, { id: "ch4", title: "Process Synchronization" }, - // { id: "ch5", title: "Deadlocks" }, - // { id: "ch6", title: "Memory Management" }, - // { id: "ch7", title: "Paging and Segmentation" }, - // { id: "ch8", title: "File Systems and I/O Management" }, + { id: "ch5", title: "Deadlocks" }, + { id: "ch6", title: "Memory Management" }, + { id: "ch7", title: "Paging and Segmentation" }, + { id: "ch8", title: "File Systems and I/O Management" }, ]; return ( diff --git a/app/sem4/os/content/chapter7.tsx b/app/sem4/os/content/chapter7.tsx new file mode 100644 index 0000000..6395962 --- /dev/null +++ b/app/sem4/os/content/chapter7.tsx @@ -0,0 +1,215 @@ +import React from "react"; + +export const Ch7Content = () => { + return ( +
+ + {/* Intro */} +

+ Paging and Segmentation are two important + memory management techniques used by Operating Systems to efficiently allocate memory + and support smooth execution of multiple processes. +

+ +

+ Both techniques solve memory management problems in different ways: + Paging focuses on fixed-size blocks, while Segmentation focuses on logical program structure. +

+ +
+ + {/* Paging */} +
+

Paging

+ +

+ Paging divides memory into fixed-size blocks called frames, + and processes into fixed-size blocks called pages. +

+ +
    +
  • Pages are mapped to frames using a page table
  • +
  • Eliminates external fragmentation
  • +
  • Allows non-contiguous memory allocation
  • +
  • Improves memory utilization
  • +
+ + {/* Paging Diagram */} +
+
+ +

+ Paging Structure +

+ +
+ + {/* Pages */} +
+
+ Process Pages +
+ +
+
Page 0
+
Page 1
+
Page 2
+
Page 3
+
+
+ + {/* Frames */} +
+
+ Memory Frames +
+ +
+
Frame 3
+
Frame 1
+
Frame 7
+
Frame 9
+
+
+ +
+ +
+
+
+ +
+ + {/* Segmentation */} +
+

Segmentation

+ +

+ Segmentation divides a program into logical units such as functions, stacks, heap, + data, and code segments. +

+ +
    +
  • Each segment has a different size
  • +
  • Based on logical view of the program
  • +
  • Easy to protect and share segments
  • +
  • More natural for programmer understanding
  • +
+ + {/* Diagram */} +
+
+ +

+ Segmentation Structure +

+ +
+ +
+ Code Segment +
+ +
+ Data Segment +
+ +
+ Stack Segment +
+ +
+ Heap Segment +
+ +
+ +
+
+ +
+ +
+ + {/* Comparison */} +
+

Paging vs Segmentation

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PagingSegmentation
Fixed-size blocksVariable-size segments
No external fragmentationMay suffer external fragmentation
Hardware-based mappingLogical/program-based view
Simple but less flexibleMore flexible and meaningful
+
+ +
+ +
+ + {/* Key Points */} +
+

Key Points

+ +
+ +
    +
  • Paging uses fixed-size memory blocks called pages and frames.
  • +
  • Segmentation uses logical divisions of a program.
  • +
  • Paging removes external fragmentation.
  • +
  • Segmentation improves logical structure and protection.
  • +
  • Modern systems often combine both techniques.
  • +
+ +
+ +
+ +
+ + {/* Summary */} +
+

Summary

+ +

+ Paging and Segmentation are fundamental memory management techniques. + Paging focuses on efficient memory utilization using fixed-size blocks, + while segmentation focuses on logical organization of programs. + Together, they help operating systems achieve efficient, flexible, + and scalable memory management. +

+ +
+ +
+ ); +}; \ No newline at end of file diff --git a/app/sem4/os/content/chapter8.tsx b/app/sem4/os/content/chapter8.tsx new file mode 100644 index 0000000..d27bb4b --- /dev/null +++ b/app/sem4/os/content/chapter8.tsx @@ -0,0 +1,290 @@ +import React from "react"; + +export const Ch8Content = () => { + return ( +
+ + {/* Intro */} +

+ File Systems and I/O Management are core + components of an Operating System that handle how data is stored, organized, + accessed, and transferred between hardware and software. +

+ +

+ File systems manage long-term storage on disks, while I/O management ensures + smooth communication between CPU, memory, and external devices like keyboards, + disks, and printers. +

+ +
+ + {/* File System */} +
+

File System

+ +

+ A file system is a method used by the Operating System to organize and + store data on storage devices such as HDDs and SSDs. +

+ +
    +
  • Organizes data into files and directories
  • +
  • Manages storage space efficiently
  • +
  • Provides naming and access control
  • +
  • Ensures data security and reliability
  • +
+ + {/* File hierarchy diagram */} +
+
+ +

+ File System Structure +

+ +
+ +
+ Root Directory (/) +
+ +
+ +
+ +
+ /home +
+ +
+ /bin +
+ +
+ /etc +
+ +
+ +
+ +
+ Files (data.txt, config.sys, user.doc) +
+ +
+ +
+
+ +
+ +
+ + {/* File Operations */} +
+

File Operations

+ +
    +
  • Create – making a new file
  • +
  • Open – accessing file for use
  • +
  • Read – retrieving data
  • +
  • Write – storing data
  • +
  • Close – releasing file
  • +
  • Delete – removing file
  • +
+ +
+ File operations are controlled by the OS to ensure data integrity and security. +
+ +
+ +
+ + {/* Types of Files */} +
+

Types of Files

+ +
+ +
+

Text Files

+

Store data in human-readable format (e.g., .txt, .doc).

+
+ +
+

Binary Files

+

Store data in machine-readable format (e.g., .exe, .bin).

+
+ +
+

Directory Files

+

Contain metadata and file organization structure.

+
+ +
+

Special Files

+

Represent devices like keyboard, printer, etc.

+
+ +
+ +
+ +
+ + {/* Disk Structure */} +
+

Disk Structure

+ +

+ Storage devices are divided into sectors, tracks, and blocks + to efficiently store and retrieve data. +

+ + {/* Diagram */} +
+
+ +

+ Disk Structure +

+ +
+ +
+ Disk +
+ +
+ +
+ +
+ Tracks +
+ +
+ Sectors +
+ +
+ Blocks +
+ +
+ +
+ +
+
+ +
+ +
+ + {/* I/O Management */} +
+

I/O Management

+ +

+ I/O Management handles communication between CPU and external devices. +

+ +
    +
  • Manages input and output devices
  • +
  • Ensures smooth data transfer
  • +
  • Reduces CPU waiting time
  • +
  • Uses buffering and caching
  • +
+ + {/* Diagram */} +
+
+ +
+ CPU +
+ +
+ +
+ I/O Controller +
+ +
+ +
+ Devices (Keyboard, Printer, Disk) +
+ +
+
+ +
+ +
+ + {/* I/O Techniques */} +
+

I/O Techniques

+ +
+ +
+

Programmed I/O

+

CPU actively waits for I/O operations.

+
+ +
+

Interrupt-driven I/O

+

CPU is interrupted when device is ready.

+
+ +
+

DMA

+

Direct Memory Access transfers data without CPU involvement.

+
+ +
+ +
+ +
+ + {/* Buffering */} +
+

Buffering & Spooling

+ +
    +
  • Buffering stores data temporarily during transfer
  • +
  • Spooling queues data for devices like printers
  • +
  • Improves system efficiency
  • +
+ +
+ Example: Printer jobs are stored in a queue before printing. +
+ +
+ +
+ + {/* Summary */} +
+

Summary

+ +

+ File Systems and I/O Management ensure efficient storage, + retrieval, and transfer of data between hardware and software. + These components play a key role in system performance, + reliability, and user experience in an Operating System. +

+ +
+ +
+ ); +}; \ No newline at end of file