0% found this document useful (0 votes)
19 views22 pages

MSBTE OS Exam Prep Guide

The document provides a comprehensive overview of operating systems, covering types, components, and various concepts such as multiprogramming, inter-process communication, and memory management. It details system calls, scheduling algorithms, and the differences between command-line and GUI-based operating systems. Additionally, it discusses deadlock conditions, real-time operating systems, and fragmentation, along with practical examples and diagrams to illustrate key points.

Uploaded by

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

MSBTE OS Exam Prep Guide

The document provides a comprehensive overview of operating systems, covering types, components, and various concepts such as multiprogramming, inter-process communication, and memory management. It details system calls, scheduling algorithms, and the differences between command-line and GUI-based operating systems. Additionally, it discusses deadlock conditions, real-time operating systems, and fragmentation, along with practical examples and diagrams to illustrate key points.

Uploaded by

Mayur Gole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Q2

MSBTE 4-Mark Questions and Answer

1. Enlist types of operating systems. Explain Multiprogramming OS in detail.

Types of Operating Systems:

1. Batch Operating System

2. Time-Sharing Operating System

3. Distributed Operating System

4. Network Operating System

5. Multiprogramming Operating System

6. Real-Time Operating System

Multiprogramming OS:

 A multiprogramming operating system allows multiple programs to reside in memory


simultaneously and be executed concurrently.

 The CPU switches between programs to maximize utilization, reducing idle time.

 Advantages: Efficient CPU utilization, reduced waiting time.

 Disadvantages: Complex memory management, potential for resource contention.

2. List components of OS. Explain the following in detail:

Components of OS:

1. Process Management

2. Memory Management

3. File Management

4. I/O Management

5. Security and Protection

6. Networking

i) Process Management:

 Handles the execution of processes, their scheduling, and synchronization.

 It allocates resources like CPU time and memory.

 Key functions include process creation, termination, and inter-process communication.

ii) Memory Management:

 Manages memory allocation and deallocation for processes.


 It ensures optimal utilization of primary memory and avoids fragmentation.

iii) File Management:

 Handles the creation, deletion, and access of files.

 It organizes data in storage, manages directories, and controls access permissions.

3. With a neat diagram, explain the inter-process communication (IPC) model.

IPC allows processes to communicate and synchronize their actions.

Models of IPC:

1. Message Passing: Processes exchange information in the form of messages via system calls
like 'send' and 'receive'.

2. Shared Memory: A shared memory space is created where processes can read or write data
directly.

4. Describe I/O burst and CPU burst cycle with a neat diagram.

I/O Burst: A period when a process is waiting for I/O operations (e.g., reading from disk).
CPU Burst: A period when the CPU executes instructions of the process.

 Processes alternate between I/O and CPU bursts.

5. Describe the working of a time-sharing system with a neat diagram.

A time-sharing system allows multiple users to share system resources simultaneously by quickly
switching between tasks.

 The CPU time is divided into small time slices and allocated to each process in a round-robin
fashion.

 Advantages: Increased user interaction and resource sharing.

6. List and describe any four services of the operating system.

1. Process Management: Manages the execution of processes.

2. Memory Management: Allocates and tracks memory usage.

3. File System Management: Organizes and secures data storage.

4. I/O Management: Coordinates device communication and data transfers.

7. Differentiate between Shared Memory System and Message Passing System of IPC.
Aspect Shared Memory Message Passing

Communication Type Direct memory access. Exchange of messages.

Speed Faster. Slower.

Complexity More complex (needs synchronization). Simpler (built-in synchronization).

Synchronization Explicit (e.g., mutexes, semaphores). Implicit (send/receive operations).

Suitability Tightly coupled systems. Loosely coupled systems.

Scalability Limited to the same machine. Works in distributed systems.

8. Explain different types of system calls.

1. Process Control (e.g., fork, exec): To create, terminate, and execute processes.

2. File Management (e.g., open, read): To handle file operations.

3. Device Management (e.g., ioctl, read): To control device access.

