0% found this document useful (0 votes)
6 views19 pages

OS

Uploaded by

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

OS

Uploaded by

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

Module-III

Very short answer type questions


1. A computer system has 6 tape drives, with n processes competing for them.
Each process may need 3 tape drives. The maximum value of n for which the
system is guaranteed to be deadlock free is
a. 2 b. 3 c. 4 d. 1
Solution: To determine the maximum number of processes ( n ) for which
the system is guaranteed to be deadlock-free, we can use the Banker's
algorithm principle and consider the worst-case scenario.
The formula to avoid deadlock is:
 Total Resources>= Number of Processes X (Maximum Resources Needed
by a Process - 1) + 1
 Total tape drives = 6.
 Maximum tape drives needed by a single process = 3.
 Substituting these values into the formula:
6 >= n (3 - 1) + 1
Simplifying further: n <= 2.5
Since (n) must be a whole number (as processes are discrete
entities), the maximum value of (n) is 2.
2. The following C program
main() {
fork();fork() ;
printf ("yes");
}
If we execute this core segment, how many times the string yes will be
printed?
a) Only once b) 2 times c) 4 times d) 8 times
Solution: c) 4 times
3. What do you mean by busy waiting?
4. What is a safe state?
5. What is the difference between synchronization and mutual exclusion?
6. Consider a system consisting of 4 resources of the same type that are shared
by 3 processes, each of which needs at most two resources. Show that the
system is deadlock free.
 Solution: Total Resources>= Number of Processes X (Maximum Resources
Needed by a Process - 1) + 1
 Putting the values from question:

1
 4>=3 X (2-1) + 1 => 4>= 4 condition is satisfied so no dead lock.
7. Define race condition. How can you guard against race condition?
8. A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4
V (signal) operations were completed on this semaphore. What will be the
final value of the semaphore?
 Solution: final value = 10 - 6 + 4 = 8
9. Why do deadlocks occur? How are they detected by the operating system and
resolved?
10. A computer has 6 tape drives among n programs. Each needs two tape
drives. For a system to be deadlock free what is the maximum value of n?
 Solution: Total Resources>= Number of Processes X (Maximum
Resources Needed by a Process - 1) + 1
 Putting the values :
 6>=n X (2-1) + 1 => 6>= n+1 => n<=5 ; the maximum value
of n should be 5 for a dead lock free system.
11. What is the difference between a semaphore wait signal and a condition
variable wait signal?
12. How do condition variables of monitor differ from semaphore?
13. Why race condition occurs in multi processing environment?
14. Each process in a system has a system of code called ___________, in which
the process may be changing common variables, updating a table, writing a
file.
(i) Critical Section (ii) semaphore (iii) race condition (iv)
segment table
15. Whether a single user process can create deadlock to the system (Yes/No)?
Justify.
16. What are the differences between binary and counting semaphores?
17. What are the four general strategies for dealing with deadlocks?
18. What are condition variables in monitors?
19. Mention any two deadlock recovery steps.
20. Differentiate between deadlock and starvation.
21. What do you mean by Critical Section Problem in process synchronization?
22. What is the use of resource allocation graph in Deadlock?
23. What is the use of a wait-for-graph?
24. What is the difference between Deadlock avoidance and Deadlock prevention?
25. What do you mean by race condition?
26. Define a safe state. What is it’s significance in deadlock?

Medium answer type questions

2
1. What problems can be incurred if processes are not synchronized?
2. A counting semaphore was initialized to 7. Then 20 P(wait) and x V(signal)
operations were completed on this semaphore. If the final value of semaphore
is 5, then what will be the value of x?
 Solution: P (Wait) decreases the value of the semaphore & V (Signal)
increases the value of semaphore.
 After 20 number of Ps and X number of Vs the value of the semaphore =
 7 – 20 + x =5 => x=5+20-7 => x= 18; hence 18 V were performed on
the semaphore
3. Differentiate among safe state, unsafe state, and deadlock in a system. With
a suitable example explain how the conditions of deadlock are satisfied.
4. Give an example of a deadlock involving three processes and three resources.
Draw the appropriate resource allocation graph.
5. Consider a system consisting of four resources of the same type that are
shared by three processes, each of which needs at most two resources. Show
that the system is deadlock free.
•Solution: Total Resources>= Number of Processes X (Maximum Resources
Needed by a Process - 1) + 1
•Putting the values from question:
•4>=3 X (2-1) + 1 => 4>= 4 ; condition is satisfied so no dead lock.

