0% found this document useful (0 votes)
17 views17 pages

Int II QP

IOS

Uploaded by

vignesh2906vi
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)
17 views17 pages

Int II QP

IOS

Uploaded by

vignesh2906vi
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/ 17

KGISL INSTITUTE OF TECHNOLOGY,

COIMBATORE -35, TN, INDIA


Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

Roll Number

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CLASS : II IT / II CSE MAX MARKS : 60


SEMESTER : IV DURATION : 1 Hr 45 Mins
COURSE TITLE : Introduction to Operating Systems COURSE CODE : CS3451
COURSE NO : C205 DATE & SESSION : 06.06.2024
ACADEMIC YEAR : 2023-24 EXAM : IA-2

PART – A (10 X 2 = 20 Marks)


BT
ANSWER ALL QUESTIONS CO Marks
Level
Q: What are the various file operation?
A:  Creating: Establishing a new file.
 Reading: Retrieving data from a file.
 Writing: Adding or modifying data in a file.
1. .  Appending: Adding data to the end of a file. CO4 K1 2
 Deleting: Removing a file from the system.
 Renaming: Changing the name of a file.
 Opening: Making a file available for reading or writing.
 Closing: Terminating access to a file..
Q: Define seek time and latency time?
A:  Seek Time: The time it takes for the read/write head of a
hard disk to move to the track where the data is stored.
2.  Latency Time: The delay between the time data is requested CO4 K1 2
and the time the data begins to be transferred. This includes the
rotational latency, which is the time it takes for the desired sector
of the disk to rotate under the read/write head.
Q: State any three disadvantages of placing functionality in a device
controller, rather than in the kernel?
A:  Complexity: Device controllers with more functionality are
more complex to design and debug.
3.  Cost: Enhanced device controllers are more expensive due to CO4 K1 2
the added functionality.
 Limited Flexibility: Placing functionality in hardware limits
the ability to update or modify it without changing the physical
device.
Q: How free-space is managed using bit vector implementation?
A: Free-space management using bit vectors involves:
 Each bit in the bit vector represents a block on the disk.
 A bit value of 0 indicates the block is free, while a bit
4. value of 1 indicates the block is occupied. CO4 K3 2
 The operating system uses the bit vector to find free
blocks for allocating space to files efficiently.
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

Q: What are the components of kernel mode?


A: Kernel mode includes components such as:
 Process Management: Manages processes and threads.
 Memory Management: Controls the allocation and
deallocation of memory.
 Device Management: Handles device I/O and
5. CO5 K2 2
communication.
 File System Management: Manages file operations and
storage.
 Network Management: Manages network communication
protocols and interfaces.

Q: Why Virtualization is required?


A: Virtualization is required because it:

 Increases Efficiency: Allows multiple virtual machines to


run on a single physical machine, maximizing resource
utilization.
6.  Enhances Security: Isolates environments, reducing the CO5 K1 2
risk of security breaches.
 Improves Scalability: Easily scales up or down based on
demand.
 Simplifies Management: Centralizes management of
multiple virtual environments.

Q: Enumerate the requirements for Linux system administrator. Brief


any one.

A: A Linux system administrator should have:

7.
 Knowledge of Linux operating systems and distributions. CO5 K1 2
 Proficiency in shell scripting and command-line tools.
 Understanding of networking concepts and protocols.
 Experience with system monitoring and performance
tuning.
 Skills in managing users and permissions.

Q: Enlist the advantages of using kernel modules in Linux?


A: Advantages of Using Kernel Modules in Linux:

 Flexibility: Kernel modules can be loaded and unloaded as


8.
needed without rebooting. CO5 K1 2
 Efficiency: Only necessary modules are loaded,
conserving memory.
 Customization: Modules can be tailored for specific tasks,
enhancing performance.
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

Q: Define Demand paging and write its advantages?