4. Communication (e.g., send, receive): For IPC.

5. Information Maintenance (e.g., getpid): To retrieve system data.

9. Draw and explain the process control block (PCB) in detail.

Process Control Block (PCB): A data structure that contains information about a process.

Fields in PCB:

1. Process ID (PID)

2. Process State

3. CPU Registers

4. Memory Management Information

5. Open Files

10. Define fragmentation. Explain internal and external fragmentation.

Fragmentation: Wasted memory space due to inefficient allocation.

1. Internal Fragmentation: Wasted space within allocated memory blocks due to fixed block
sizes.

2. External Fragmentation: Wasted space in memory due to scattered free blocks.

11. Explain the shared memory method of IPC using a neat labeled diagram.
Shared Memory IPC:

 A shared memory region is established where processes can read and write data directly.

 Processes must synchronize access to avoid conflicts.

Q3

a) Explain ps command with any four options.

The ps command is used in Unix/Linux to display information about active processes.

Four Common Options:

1. ps -e or ps -A: Displays a list of all running processes.

2. ps -f: Displays full information about each process, including the user, PID, and start time.

3. ps -u [username]: Lists processes associated with a specific user.

4. ps aux: Displays all processes with detailed information about their memory and CPU usage.

b) Explain deadlock. What are the necessary conditions for deadlock and also prevention in detail?

Deadlock:
A deadlock occurs when two or more processes are unable to proceed because each is waiting for
the other to release a resource.

Necessary Conditions for Deadlock:

1. Mutual Exclusion: Resources are assigned to one process at a time.

2. Hold and Wait: A process holding a resource is waiting for additional resources.

3. No Preemption: Resources cannot be forcibly taken from processes.

4. Circular Wait: A set of processes is waiting for each other in a circular chain.

Deadlock Prevention:

1. Avoid Hold and Wait: Processes should request all required resources at once.

2. Eliminate Circular Wait: Resources should be requested in a predefined order.

3. Allow Preemption: Resources can be preempted from processes.

4. Prevent Mutual Exclusion: Where possible, resources should be sharable.

c) Explain partitioning and its types in detail.

Partitioning:
Partitioning is a memory management technique where the memory is divided into fixed or variable-
sized partitions for process allocation.

Types of Partitioning:

1. Fixed Partitioning:
o Memory is divided into partitions of fixed sizes.

o Each partition holds one process.

o May lead to internal fragmentation if processes are smaller than the partition.

2. Dynamic Partitioning:

o Memory is divided into partitions of varying sizes, based on process needs.

o More efficient than fixed partitioning but can lead to external fragmentation.

d) Describe sequential and direct access method.

1. Sequential Access:

o Data is accessed in a specific order, one after another.

o Commonly used for tape drives or files read in sequence.

o Example: Magnetic tapes.

2. Direct Access:

o Data can be accessed at any location without having to read the entire sequence.

o Ideal for files that need random access.

o Example: Hard drives, SSDs.

e) Describe linked file allocation method with a suitable example. Also, list its one advantage.

Linked File Allocation:

 Files are stored in non-contiguous blocks, where each block contains a pointer to the next
block.

 This method avoids fragmentation since the blocks can be scattered across memory.

Example:

 File A: [Block 1 → Block 2 → Block 3 → Block 4] (each block points to the next)

Advantage:

 Eliminates fragmentation, as blocks can be scattered across the storage space.

f) Explain different types of schedulers.

1. Long-Term Scheduler (Job Scheduler):

o Decides which processes should be admitted into the system for execution.

o Controls the degree of multiprogramming.


2. Short-Term Scheduler (CPU Scheduler):

o Selects processes from the ready queue to execute on the CPU.

o Operates frequently (in milliseconds).

3. Medium-Term Scheduler:

o Manages processes that are temporarily swapped out from the memory.

o Helps in managing the swapping mechanism.

g) Explain two-level directory structure with a suitable diagram.

Two-Level Directory Structure:

 A two-level directory system has two types of directories: the master directory and the user