6. Explain how deadlock can be prevented by preventing “No Preemption”


condition.
7. Explain how deadlock can be prevented by preventing “circular-wait”
condition.
8. Deadlock prevention is not always possible (Yes/No). Justify
9. What are semaphores? How do semaphores help in concurrent programming?
10. What is mutual exclusion? Give one solution for achieving mutual exclusion.
11. What are the necessary conditions for arising deadlocks? How can you avoid
and recover from deadlock?
12. Define deadlock. State four conditions of deadlock and explain how each
condition can be satisfied?
13. What do you mean by critical section and what are the three requirements to
the solution to critical section?
14. Explain the protocols used to recover from deadlock?
15. State the four necessary conditions for deadlock, with a one sentence
explanation of each.

Long answer type questions

1. For the following data

3
Allocation Max
A B C A B C
P0 1 0 1 4 3 1
P1 1 1 2 2 1 4
P2 1 0 3 1 3 3
P3 2 0 0 5 4 1
The available number of resources A, B, C are (8, 4, 6). Is the system
safe?
Solution: Yes, the system is safe and the safe sequence is P2 → P1 → P0
→ P3

2. For the following data


Allocation Max
A B C A B C
P0 0 1 0 7 5 3
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 4 2 2
P4 0 0 2 5 3 3
The available number of resources A, B, C are (10, 5, 7). Is the
system safe? If so, find the safe sequence.
3. What do you mean by Monitor? How is it different from Semaphore? Explain
monitor solution for either Bounded buffer problem or Reader-writer's
problem or Dinning philosopher's problem.
4. Answer the following questions using Banker’s algorithm by
considering the snapshot of a system given below:

a. What is the content of matrix NEED?


b. Is the system in safe state?
c. If a request from process P5 arrives for (1,2,0,0) can the request be
granted immediately. Show the new system state.

System Snapshot:
Process MAX ALLOCATION AVAILABLE
A B C D A B C D A B C D

P1 6 0 1 2 4 0 0 1 3 2 1 1

P2 1 7 5 0 1 1 0 0

P3 2 3 5 6 1 2 5 4

P4 1 6 5 3 0 6 3 3

P5 1 6 5 6 0 2 1 2

5. Explain semaphore solution to producer-consumer problem.


6. Use Banker’s algorithm to detect if the system is in safe state? Justify your
answer.
Process Allocation Maximum Available

4
A B C D A B C D A B C D
P0 3 0 1 1 4 1 1 1 0 0 0 0
P1 0 1 0 0 0 2 1 2
P2 1 1 1 0 4 2 1 0
P3 1 1 0 1 1 1 0 1
P4 0 0 0 0 2 1 1 0
7. Consider the following snapshot of a system:
Allocation Max Available
A B C D A B C D A B C D
P0 0 0 1 2 0 0 1 2 1 5 2 0
P1 1 0 0 0 1 7 5 0
P2 1 3 5 4 2 3 5 6
P3 0 6 3 2 0 6 5 2
P4 0 0 1 4 0 6 5 6
Answer the following questions using the Banker’s algorithm.
i) Determine the Need matrix.
ii) Check the safeness of the system.
iii) If a request from process P1 arrives for (0,4,2,0) can the request be
granted immediately?
8. A system has four processes and four resources with multiple instances. The
resource utilization of the processes is shown in the following table.
(i) Draw the resource-allocation graph.
(ii) Identify deadlock state(s), if exists.
(iii) How can you make the system deadlock-free if no pre-emption of
resources is allowed?
Holds an instance of Requests an instance of
Process Resource Resource
P1 R2 R1, R4
P2 R1, R2, R4 R3, R4
P3 R3 R4
P4 R4 R2
9. What do you mean by Monitor? How is it different from Semaphore? Explain
monitor solution for either Bounded buffer problem or Reader-writer's
problem or Dinning philosopher's problem.
10. For the following data
Allocation Max
A B C A B C
P0 0 1 0 7 5 3
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 2 2 2
P4 0 0 2 4 3 3
The available number of resources A, B, C are (10, 5, 7). Is the system safe?
If so, find the safe sequence. If the P1 request for resources of (1, 1, 1)
whether the request can be granted or not?
11. Consider the following snapshot of a system:
Allocation Max Available