A :Demand Paging: A memory management scheme where pages are
only loaded into memory when they are needed during program
execution.
Advantages:
9. • Reduced Memory Usage: Only the necessary pages are loaded, CO3 K1 2
conserving memory.
• Faster Program Start: Programs can start without loading all
pages initially.
Efficient Memory Utilization: Pages not needed are not loaded,
allowing for better memory allocation
Q: Differentiate between Global and Local page replacement
algorithms?
A: • Global Page Replacement: Considers all pages in memory when
10. selecting a page to replace. This can lead to a process impacting the
CO3 K4 2
performance of other processes.
• Local Page Replacement: Only considers pages belonging to the
process that caused the page fault. This ensures that the performance
impact is confined to the process in question.

PART – B (2 X 16= 32 Marks)


CO BT Marks
ANSWER ALL QUESTIONS
Level
11. (a) Q: Compare and contrast the different disk CO4 K4 16

scheduling algorithms with examples?


A: Disk Scheduling Algorithms
1. First-Come, First-Served (FCFS)

 Description: Services requests in the order they


arrive.
 Pros: Simple and fair.
 Cons: Can result in long wait times and high seek
times (poor performance) due to lack of
optimization.
 Example: If the disk head is currently at track 50
and the requests come in the order 95, 180, 34,
119, 11, 123, the total head movement will be the
sum of the distances between consecutive tracks
in the request sequence.

2. Shortest Seek Time First (SSTF)

 Description: Selects the request closest to the


current head position.
 Pros: Reduces total seek time compared to FCFS.
 Cons: Can cause starvation for requests far from
the current head position.
 Example: With the same requests as above and
the head starting at track 50, the algorithm would
first move to 34 (closest), then to 11, then to 95,
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

etc.

3. Elevator (SCAN)

 Description: Moves the head in one direction,


servicing all requests until it reaches the end,
then reverses direction.
 Pros: More efficient than FCFS, avoids starvation.
 Cons: Longer wait times for requests just missed
as the head reverses direction.
 Example: If the head is at track 50 and moves
towards higher numbers, it would service 95,
119, 123, 180 first, then reverse and service 34, 11
on the way back.

4. Circular SCAN (C-SCAN)

 Description: Like SCAN, but after reaching the


end, the head returns to the beginning and starts
again.
 Pros: Provides more uniform wait time than
SCAN.
 Cons: Can be less efficient in terms of total seek
time.
 Example: With the head at track 50 moving
towards higher numbers, it services 95, 119, 123,
180, then jumps back to the beginning and
services 11, 34.

5. LOOK and C-LOOK

 Description: Variants of SCAN and C-SCAN that


only go as far as the furthest request in each
direction before reversing or jumping back.
 Pros: Reduces unnecessary head movement.
 Cons: Similar trade-offs as SCAN and C-SCAN.
 Example: If the head is at track 50 and the
requests are up to 180, LOOK will go to 180 and
back without going to the end of the disk.

(OR)
(b) Q: Consider the following page reference strings: CO4 K4 16
1,2,3,4,5,3,4,1,6,7,8,7,9,7,8,9,5,4,4,5,3 How many page faults
would occur for the following replacement algorithms,
assuming four frames? Remembering all frames are initially
empty.
(a) LRU replacement
(b) FIFO replacement
(c) Optimal replacement?
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

A: Page Replacement Algorithms

Let's consider the given page reference string and


calculate the page faults for each replacement algorithm
assuming four frames.

Page Reference String: 1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 9,


7, 8, 9, 5, 4, 4, 5, 3

(a) LRU Replacement

 Description: Replaces the least recently used


page.
 Steps:
1. Initially empty frames: [-, -, -, -]
2. Insert 1: [1, -, -, -]
3. Insert 2: [1, 2, -, -]
4. Insert 3: [1, 2, 3, -]
5. Insert 4: [1, 2, 3, 4]
6. Insert 5 (replace 1): [5, 2, 3, 4]
7. 3 is already there, no replacement.
8. 4 is already there, no replacement.
9. Insert 1 (replace 2): [5, 1, 3, 4]
10. Insert 6 (replace 3): [5, 1, 6, 4]
11. Insert 7 (replace 4): [5, 1, 6, 7]
12. Insert 8 (replace 5): [8, 1, 6, 7]
13. 7 is already there, no replacement.
14. Insert 9 (replace 1): [8, 9, 6, 7]
15. 7 is already there, no replacement.
16. 8 is already there, no replacement.
17. 9 is already there, no replacement.
18. Insert 5 (replace 6): [8, 9, 5, 7]
19. Insert 4 (replace 7): [8, 9, 5, 4]
20. 4 is already there, no replacement.
21. 5 is already there, no replacement.
22. Insert 3 (replace 8): [3, 9, 5, 4]

 Page Faults: 14

(b) FIFO Replacement

 Description: Replaces the oldest page.


 Steps:
1. Initially empty frames: [-, -, -, -]
2. Insert 1: [1, -, -, -]
3. Insert 2: [1, 2, -, -]
4. Insert 3: [1, 2, 3, -]
5. Insert 4: [1, 2, 3, 4]
6. Insert 5 (replace 1): [5, 2, 3, 4]
7. 3 is already there, no replacement.
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

8. 4 is already there, no replacement.


9. Insert 1 (replace 2): [5, 1, 3, 4]
10. Insert 6 (replace 3): [5, 1, 6, 4]
11. Insert 7 (replace 4): [5, 1, 6, 7]
12. Insert 8 (replace 5): [8, 1, 6, 7]
13. 7 is already there, no replacement.
14. Insert 9 (replace 1): [8, 9, 6, 7]
15. 7 is already there, no replacement.
16. 8 is already there, no replacement.
17. 9 is already there, no replacement.
18. Insert 5 (replace 6): [8, 9, 5, 7]
19. Insert 4 (replace 7): [8, 9, 5, 4]
20. 4 is already there, no replacement.
21. 5 is already there, no replacement.
22. Insert 3 (replace 8): [3, 9, 5, 4]

 Page Faults: 14

(c) Optimal Replacement

 Description: Replaces the page that will not be


used for the longest period of time in the future.
 Steps:
1. Initially empty frames: [-, -, -, -]
2. Insert 1: [1, -, -, -]
3. Insert 2: [1, 2, -, -]
4. Insert 3: [1, 2, 3, -]
5. Insert 4: [1, 2, 3, 4]
6. Insert 5 (replace 1): [5, 2, 3, 4]
7. 3 is already there, no replacement.
8. 4 is already there, no replacement.
9. Insert 1 (replace 2): [5, 1, 3, 4]
10. Insert 6 (replace 3): [5, 1, 6, 4]
11. Insert 7 (replace 1): [5, 7, 6, 4]
12. Insert 8 (replace 4): [5, 7, 6, 8]
13. 7 is already there, no replacement.
14. Insert 9 (replace 5): [9, 7, 6, 8]
15. 7 is already there, no replacement.
16. 8 is already there, no replacement.
17. 9 is already there, no replacement.
18. Insert 5 (replace 6): [9, 7, 5, 8]
19. Insert 4 (replace 8): [9, 7, 5, 4]
20. 4 is already there, no replacement.
21. 5 is already there, no replacement.
22. Insert 3 (replace 9): [3, 7, 5, 4]

 Page Faults: 13

In summary:
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

 LRU Page Faults: 14


 **FIFO Page Fault

12. (a) Q: Explain the concepts of domain name system and CO5 K2 16
multifunction server?
A: Domain Name System (DNS)
Overview

The Domain Name System (DNS) is a hierarchical and


decentralized naming system used to translate human-
readable domain names (like www.example.com) into
machine-readable IP addresses (like 192.168.1.1). It
functions much like a phone book for the Internet,
allowing users to access websites using easy-to-
remember names instead of numeric IP addresses.