directories.

 The master directory contains multiple user directories, and each user directory contains
files specific to that user.

Diagram:

/ (Root Directory)

├── user1/

├── user2/

└── user3/

h) Explain the following commands with their syntax:

1. kill Command:

o Syntax: kill [pid]

o Terminates the process with the specified process ID (PID).

2. sleep Command:

o Syntax: sleep [time]

o Pauses the execution for a specified duration (in seconds).

3. wait Command:

o Syntax: wait [pid]

o Waits for the specified process to complete before proceeding.

4. exit Command:

o Syntax: exit [status]


o Terminates the current shell with an optional exit status.

i) Describe the concept of free space management technique using the bitmap method.

Bitmap Method:

 The bitmap method is used to manage free space in memory or on disk.

 A bitmap is a binary representation where each bit corresponds to a block. A '0' indicates a
free block, and a '1' indicates a used block.

 This method allows efficient allocation and deallocation of free space.

Q4

a) Write Unix commands for the following:

1. Create a folder OSY


Command:

2. mkdir OSY

3. Create a file FIRST in OSY folder


Command:

4. touch OSY/FIRST

5. List/display all files and directories


Command:

6. ls -l

7. Write command to clear the screen


Command:

8. clear

b) What is the purpose of system call? State any two system calls with their functions.

Purpose of a System Call:


A system call provides the interface between a running program and the operating system. It allows
a program to request services such as I/O operations, process control, and file management.

Two System Calls:

1. fork(): Creates a new process by duplicating the calling process.

2. exec(): Replaces the current process image with a new process.

c) Explain Round Robin algorithm with a suitable example.

Round Robin Scheduling Algorithm:


 It assigns a fixed time slice (quantum) to each process in the ready queue. After each time
slice, the process is placed at the end of the ready queue if it is not finished.

 Example:

Process Burst Time Time Quantum Completion Time

P0 10 4 14

P1 29 4 39

P2 3 4 9

P3 7 4 21

P4 12 4 25

The CPU serves each process for 4 units of time. After a process’s quantum is over, it is moved to the
end of the queue.

d) Explain PCB with diagram.

Process Control Block (PCB):

 A PCB is a data structure used by the operating system to store information about a process.

Fields in PCB:

1. Process ID (PID)

2. Process State (Running, Waiting, etc.)

3. Program Counter

4. CPU Registers

5. Memory Management Information

6. I/O Status Information

Diagram:

---------------------------------------------------

| PID | Process State | Program Counter | ... |

---------------------------------------------------

| 1234 | Running | 0x0048 | ... |

---------------------------------------------------

e) Differentiate between command-line based operating system and GUI-based operating system
(any four points).
Feature Command Line OS GUI-based OS

User Interface Text-based interface. Graphical interface with icons.

Ease of Use Requires knowledge of commands. User-friendly with drag-and-drop.

Resource Usage Uses fewer resources. Requires more system resources.

Speed of Operation Faster for experienced users. Slower due to graphical rendering.

f) With a suitable diagram, describe the use of scheduling queues in process scheduling.

Scheduling Queues:

 Ready Queue: Holds all processes that are ready to execute but waiting for CPU time.

 Wait Queue: Holds processes that are waiting for I/O or other resources.

 Job Queue: Contains all processes in the system.

Diagram:

Job Queue

----------------

| |

Ready Queue Wait Queue

------------------

| Process 1 |

| Process 2 |

| Process 3 |

------------------

g) Write steps required for Banker's algorithm to avoid deadlock.

Steps for Banker's Algorithm:

1. Request Handling: When a process requests resources, check if it can be granted without
causing a deadlock.

2. Safety Check: Simulate resource allocation. If the system remains in a safe state (i.e., all
processes can eventually complete), grant the resources.

3. Resource Allocation: If safe, allocate the requested resources. If not, the process must wait.
h) Explain real-time OS. Explain its types.

Real-Time OS (RTOS):

 A real-time operating system is designed to process data and respond to inputs within a
specific time constraint (real-time).

Types of RTOS:

1. Hard Real-Time OS: Requires strict timing and guarantees that tasks will be completed
within a fixed time.

o Example: Flight control systems.

2. Soft Real-Time OS: The system aims to meet timing constraints, but missing deadlines is
acceptable to some extent.

o Example: Multimedia systems.

i) Differentiate between paging and segmentation (any 4 points).

Feature Paging Segmentation

Divides memory into fixed-size Divides memory into variable-sized


Memory Division
pages. segments.

Addressing Uses page numbers and offsets. Uses segment numbers and offsets.

External Fragmentation No external fragmentation. Can cause external fragmentation.

Management More complex, variable-size


Simpler, fixed-size management.
Complexity management.

j) Explain fixed and variable memory management.

1. Fixed Memory Management:

o Memory is divided into fixed-sized partitions.

o Easier to manage, but can lead to internal fragmentation if processes are smaller
than the partition size.

2. Variable Memory Management:

o Memory is allocated based on the process's requirements.

o More efficient but can lead to external fragmentation over time.

k) Explain the working of CPU switch from process to process with a neat labelled diagram.

CPU Switching Between Processes:


1. The CPU executes a process.

2. When the time slice ends, or if the process is blocked, a context switch occurs.

3. The current process's state is saved in its PCB, and the state of the next process is loaded
from its PCB.

4. The CPU starts executing the next process.

Diagram:

---------------------------

| Process 1 |

| (Running) |

---------------------------

Context Switch

---------------------------

| Process 2 |

| (Running) |

---------------------------

l) Solve the given problem using FCFS Scheduling algorithm. Draw a correct Gantt chart and
calculate average waiting time and average turnaround time.

Problem:

Process Arrival Time Burst Time

P0 1 10

P1 2 29

P2 3 3

P3 4 7

P4 12 12

FCFS Scheduling:

Gantt Chart:

| P0 | P1 | P2 | P3 | P4 |

0 10 39 42 49 61
Waiting Time:

 P0 = 0

 P1 = 10 - 2 = 8

 P2 = 39 - 3 = 36

 P3 = 42 - 4 = 38

 P4 = 49 - 12 = 37

Average Waiting Time = (0 + 8 + 36 + 38 + 37) / 5 = 23.8

Turnaround Time:

 P0 = 10

 P1 = 39 - 2 = 37

 P2 = 42 - 3 = 39

 P3 = 49 - 4 = 45

 P4 = 61 - 12 = 49

Average Turnaround Time = (10 + 37 + 39 + 45 + 49) / 5 = 36

m) Which hole is taken for the next segment request for 8 KB in a swapping system for First Fit,
Best Fit, and Worst Fit?

Memory Layout:

Hole Size 4 KB 9 KB 20 KB 16 KB 8 KB 2 KB 6 KB

First Fit:

 Allocates the first hole that fits the request, so the 9 KB hole is selected.

Best Fit:

 Selects the hole that best fits the request, so the 9 KB hole is selected.

Worst Fit:

 Selects the largest hole, so the 20 KB hole is selected.

Q5

Here are the answers to your questions based on the MSBTE 4-mark paper pattern:
a) Calculate average waiting time for the following data using First Come First Served (FCFS) and
Shortest Job First (SJF) algorithms.

Data:

Process Arrival Time Burst Time

P0 0 8

P1 1 4

P2 2 5

P3 3 3

FCFS Scheduling Algorithm:

Steps:

1. FCFS processes the jobs in the order they arrive.

2. Gantt Chart:

| P0 | P1 | P2 | P3 |

0 8 12 17 20

Waiting Time Calculation:

 P0: 0 (as it starts immediately)

 P1: 8 - 1 = 7

 P2: 12 - 2 = 10

 P3: 17 - 3 = 14

Average Waiting Time (FCFS):

(0 + 7 + 10 + 14) / 4 = 7.75

SJF Scheduling Algorithm:

Steps:

1. Sort the processes by burst time.

2. Gantt Chart (after sorting by burst time):

| P1 | P3 | P2 | P0 |