5
A B C D A B C D A B C D
P0 0 0 1 2 0 0 1 2 1 5 2 0
P1 1 0 0 0 1 7 5 0
P2 1 3 5 4 2 3 5 6
P3 0 6 3 2 0 6 5 2
P4 0 0 1 4 0 6 5 6
Answer the following questions using the Banker’s algorithm.
i) Determine the Need matrix.
ii) Check the safeness of the system.
iii) If a request from process P1 arrives for (0,4,2,0) can the request be
granted immediately?
12. Use Banker’s algorithm to detect if the system is in safe state? Justify your
answer.
Process Allocation Maximum Available
A B C D A B C D A B C D
P0 3 0 1 1 4 1 1 1 0 0 0 0
P1 0 1 0 0 0 2 1 2
P2 1 1 1 0 4 2 1 0
P3 1 1 0 1 1 1 0 1
P4 0 0 0 0 2 1 1 0
13. A system has 4 processes and 5 types of currencies. Their current allocations,
maximum need and available currencies are as follows:
Process Allocation Maximum Need Available
A 1 0 2 1 1 1 1 2 1 2 0 0 P
1 1
B 2 0 1 1 0 2 2 2 1 0
C 1 1 0 1 0 2 1 3 1 0
D 1 1 1 1 0 1 1 2 2 1
Find the smallest value of P for which this is a safe state.
14. Use Banker’s algorithm to detect if the system is in safe state? Justify your
answer.
Process Allocation Maximum Available
A B C D A B C D A B C D
P0 3 0 1 1 4 1 1 1 0 0 0 0
P1 0 1 0 0 0 2 1 2
P2 1 1 1 0 4 2 1 0
P3 1 1 0 1 1 1 0 1
P4 0 0 0 0 2 1 1 0
15. Consider the following snapshot of a system:
Allocation Max Available
A B C D A B C D A B C D
P0 0 0 1 2 0 0 1 2 1 5 2 0
P1 1 0 0 0 1 7 5 0
P2 1 3 5 4 2 3 5 6
P3 0 6 3 2 0 6 5 2
P4 0 0 1 4 0 6 5 6
Answer the following questions using the Banker’s algorithm.
i) Determine the matrix Need.
ii) Check the safeness of the system.

6
iii) If a request from process P1 arrives for (0,4,2,0) can the request be
granted immediately?
16. For the following data
Allocation Max
A B C A B C
P0 0 1 0 7 5 3
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 2 2 2
P4 0 0 2 4 3 3
The available number of resources A, B, C are (10, 5, 7). Is the system safe?
If so, find the safe sequence. If the P1 request for resources of (1, 1, 1)
whether the request can be granted or not?
17. Design a deadlock free monitor based solution for dining philosopher’s
problem.
18. Explain Dining-Philosophers Problem. How semaphore is used for
synchronization?
19. Write a synchronization solution of the Producer-Consumer for bounded buffer
problem using semaphore. (Refer the PPT)
20. Write a synchronization solution for the readers writers problem using
semaphore.

Module-IV
Very short answer type questions
1. Consider a paging system with page table stored in memory. If a memory
reference takes 200ns then how long does a paged memory reference take?

Solution: In a paging system with the page table stored in memory, the
process of accessing memory involves two memory references:

1. First, to access the page table entry.


2. Second, to access the actual data in memory.

If a single memory reference takes 200 ns, then the total time for a paged
memory reference would be: 200ns + 200ns = 400ns

2. Consider a computer system with a 32-bit logical address and a page size of
4K. Calculate the no. of entries that we will have in the page table.

Solution:
Logical Address Space: A 32-bit logical address means the total addressable
space is: 232 Bytes = 4GB

7
Page Size: The page size is 4 KB = 212 bytes
Number of Pages: Logical address space / page size = 232 / 212 = 220
Thus, the total number of entries in the page table is (220 = 1,048,576)
entries.

3. Define hit ratio and miss ratio.


4. What is effective memory access time?