Key Components

1. Domain Names: Structured hierarchically,


typically separated by dots (e.g.,
www.example.com).
o Top-Level Domains (TLDs): The last segment
of the domain name, such as .com, .org, .net.
o Second-Level Domains: Directly below the
TLD, such as example in example.com.
o Subdomains: Optional parts added before the
second-level domain, such as www in
www.example.com.

2. DNS Servers: Responsible for resolving domain


names into IP addresses.
o Root DNS Servers: The highest level in the
DNS hierarchy, directing queries to
appropriate TLD servers.
o TLD DNS Servers: Manage top-level domains
and direct queries to authoritative DNS
servers.
o Authoritative DNS Servers: Contain the actual
DNS records for specific domains and provide
the final IP address.

3. DNS Records: Stored by authoritative DNS


servers, they map domain names to IP addresses
and other information.
o A Record: Maps a domain name to an IPv4
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

address.
o AAAA Record: Maps a domain name to an
IPv6 address.
o CNAME Record: Maps a domain name to
another domain name (alias).
o MX Record: Specifies mail servers for a
domain.
o TXT Record: Stores text information, often for
verification purposes.

How DNS Works

1. Query Initiation: A user enters a domain name into a


web browser.
2. Recursive Resolver: The browser sends a query to a
recursive DNS resolver, typically provided by the
user's ISP.
3. Root Server: The resolver queries a root DNS server,
which responds with the address of a TLD server.
4. TLD Server: The resolver queries the TLD server,
which responds with the address of the authoritative
DNS server for the domain.
5. Authoritative Server: The resolver queries the
authoritative DNS server, which responds with the IP
address for the domain.
6. Response to Browser: The resolver sends the IP
address back to the browser, which can then access
the website.

Multifunction Server
Overview

A multifunction server is a server designed to handle


multiple services and functions simultaneously. Instead
of dedicating a single server to a single task, a
multifunction server can perform various roles,
optimizing resource utilization and reducing hardware
costs.

Common Functions

1. Web Server: Hosts websites and serves web pages to


users. Examples: Apache, Nginx.
2. Email Server: Manages sending, receiving, and storing
emails. Examples: Microsoft Exchange, Postfix.
3. File Server: Provides centralized storage for files,
allowing users to store, share, and access files over a
network. Examples: Samba, NFS.
4. Database Server: Hosts databases and provides
database services to applications. Examples: MySQL,
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

PostgreSQL.
5. DNS Server: Resolves domain names to IP addresses,
as explained above. Examples: BIND, Microsoft DNS.
6. Application Server: Hosts applications and provides
services to end-users or other servers. Examples:
Tomcat, WebLogic.
7. Print Server: Manages print jobs and provides printer
services to clients over a network.

Benefits

 Cost Efficiency: Reduces the need for multiple


dedicated servers, saving on hardware and
maintenance costs.
 Resource Optimization: Better utilization of server
resources, avoiding underutilization of dedicated
servers.
 Simplified Management: Easier to manage a single
server with multiple roles than several single-function
servers.
 Scalability: Can be scaled by adding more resources
(CPU, memory, storage) as needed.

Challenges

 Performance: High demand on a multifunction server


can lead to performance bottlenecks.
 Security: Running multiple services on one server can
increase security risks if not properly managed.
 Complexity: Configuration and management can be
more complex compared to single-function servers.

Example Setup

Consider a small business using a multifunction server to


handle several tasks:

1. Web Server: Hosts the company website.


2. Email Server: Manages company emails.
3. File Server: Provides shared file storage for
employees.
4. DNS Server: Resolves internal domain names.
5. Database Server: Hosts the company's internal
database for inventory management.

This multifunction server optimizes hardware usage,


reduces costs, and simplifies administration.
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

(OR)
(b) CO5 K2 16
Q: Write short notes on Linux kernel and virtualization with
neat sketch?

Linux Kernel
Overview

The Linux kernel is the core component of the Linux