0 4 7 12 20

Waiting Time Calculation:

 P1: 0 (as it starts first)

 P3: 4 - 3 = 1

 P2: 7 - 2 = 5
 P0: 12 - 0 = 12

Average Waiting Time (SJF):

(0 + 1 + 5 + 12) / 4 = 4.5

b) Describe with example, use of the following tools:

1. Device Management:

o Definition: It refers to the OS managing hardware devices such as printers, disk


drives, and keyboards. The OS uses device drivers to handle input/output operations
and ensures proper communication between software and hardware.

o Example: The operating system allocates a printer for a print job and schedules it
accordingly.

2. Performance Monitor:

o Definition: A tool that monitors the overall system performance, tracking metrics
like CPU usage, memory usage, and disk activity.

o Example: The task manager in Windows or System Monitor in Linux can be used to
track system performance and identify resource hogs.

3. Task Scheduler:

o Definition: A task scheduler schedules the execution of processes and tasks at


specified intervals.

o Example: In Windows, Task Scheduler can be set to run backups every night at 2 AM,
while in Unix, cron jobs are scheduled at specific times for automated tasks.

4. Security Policy:

o Definition: A set of rules and procedures that ensure the protection of data and
resources from unauthorized access.

o Example: A company may enforce a security policy that requires employees to


change their passwords every 60 days to maintain system security.

c) Describe the concept of virtual memory with respect to paging. Also, draw a paging hardware
diagram and describe its working with an example.

Virtual Memory:

 Virtual memory allows a computer to compensate for physical memory shortages by


temporarily transferring data from RAM to disk storage.

 Paging is a memory management scheme that eliminates the need for contiguous allocation
of physical memory and thus eliminates the problems of fitting varying sized memory chunks
into the physical memory.
Paging Hardware:

 Virtual memory is divided into pages of fixed size, and physical memory is divided into
frames. The operating system keeps a page table to map the virtual addresses to physical
addresses.

Diagram of Paging Hardware:

| Virtual Address | Page Number | Page Offset |

|-----------------|-------------|-------------|

| 0x1234 | 0x12 | 0x34 |

Working:

1. The Page Table maps virtual pages to physical frames.

2. The virtual address consists of two parts: the page number and the page offset.

3. The page number is used to index into the page table, and the corresponding frame number
is used to access physical memory.

Example:

 Virtual address 0x1234 is divided into a page number (0x12) and page offset (0x34).

 Using the page table, the OS finds that page 0x12 is mapped to frame 0x04 in physical
memory.

 The final physical address will be the frame number combined with the page offset (0x0434).

b) With neat diagram, explain multilevel queue scheduling.

Multilevel Queue Scheduling:

 In multilevel queue scheduling, processes are divided into different queues based on their
priority or other characteristics (e.g., interactive vs. batch).

 Each queue has its own scheduling algorithm (e.g., Round Robin for interactive and FCFS for
batch processes).

Diagram:

---------------------

| High Priority Queue |

---------------------

Round Robin

---------------------
| Medium Priority Queue |

---------------------

FCFS

---------------------

| Low Priority Queue |

---------------------

FCFS

Explanation:

1. The processes are divided into multiple queues.

2. The scheduler selects the queue to execute a process based on priority.

3. Processes in higher-priority queues are executed before processes in lower-priority queues.

c) Differentiate between process and thread (any two points).

Feature Process Thread

A process is a program in
Definition A thread is a smaller unit of a process.
execution.

Resource Each process has its own memory Threads share the memory space of their
Allocation space. parent process.

d) Benefits of Multithreaded Programming:

1. Improved Performance: Threads within the same process can be executed concurrently,
utilizing multi-core processors.

2. Resource Sharing: Threads share the same resources (memory, file descriptors), making
them more lightweight than processes.

e) Find out the total number of page faults using:

i) Least Recently Used (LRU) Page Replacement

Page Reference String: 7 0 1 2 0 3 0 4 2 3 0 1 7 0 1

1. Page 7: Fault, load page 7 → [7]