5. If a logical address space has four pages of 516 words each and physical
memory has 16 frames, determine the size of logical address and physical
address.
Solution:
a) Each page has 516 words and there are 4 pages, so the total number of
words in the logical address space= 4 X 516 = 2064
We need 1 logical address for each word so we need 2064 logical
addresses
No. of bits required for logical addressing = 2n = 2064 =>n = log2(2064)
= 11 bits (approx.)
b) Physical memory has 16 frames and each can store 516 words (same as
page size)
So number of physical address required = 16 X 516 = 8256
Number of bits for physical address = log 2 (8256) = 13 bits (approx.)

6. Consider a logical address space of 16 pages of 2048 words each mapped


onto a physical memory of 64 frames. How may bits are in the logical address
and physical address.
Solution: refer question no 5.
7. If a logical address is 345 and relocation register value is 12000, then what
should be the physical address?

Solution: 12000+345 = 12345 is the physical address

8. What is the effective access time of a system with 75% hit ratio, 30 nano
seconds associative lookup time and 100 nano seconds memory access time?
Solution:
To calculate the effective access time (EAT), we use the formula:
EAT= Hit ratio X Cache access time + (1 - Hit ratio) X Memory access time
Given:
Hit ratio = 0.75 or 75%
Cache access time = 30 ns (associative lookup time)
Memory access time = 100 ns
Putting the values:
EAT = (0.75 X 30) + (0.25 X 100) = 47.5

9. What are the advantages of an inverted page table?

8
10. What do you mean by pure demand paging?

Medium answer type questions


1. What do you mean by address binding? Explain different types of address
bindings.
2. Consider six memory partitions of size 200 KB, 400 KB, 600 KB, 500 KB, 300
KB and 250 KB. These partitions need to be allocated to four processes of
sizes 357 KB, 210 KB, 468 KB and 491 KB in that order.
Perform the allocation of processes using-

a. First Fit Algorithm


b. Best Fit Algorithm
c. Worst Fit Algorithm

Solution:

a b

9
c

3. Why paging and segmentation is mapped into one scheme?


4. Consider a logical address space of 128 pages of 1024 words each, mapped
onto a physical memory of 64 frames . How many bits are there in the logical
address space and physical address space ?
Solution: Refer Question no. 5
5. Assuming a 15-bit address space with 8 logical pages. How large are the
pages?
Solution: refer question no 5.
6. Assume a page size of 2K and a 32-bit logical address space. How many
pages are in the system?
Solution: Size f 1 page = 2K = 211 bytes
Since Logical address space 32 bit so it’s size =232 bytes
Number of pages = 232 bytes / 211 bytes = 221 pages = 2,097,152
pages
7. Explain dynamic linking.
8. Why OS is stored in lower end of main memory?
9. Differentiate between static loading and dynamic loading.
10. What is thrashing? What is the cause of thrashing? How do you overcome
thrashing?
11. If hit ratio to a TLB is 80% and it takes 15ns to search the TLB and 150 ns to
access main memory, then what must be the effective memory access time in
ns?
Solution: TLB Access Time = 15 ns
Memory Access Time = 150 ns
TLB Hit Ratio = 80% = 0.8
TLB Miss Ratio = 20% = 0.2 (since Miss Ratio = 1 - Hit Ratio)
EMAT = (0.8 X 15) + (0.2 X (15 + 150 X 2))
= (12) + (0.2 X (15 + 300)) = 75 ns
12. In a virtual memory system compare the advantages of having a large page
size versus having a small page size.

10
13. Consider Logical Address space is 256mb, Physical Address is 25 bits, offset
field contains 13 bits. Find out page size, number of frames and number of
pages.
Solution: Offset field size = 13 bits
Page size = 2offset bits
= 213 = 8192 bytes (or 8 KB)
The Logical Address Space is 256 MB = (256X1024X1024)
bytes.
Number of Pages = Logical Address Space / Page Size
= (256X1024X1024) bytes / 8192 bytes
= 32768 pages (or (215) pages)