operating system. It acts as an intermediary between
hardware and software, managing system resources and
enabling communication between different parts of a
computer system.

Key Functions

1. Process Management: Handles creation, scheduling,


and termination of processes. It ensures efficient
execution of processes and manages CPU time.
2. Memory Management: Manages system memory,
including allocation and deallocation of memory to
processes, virtual memory, and swap space.
3. Device Management: Provides an abstraction layer
for hardware devices, allowing software to interact
with hardware using device drivers.
4. File System Management: Manages data storage,
including reading from and writing to different file
systems.
5. Networking: Provides support for various networking
protocols, enabling communication over networks.

Architecture

The Linux kernel architecture can be visualized in a


layered manner:

1. User Space: Where user applications and libraries


run.
2. System Call Interface: Acts as a bridge between user
space and kernel space.
3. Kernel Space: Where core kernel components
operate, including subsystems for process
management, memory management, file systems,
and device drivers.

Diagram
sql
Copy code
+----------------------+
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

| User Space |
+----------------------+
| System Call Interface|
+----------------------+
| Process Manager |
| Memory Manager |
| File Systems |
| Device Drivers |
+----------------------+
| Hardware Abstraction|
+----------------------+
| Hardware |
+----------------------+
Virtualization
Overview

Virtualization is a technology that allows the creation of


multiple simulated environments or dedicated resources
from a single physical hardware system. It enables the
running of multiple operating systems or instances on a
single physical machine.

Types of Virtualization

1. Hardware Virtualization: Uses a hypervisor to


create and manage virtual machines (VMs).
Examples include VMware, Hyper-V, and KVM.
o Hypervisor Type 1 (Bare Metal): Runs directly
on the hardware. Examples: VMware ESXi,
Microsoft Hyper-V.
o Hypervisor Type 2 (Hosted): Runs on a host
operating system. Examples: VMware
Workstation, Oracle VirtualBox.

2. OS-Level Virtualization: Virtualizes at the


operating system level, allowing multiple isolated
user-space instances. Examples: Docker, LXC.
3. Application Virtualization: Abstracts applications
from the underlying OS. Examples: VMware
ThinApp, Citrix XenApp.

Benefits

 Resource Utilization: Increases hardware utilization


by running multiple VMs on a single physical server.
 Isolation: Provides isolation between different VMs,
enhancing security and stability.
 Scalability: Allows easy scaling of resources by adding
more VMs as needed.
 Flexibility: Enables running different operating
systems and applications on the same hardware.
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

Diagram
lua
Copy code
+------------------------------+
| Virtual Machines |
| (Multiple Instances) |
| +------+ +------+ +------+ |
| | VM | | VM | | VM | |
| +------+ +------+ +------+ |
+------------------------------+
| Hypervisor |
+------------------------------+
| Physical Hardware |
+------------------------------+

In summary, the Linux kernel is the core part of the


Linux operating system, managing system resources and
hardware-software interactions. Virtualization, on the
other hand, is a technology that allows the creation of
multiple virtual environments on a single physical
hardware system, improving resource utilization,
isolation, and flexibility.
PART – C (1X 8 = 8 Marks)
CO BT Marks
ANSWER ALL QUESTIONS
Level
13. (a) CO3 K3 8
On a disk with 1000 cylinders, numbers 0 to 999, compute the
number of tracks, the disk arm must move to satisfy the
entire request in the disk queue. Assume the last request
service was at track 345 and the head is moving towards track
0. The queue FIFO order contains request for the following
track: 123, 874, 692, 475, 105 and 376. Find the seek length
for the following scheduling algorithms.

(a) SSTF

(b) CLOOK

(c) CSCAN.

A: Given Conditions

 Disk with 1000 cylinders (tracks numbered 0 to 999).


 Last request serviced at track 345, and the head is
moving towards track 0.
 Queue of disk requests: 123, 874, 692, 475, 105, 376.
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