2. Page 0: Fault, load page 0 → [7, 0]

3. Page 1: Fault, load page 1 → [7, 0, 1]

4. Page 2: Fault, load page 2 → [7, 0, 1, 2]

5. Page 0: No fault, page 0 is already in memory → [7, 0, 1, 2]

6. Page 3: Fault, replace page 7 → [3, 0, 1, 2]

7. Page 0: No fault → [3, 0, 1, 2]

8. Page 4: Fault, replace page 1 → [3, 0, 4, 2]

9. Page 2: No fault → [3, 0, 4, 2]

10. Page 3: No fault → [3, 0, 4, 2]

11. Page 0: No fault → [3, 0, 4, 2]

12. Page 1: Fault, replace page 4 → [3, 0, 1, 2]

13. Page 7: Fault, replace page 2 → [3, 0, 1, 7]

14. Page 0: No fault → [3, 0, 1, 7]

15. Page 1: No fault → [3, 0, 1, 7]

Total Page Faults (LRU): 12

ii) Optimal Page Replacement

The optimal algorithm selects the page that will not be used for the longest period of time.

Page Reference String: 7 0 1 2 0 3 0 4 2 3 0 1 7 0 1

you need more detailed explanations or have any other questions!

Q6

Let's break down and solve the questions one by one according to your MSBTE exam paper pattern:

a) The jobs are scheduled for execution as follows:

Process Arrival Time Burst Time

P1 0 7

P2 1 4

P3 2 10

P4 3 6

P5 4 3

(i) Solve using SJF (Shortest Job First)


SJF scheduling selects the process with the shortest burst time next. Here's how we calculate it:

Steps:

1. At time 0, only P1 is available (burst time 7).

2. At time 1, P2 arrives, and it has a burst time of 4 (which is smaller than P1).

3. At time 2, P3 arrives, but it has a burst time of 10.

4. At time 3, P4 arrives, but its burst time is 6.

5. At time 4, P5 arrives, with a burst time of 3.

Now, schedule the processes based on shortest burst times:

Gantt Chart:

| P1 | P2 | P4 | P5 | P3 |

0 7 11 17 20 30

Waiting Time Calculation:

 P1: 0 (as it starts immediately)

 P2: 7 - 1 = 6

 P4: 11 - 3 = 8

 P5: 17 - 4 = 13

 P3: 20 - 2 = 18

Average Waiting Time (SJF):

(0 + 6 + 8 + 13 + 18) / 5 = 9

(ii) Solve using FCFS (First Come First Served)

In FCFS, the jobs are processed in the order they arrive, without considering burst times.

Gantt Chart:

| P1 | P2 | P3 | P4 | P5 |

0 7 11 21 27 30

Waiting Time Calculation:

 P1: 0

 P2: 7 - 1 = 6

 P3: 11 - 2 = 9

 P4: 21 - 3 = 18

 P5: 27 - 4 = 23
Average Waiting Time (FCFS):

(0 + 6 + 9 + 18 + 23) / 5 = 11.2

b) Enlist different file allocation methods? Explain contiguous allocation method in detail.

File Allocation Methods:

1. Contiguous Allocation

2. Linked Allocation

3. Indexed Allocation

Contiguous Allocation:

 Definition: In contiguous allocation, each file occupies a set of contiguous blocks on the disk.
The starting block and the length of the file are stored in the directory entry.

Advantages:

1. Simple and fast access due to contiguous memory allocation.

2. Easy to implement.

Disadvantages:

1. External fragmentation occurs, making it difficult to find large contiguous blocks.

2. Difficult to grow the file, as there may not be enough contiguous space.

a) Describe one-to-one multithreading model with a suitable diagram.

One-to-One Multithreading Model:

 In the one-to-one model, each user-level thread maps to a unique kernel-level thread. If
there are N user-level threads, the system will create N kernel threads. This allows true
parallelism on multiple processors.

Diagram:

User-level threads Kernel-level threads

----------------- ------------------------

| T1 | T2 | T3 | --> | K1 | K2 | K3 |