14. In case of demand paging, if we take the average page fault service time of
25millisecond and memory access time of 100 nanoseconds and probability of
page fault is 0.8, then what will be the effective access time?
Solution:
Memory Access Time = 100 ns = 100 X 10-9 seconds
Page Fault Service Time = 25 ms = 25 X 10-3 seconds
Probability of Page Fault = 0.8
Probability of No Page Fault = 1 - 0.8 = 0.2
EAT = (0.2 X 100) + (0.8 X (25,000,000 + 100))
= 20 + 20,000,080
= 20,000,100 ns or 20.0001ms
15. Differentiate between paging & segmentation. Why neither paging nor
segmentation can be free from memory wastage independently?
16. Define the following terms:
(i) Page Table.
(ii) Lazy swapper.
(iii) Pure demand paging
17. Discuss the methods for free space management.
18. What is an inverted page table? How does it compare to a two-level page
table?
19. Differentiate dynamic loading and dynamic linking.
20. Suggest a model to improve the performance of a system affected by
thrashing and explain its working principle to prevent it.
21. How the performance of a system is affected by thrashing?
22. Differentiate between paging and segmentation.

Long answer type questions


1. Given memory partitions of 120K, 520K, 320K,324K, 620K(in order). How
would each of the First fit, Best fit and worst fit algorithms place processes of

11
227K, 432K, 127K and 441K (in order). Which algorithm makes efficient use
of memory?
Solution: Refer question no.2 (short answer type)
2. Consider the following segment table:
Segment Base Length
0 240 500
1 2150 28
2 180 60
3 1175 470
4 1482 55
What are the physical addresses for the following logical addresses?
i) 0,280 ii) 1,20 iii) 2,150 iv) 3,320 v) 4,188
Solution:
Physical address = Base + off set

i. 0,280 → 520 (240+280)


ii. 1,20 → 2170 (2150+20)
iii. 2,150 → Out of bounds (150 > 60 i.e. offset > segment length)
iv. 3,320 → 1495 (1175+320)
v. 4,188 → Out of bounds (188 > 55 i.e. offset > segment length)

3. Discuss the procedure involved in paging hardware with TLB with appropriate
diagram. Briefly mention about the hit ratio. How protection can be ensured
in paged memory environment.
4. What is segmentation? Explain how a process is mapped into physical
memory using segmentation with suitable diagram.
5. How many page faults occur in LRU and optimal replacement for the following
reference string for 4 page frames? Assume that all frames are initially
empty 1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2
6. Suppose main memory has 3 frames and page numbers which are going to be
referenced are 1, 1, 3, 2, 2, 2, 4, 9, 9, 6, 3, 2, 2, 7, 6, 6, 3, 3. How many
page faults will occur for the following page replacement algorithm?
(i) LRU replacement (ii) FIFO replacement (iii) Optimal replacement
7. Assuming a page size of 4 Kbytes and that a page table entry takes 4 bytes
how many levels of page tables would be required to map a 64-bit address
space, if the top level page table fits into a single page?
Solution:
Page Size = 4 KB = 212 bytes
Page Table Entry Size = 4 bytes
Logical Address Space = 64-bit = 264 addresses

12
Top-level page table fits in a single page
Since the logical address space is 64-bit, the total number of pages is:
Total Pages = Logical Address Space / Page Size = 264 / 212 = 252 pages
Each page table entry takes 4 bytes so,
Entries per Page Table = Page Size / Page Table Entry Size = 212 / 210 entries
Each page table can thus map 210 pages.
To map 252 pages, we need multiple levels of page tables. Each level reduces
the number of required entries by a factor of 210:
Number of Levels = 52 / 10 = 5.2 i.e. approx. 6 levels

8. Consider a system with single level paging. Assume that the necessary page
table is always in memory.
(i) If a memory reference takes 200 nsec, how long does a paged memory
reference take?
(ii) Now we add an MMU that imposes an overhead of 20 nsec on a hit or a
miss. If we assume that 85% of all memory references hit the MMU TLB, what
is the effective memory access time?

Solution:
MMU Overhead = 20 ns
Memory Access Time = 200 ns
TLB Hit Ratio = 85% (0.85)
LB Miss Ratio = 15% (0.15)
On a hit, only MMU overhead + memory access occurs.
On a miss, MMU overhead occurs + page table lookup (400 ns total).
EAT = Hit Ratio X MMU Overhead + Memory Access Time + (Miss Ratio X
(MMU Overhead + Paged Memory Reference Time))
EAT = (0.85 X (20 + 200)) + (0.15 X (20 + 400))
= (0.85 X 220) + (0.15 X 420)
= 250 ns
Final Answers:
i) Paged Memory Reference Time = 400 ns
ii) Effective Memory Access Time with MMU & TLB = 250 ns
9. A memory management system uses paging with 8KB pages. If the logical
address space of a process is 32 bits, physical memory size is 512MB, and
every page table entry has 4 additional flag bits, what would be the
approximate size of the page table of a process when a one-level page table
is used? Show all calculations.
Solution:
Page Size = 8 KB = 213 bytes
Logical Address Space = 32-bit = 232 addresses