(a) SSTF (Shortest Seek Time First)

Steps:

1. Initially, head is at track 345.


2. Compute the distance from track 345 to each
request.
3. Choose the request with the shortest seek time from
the current head position.
4. Repeat until all requests are serviced.

Seek Length Calculation:

 Starting at track 345.


 SSTF order: 376, 475, 692, 874, 105, 123.

Seek Length:

 From 345 to 376: ∣376−345∣=31|376 - 345| =


31∣376−345∣=31
 From 376 to 475: ∣475−376∣=99|475 - 376| =
99∣475−376∣=99
 From 475 to 692: ∣692−475∣=217|692 - 475| =
217∣692−475∣=217
 From 692 to 874: ∣874−692∣=182|874 - 692| =
182∣874−692∣=182
 From 874 to 105: ∣105−874∣=769|105 - 874| =
769∣105−874∣=769
 From 105 to 123: ∣123−105∣=18|123 - 105| =
18∣123−105∣=18

Total Seek Length = 31+99+217+182+769+18=131631


+ 99 + 217 + 182 + 769 + 18 =
131631+99+217+182+769+18=1316

(b) CLOOK (Circular LOOK)

Steps:

1. Arrange the requests in ascending order.


2. Move the head from the current position towards
higher numbered tracks.
3. After reaching the highest requested track, jump to
the lowest requested track and continue servicing in
the same direction.

Seek Length Calculation:

 Starting at track 345.


KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

 Sorted order: 105, 123, 376, 475, 692, 874.

Seek Length:

 From 345 to 475: ∣475−345∣=130|475 - 345| =


130∣475−345∣=130 (direct move to the next request)
 From 475 to 692: ∣692−475∣=217|692 - 475| =
217∣692−475∣=217
 From 692 to 874: ∣874−692∣=182|874 - 692| =
182∣874−692∣=182
 From 874 to 999: ∣999−874∣=125|999 - 874| =
125∣999−874∣=125 (wrap around to track 0)
 From 0 to 105: ∣105−0∣=105|105 - 0| =
105∣105−0∣=105 (continue in the same direction)
 From 105 to 123: ∣123−105∣=18|123 - 105| =
18∣123−105∣=18

Total Seek Length =


130+217+182+125+105+18=777130 + 217 + 182 + 125
+ 105 + 18 = 777130+217+182+125+105+18=777

(c) CSCAN (Circular SCAN)

Steps:

1. Arrange the requests in ascending order.


2. Move the head from the current position towards
higher numbered tracks.
3. After reaching the highest requested track, jump to
the lowest requested track and continue servicing
from the lowest to the current head position.

Seek Length Calculation:

 Starting at track 345.


 Sorted order: 105, 123, 376, 475, 692, 874.

Seek Length:

 From 345 to 475: ∣475−345∣=130|475 - 345| =


130∣475−345∣=130 (direct move to the next request)
 From 475 to 692: ∣692−475∣=217|692 - 475| =
217∣692−475∣=217
 From 692 to 874: ∣874−692∣=182|874 - 692| =
182∣874−692∣=182
 From 874 to 999: ∣999−874∣=125|999 - 874| =
125∣999−874∣=125 (wrap around to track 0)
 From 0 to 105: ∣105−0∣=105|105 - 0| =
105∣105−0∣=105 (continue in the same direction)
 From 105 to 123: ∣123−105∣=18|123 - 105| =
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

18∣123−105∣=18

Total Seek Length =


130+217+182+125+105+18=777130 + 217 + 182 + 125
+ 105 + 18 = 777130+217+182+125+105+18=777

Summary of Seek Lengths:

 SSTF: 1316 tracks


 CLOOK: 777 tracks
 CSCAN: 777 tracks

These calculations demonstrate how each disk scheduling