----------------- ------------------------

Advantages of One-to-One Model:

1. Concurrency: The OS can schedule threads on different processors, providing true


parallelism.

2. Blocking of one thread doesn't block others: Since each thread has its own kernel thread,
blocking one thread (e.g., waiting for I/O) doesn’t block other threads.
Disadvantages:

 More system overhead, as each thread requires a kernel thread.

b) Page Replacement Algorithms

Given the page reference string:


Page Reference String: 5, 6, 7, 8, 9, 7, 8, 5, 9, 7, 8, 7, 9, 6, 5, 6
Page Frames: 3

i) Optimal Page Replacement Algorithm:

The optimal page replacement algorithm selects the page that will not be used for the longest time
in the future.

Steps:

1. Page 5: Fault, load page 5 → [5]

2. Page 6: Fault, load page 6 → [5, 6]

3. Page 7: Fault, load page 7 → [5, 6, 7]

4. Page 8: Fault, replace page 5 (next use is the farthest) → [8, 6, 7]

5. Page 9: Fault, replace page 6 → [8, 9, 7]

6. Page 7: No fault → [8, 9, 7]

7. Page 8: No fault → [8, 9, 7]

8. Page 5: Fault, replace page 9 → [8, 5, 7]

9. Page 9: Fault, replace page 7 → [8, 5, 9]

10. Page 7: Fault, replace page 8 → [7, 5, 9]

11. Page 8: Fault, replace page 5 → [7, 8, 9]

12. Page 7: No fault → [7, 8, 9]

13. Page 9: No fault → [7, 8, 9]

14. Page 6: Fault, replace page 9 → [7, 8, 6]

15. Page 5: Fault, replace page 7 → [5, 8, 6]

16. Page 6: No fault → [5, 8, 6]

Total Page Faults (Optimal): 12

ii) FIFO (First In, First Out) Page Replacement:

Steps:

1. Page 5: Fault, load page 5 → [5]

2. Page 6: Fault, load page 6 → [5, 6]


3. Page 7: Fault, load page 7 → [5, 6, 7]

4. Page 8: Fault, replace page 5 → [8, 6, 7]

5. Page 9: Fault, replace page 6 → [8, 9, 7]

6. Page 7: No fault → [8, 9, 7]

7. Page 8: No fault → [8, 9, 7]

8. Page 5: Fault, replace page 7 → [8, 9, 5]

9. Page 9: No fault → [8, 9, 5]

10. Page 7: Fault, replace page 8 → [7, 9, 5]

11. Page 8: Fault, replace page 9 → [7, 8, 5]

12. Page 7: No fault → [7, 8, 5]

13. Page 9: Fault, replace page 5 → [7, 8, 9]

14. Page 6: Fault, replace page 7 → [6, 8, 9]

15. Page 5: Fault, replace page 8 → [6, 5, 9]

16. Page 6: No fault → [6, 5, 9]

Total Page Faults (FIFO): 14

c) Directory Structures

i) Single Level Directory:

 Definition: In a single-level directory, all files are stored in one directory. Every file has a
unique name, but there is no hierarchy.

Diagram:

[File1] [File2] [File3] [File4] [File5]

ii) Two-Level Directory:

 Definition: The two-level directory has a main directory and subdirectories under it. Files are
stored in subdirectories, which can be categorized logically.

Diagram:

Main Directory

Subdir1 Subdir2 Subdir3

[File1] [File6] [File8]

[File2] [File7] [File9]

iii) Tree Structured Directory:


 Definition: A tree structure allows files to be organized hierarchically in multiple

levels of subdirectories.

Diagram:

Root

Subdir1

/ \

File1 Subdir2

File2

d) FCFS, RR, and SJF Calculations for Processes P1, P3, P4

Given the processes:

Process Arrival Time Burst Time

P1 1 4

P3 2 9

P4 3 5

Solve using FCFS, Round Robin (RR), and SJF. I'll continue this explanation in the next part if you'd
like to explore it further!

You might also like