13
Physical Memory Size = 512 MB = 229 bytes
Page Table Entry (PTE) Size:
Physical Frame Number Bits = Determined by physical memory
Additional Flag Bits= 4 bits
Determine Number of Pages in Logical Address Space:
The Total Number Pages = Logical Address Space / Page Size
=232/213 = 219 pages
Let’s Calculate Number of Bits Required for Physical Frame Number:
Since physical memory size is 512 MB and each frame is of 8 KB, the number
of frames is:
Total Frames = Physical Memory Size / Page Size
= 229 /213 = 216 frames
Frame number requires 16 bits.
Let’s Determine Page Table Entry Size
Each Page Table Entry (PTE) contains:
Frame Number Bits = 16 bits
Flag Bits = 4 bits
Total PTE Size = 16 + 4 = 20 bits = 2.5 bytes (you know 1 byte = 8 bits)
Let’s Calculate Total Page Table Size:
The Page Table Size = Total Pages X PTE Size
= 219 X 2.5 bytes
= 1,310,720 bytes (approx. 1.25 MB)
10. Consider the following page reference string:
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6
How many page faults will occur for the following page replacement
algorithm, assume 4 frames.
(i) LRU replacement (ii) FIFO replacement (iii) Optimal replacement
11. Suppose main memory has 3 frames and page numbers which are going to be
referenced are 1, 1, 3, 2, 2, 2, 4, 9, 9, 6, 3, 2, 2, 7, 6, 6, 3, 3. How many
page faults will occur for the following page replacement algorithm?
(i) LRU replacement (ii) FIFO replacement (iii) Optimal replacement
12. Given five memory partitions of 100 KB, 500 KB, 200 KB, 300 KB and 600 KB
(in order), how would the first-fit, best-fit and worst-fit algorithm place
process of 212 KB, 417 KB, 112 KB and 425 KB (in order)? Which algorithm
makes the most efficient use of memory?
Solution: Refer question no.2 (short answer type)
13. Determine the number of page faults for FIFO, LRU, Optimal separately for
the following reference string for 3 page frames. 1, 2, 3, 4, 5, 3, 4, 1, 6, 7,
8, 7, 8, 9, 7, 8, 9, 5

14
14. Consider the following reference string. Determine the number of page faults
for FIFO, LRU and Optimal algorithms separately if memory size is 4 frames.
2, 6, 7, 2, 4, 7, 1, 4, 3, 4, 0, 7, 4, 5, 2, 3, 2, 6, 3, 8, 5
15. Consider the following reference string. Calculate the page fault rates for the
FIFO, Optimal and LRU algorithms. Assume that the memory size is 4 frames.
1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 8, 9, 7, 8, 9, 5, 4, 5, 4, 2
16. sing FIFO, Optimal and LRU Page replacement algorithms separately compute
the number of page faults will occur for the following reference string with 4
page frames: 1, 3, 4, 4, 3, 2, 1, 7, 5, 6, 4, 2, 1, 2
17. Explain paging technique with TLB. Find out the hit ratio required to reduce
the effective memory access time of 200ns without TLB to 140ns with TLB.
Assume TLB access time is 25ns.
18. What is Pure Demand Paging and how it differs from Demand Paging?
Consider the following page reference string: 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 1,
2, 3, 4, 1, 2, 3, 1, 2, 1. If the process is allocated four frames how many
page faults would occur if page replacements are done using FIFO, Optimal
and LRU algorithms?
19. Briefly compare the relative advantages of paging with a segmentation-based
memory management.
20. Explain the different techniques for structuring page table. Mention their pros
and cons if any.
21. Explain the paging technique as solution to external fragmentation with
suitable address translation diagram?
22. Define page fault? With a neat block diagram explain the steps used by the
OS to recover from the page fault.