algorithm affects the total seek length based on the initial
head position and the sequence of requests in the disk
queue
(OR)
(b) Q: Consider a file system where a file can be deleted and CO3 K3 8
the disk space Reclaimed while links to that file still
exist. What (b) problems may occur if a new file is
created in the same storage area or with the same
absolute path name? How can these problem? How can
these problems be avoided?

A: When a file system allows a file to be deleted and its


disk space to be reclaimed while links to that file still
exist, several problems can arise if a new file is created in
the same storage area or with the same absolute path
name. Here are the potential issues and ways to avoid
them:

Problems

1. Dangling Links
o Description: If the file is deleted but there are
still links (e.g., symbolic links or hard links)
pointing to it, these links become dangling.
This means they point to a location on the
disk that no longer holds the original file's
data.
o Impact: Accessing these links will result in
errors, as the data they point to no longer
exists or has been overwritten by a new file.
This can lead to confusion and data
inconsistency.

2. Data Corruption
o Description: If a new file is created in the
same storage area as the deleted file, the
data blocks previously occupied by the old
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

file may be reused. If there are still links


pointing to the old file's location, accessing
these links might return data from the new
file, leading to data corruption and
unintended data exposure.
o Impact: Users and applications expecting the
old file's data will receive incorrect data,
which can cause application errors, security
issues, and data integrity problems.

3. Inconsistent File System State


o Description: The file system's metadata, such
as inode information and directory entries,
may become inconsistent if links point to
non-existent files or if multiple files are
thought to occupy the same space.
o Impact: This can lead to file system errors,
making it difficult to manage and maintain
the file system. It can also cause issues with
file system checks and repairs.

Solutions

1. Reference Counting
o Description: Implement a reference counting
mechanism to keep track of the number of
links to a file. The file's disk space is only
reclaimed when the reference count drops to
zero.
o Implementation: Each file has a counter that
increments when a new link is created and
decrements when a link is deleted. The file is
only physically deleted when the counter
reaches zero.
o Benefit: Ensures that disk space is not
reclaimed as long as there are existing links to
the file, preventing dangling links and data
corruption.

2. Deferred Deletion
o Description: Implement deferred deletion,
where the file's data blocks are not
immediately reclaimed upon deletion but are
instead marked for future reuse.
o Implementation: When a file is deleted, its
data blocks are marked as "pending deletion"
and are only reclaimed after a certain period
or after ensuring no links exist.
o Benefit: Allows time for any remaining links
to be updated or deleted, reducing the risk of
KGISL INSTITUTE OF TECHNOLOGY,
COIMBATORE -35, TN, INDIA
Doc. Ref. KITE/EMS/INT.EX/02/IAQP
EXAMINATIONS - FORMS
INTERNAL EXAMINATION QP FORMAT
ACADEMIC YEAR: 2023 - 2024 Department EXAM CELL

dangling links and data corruption.

3. Unique File Identifiers (Inodes)


o Description: Use unique identifiers for files
(inodes) that do not change even if the file is
deleted and a new file is created with the
same name.
o Implementation: Each file is associated with
an inode that remains unique. When a file is
deleted, its inode is also marked as deleted,
and a new file creation generates a new
inode.
o Benefit: Ensures that links to a deleted file do
not mistakenly point to a newly created file
with the same name, preventing data
corruption.

4. Symbolic Links Management


o Description: Use symbolic links rather than
hard links, as symbolic links explicitly store
the pathname and do not depend on inodes
directly.
o Implementation: When a file is deleted, any
symbolic links pointing to it will naturally
point to a non-existent path, which can be
handled gracefully by applications.
o Benefit: Prevents data corruption since
symbolic links will not inadvertently point to
new files created at the same storage
location.

Conclusion

To avoid the problems associated with deleting files


while links still exist, file systems should use techniques
like reference counting, deferred deletion, unique file
identifiers, and careful management of symbolic links.
These methods help ensure that disk space is managed
efficiently while maintaining data integrity and avoiding
issues with dangling links and data corruption.

Prepared By Approved by

Faculty HOD

You might also like