Module-V
Very short answer type questions
1. What is the drawback of page table? How it can be overcome. Using TLB?
2. Which of the scheme describe that the IO device are accessed by generating
a memory address?
(i) Shared Memory (ii) IPC (iii) Memory-Mapped IO (iv) IO-
Mapped Memory
3. Which possible transfer of data from and to the memory without help of main
CPU?
(i) Bus (ii) DMA (iii) IDE (iv) None of these
4. In the _______ algorithm, the disk head moves from one end to the other,
servicing requests along the way. When the head reaches the other end, it
immediately returns to the beginning of the disk without servicing any
requests on the return trip.

15
5. In the ______ algorithm, the disk arm goes as far as the final request in each
direction, then reverses direction immediately without going to the end of the
disk.
6. Name the different file access methods?
7. Differentiate between Rotational Latency and Transfer Time in Disk
Scheduling.
8. Differentiate between Seek Time and Disk Access Time in Disk Scheduling.
9. How LOOK scheduling is different from SCAN and C-SCAN scheduling.
10. Differentiate between LOOK and C-LOOK.
11. Differentiate between SCAN and C-SCAN scheduling.
12. What is the disadvantage of SSTF disk-scheduling?
13. What are the essential goals of disk scheduling?

Medium answer type questions


1. Explain swap-space management.
2. Differentiate between SCAN and C-SCAN disk scheduling algorith with an exa
Differentiate between LOOK and C-LOOK disk scheduling algorith with an
example.mple.
3. Differentiate between LOOK and C-LOOK disk scheduling algorith with an
example.
4. Differentiate between magnetic disks and magnetic tapes.
5. Discuss about magnetic disk with a suitable diagram.
6. Discuss about various disk allocation methods with suitable diagram.
7. Discuss about Linear List and Hash Table Directory Structure implementation.
8. What is Directory Structure? Descibe any three methods of organizing
directory structure.
9. Briefly explain the shortest seek time first (SSTF) disk scheduling.
10. What are the advantages and disadvantages of Tree Structure directory? How
does acyclic-graph directory structure overcomes the disadvantages of Tree
Structure directory?
11. Discuss about various disk allocation methods with suitable diagram.
12. Discuss about Linear List and Hash Table Directory Structure implementation.
13. What is Directory Structure? Describe any three methods of organizing
directory structure.
14. Briefly explain about the SCAN disk scheduling Algorithm.
15. Consider a disk with 1000 cylinders numbered 0 to 999. Assume that
requests are made for the following tracks: 123, 874 and 692. Compute the

16
total distance the disk head moves under FCFS and SSTF. Assume last
request serviced was at track 345.

Solution:

i. FCFS Total Distance = 1155 cylinders


ii. SSTF Total Distance = 973 cylinders

16. Briefly explain the shortest seek time first (SSTF) disk scheduling.

Long answer type questions


1. Suppose that a disk drive has 5000 cylinders numbered 0 to 4999. The drive
is currently solving a request at cylinder 143 and the previous request was at
cylinder 125. The queue of pending requests, in FIFO order is :
86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
Starting from current head position, what is the total distance (in cylinders)
that a disk arm moves to satisfy all the pending requests for each of the
following disk-scheduling algorithms?
(i) FCFS (ii) SSTF (iii) SCAN (iv) C-LOOK
Solution:

i. FCFS: 8081 cylinders


ii. SSTF: 1745 cylinders
iii. SCAN: 1917 cylinders
iv. C-LOOK: 1745 cylinders

2. Suppose that a disk drive has 5000 cylinders numbered 0 to 4999. The drive
is currently solving a request at cylinder 175 and the previous request was at
cylinder 132. The queue of pending requests, in FIFO order is :
42, 3100, 82, 785, 2250, 950, 1380, 985, 2020, 100
Starting from current head position, what is the total distance (in cylinders)
that a disk arm moves to satisfy all the pending requests for each of the
following disk-scheduling algorithms?
(i) LOOK (ii) SSTF (iii) SCAN
3. What are bad blocks in disks? Discuss the methods to handle bad blocks with
an example in each case.
4. Write the importance of disk scheduling. Compare the working of SSTF and
SCAN scheduling algorithm.
5. Required blocks which are going to be accessed from a disk drive are on the
cylinder 98, 183, 37, 122, 14, 124, 65, 67. Disk head is initially at cylinder
53. Find out the total number of head movements using FCFS, SSTF, SCAN,
LOOK and C-LOOK disk-scheduling algorithms.
6. Suppose that a disk drive has 5000 cylinders numbered 0 to 4999. The drive
is currently solving a request at cylinder 175 and the previous request was at
cylinder 132. The queue of pending requests, in FIFO order is :
42, 3100, 82, 785, 2250, 950, 1380, 985, 2020, 100
Starting from current head position, what is the total distance (in cylinders)

17
that a disk arm moves to satisfy all the pending requests for each of the
following disk-scheduling algorithms?
(i) LOOK (ii) SSTF (iii) SCAN
7. Suppose that a disk drive has 5000 cylinders numbered 0 to 4999. The drive
is currently solving a request at cylinder 143 and the previous request was at
cylinder 125. The queue of pending requests, in FIFO order is :
86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
Starting from current head position, what is the total distance (in cylinders)
that a disk arm moves to satisfy all the pending requests for each of the
following disk-scheduling algorithms?
(i) FCFS (ii) SSTF (iii) SCAN (iv) C-LOOK
8. Consider a disk with 100 cylinders, numbered 0 to 99. Consider a disk
reference request (list of cylinder numbers of requests) 12, 23, 37, 22, 14,
61, 45, 77, 68, 25, 89, 78. What would be the total number of cylinder
movements if the disk scheduling policy is (i) SSTF, (ii) SCAN, (iii) C-LOOK ?
For each, just show the order in which the requests are serviced and the total
number of cylinder movement, no other explanation is needed.
Consider initially the disk head position is at 40.
9. Discuss about the different file allocation methods and explain about different
file access methods with example.
10. Consider a disk with 100 cylinders, numbered 0 to 99. Consider a disk
reference request (list of cylinder numbers of requests) 12, 23, 37, 22, 14,
61, 45, 77, 68, 25, 89, 78. What would be the total number of cylinder
movements if the disk scheduling policy is (i) SSTF, (ii) SCAN, (iii) C-LOOK ?
For each, just show the order in which the requests are serviced and the total
number of cylinder movement. Consider initially the disk head position is at
40.
11. Suppose that a disk drive has 5000 cylinders numbered 0 to 4999. The drive
is currently solving a request at cylinder 143 and the previous request was at
cylinder 125. The queue of pending requests, in FIFO order is :
86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
Starting from current head position, what is the total distance (in cylinders)
that a disk arm moves to satisfy all the pending requests for each of the
following disk-scheduling algorithms?
(i) FCFS (ii) SSTF (iii) SCAN (iv) C-LOOK
12. Suppose that a disk drive has 5000 cylinders numbered 0 to 4999. The drive
is currently solving a request at cylinder 175 and the previous request was at
cylinder 132. The queue of pending requests, in FIFO order is :
42, 3100, 82, 785, 2250, 950, 1380, 985, 2020, 100
Starting from current head position, what is the total distance (in cylinders)
that a disk arm moves to satisfy all the pending requests for each of the
following disk-scheduling algorithms?
(i) LOOK (ii) SSTF (iii) SCAN
13. Required blocks which are going to be accessed from a disk drive are on the
cylinder 98, 183, 37, 122, 14, 124, 65, 67. Disk head is initially at cylinder
53. Find out the total number of head movements using FCFS, SSTF, SCAN,
LOOK and C-LOOK disk-scheduling algorithms.
14. What is the basic operational difference between SCAN, C-SCAN and LOOK
disk-scheduling algorithm? What will be the total head movement if current

18
disk position is at 50 and queue contains requests for I/O in the order: 98,
153, 37, 122, 14, 124, 65, 67 using SSTF disk scheduling algorithm?
15. A disk drive has 2000 cylinders, numbered from 0 to 1999. The drive is
currently serving a request at cylinder 111, and the previous request was at
cylinder 90. The queue of pending requests in FIFO order is 34, 190, 21,
1543, 237, 987, 328, 675, 1129, 65. Starting from the current head position,
what is the total distance (in cylinders) that the disk arm moves to satisfy all
the pending requests for FCFS, SSTF, SCAN, LOOK and C-LOOK disk-
scheduling algorithms?
16. Explain about different file allocation and file access methods.
17. Explain the different directory structures and access mechanisms to retrieve
various files.

19

You might also like