0% found this document useful (0 votes)
18 views

Practice Questions On Memory and Storage (Operating System)

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Practice Questions On Memory and Storage (Operating System)

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Operating Systems (18B11CI411)

All the OS faculty are requested to contribute conceptual an dnumerical questions as


practice problems for the students.

Questions on Main Memory and Virtual Memory + Mass Storage Structure 11.1 & 11.2

SECTION - A: Memory Management

Q1. 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-
1. First Fit Algorithm
2. Best Fit Algorithm
3. Worst Fit Algorithm

Q2 A computer has 1000 K of main memory. The jobs arrive and finish in the following
sequence:

Job 1 requiring 200 K arrives


Job 2 requiring 350 K arrives
Job 3 requiring 300 K arrives
Job1 finishes
Job 4 requiring 120 K arrives
Job 5 requiring 150 K arrives
Job 6 requiring 80 K arrives
Compare the performance of first-fit and best-fit strategy for the given scenario.

Q3 Consider a logical address space of 256 pages with a 4-KB page size, mapped onto a
physical memory of 64 frames.
a. How many bits are required in the logical address?

b. How many bits are required in the physical address?

Q4. Free memory holes of sizes 15K, 10K, 5K, 25K, 30K, 40K are available. The processes
of size 12K, 2K, 25K, 20K is to be allocated. How processes are placed in first fit, best fit,
worst fit. Calculate internal as well as external fragmentation.

Q5. Consider a virtual memory system with physical memory of 8GB, a page size of 8KB,
and a 46-bit virtual address. Assume every page table exactly fits into a single page. If page
table entry size is 4B then how many levels of page tables would be required?

Q6. Consider a machine with 64 MB physical memory and 34 bit virtual address space.If the
page size is 4 KB ,the approximate size of conventional and inverted page table will be??
Q7. Suppose, for example, that in a system with a 14-bit address space (0 to 16383), we have
a program that should use only addresses 0 to 10468. Given a page size of 2 KB. Addresses
in pages 0, 1, 2, 3, 4, and 5 are mapped normally through the page table. Any attempt to
generate an address in pages 6 or 7, however, will find that the valid –invalid bit is set to
invalid, and the computer will trap to the operating system (invalid page reference). What is
the internal fragmentation here?

Q8. if page size is 2,048 bytes, a process of 72,766 bytes will need 35 pages plus 1,086
bytes. It will be allocated ___________ frames, resulting in internal fragmentation of
____________bytes.

Q9. On a 32-bit CPU, each page-table entry is 4 bytes long and i-bit is used as valid-invalid
bit for providing protection. If the frame size is 4 KB, then what is the size of physical
memory that can be addressed in Tera Bytes (TB)?

Q10. A system uses 2 bits to represent page number and 2 bits to represent page offset. Using
a page size of 4 bytes and a physical memory of 32 bytes (8 pages), how many frames are in
the physical address space?

SECTION - B: Virtual Memory

Q1. Assume that you have a page-reference string for a process with m frames (initially all
empty). The page-reference string has length p, and n distinct page numbers occur in it.
Answer these questions for any page-replacement algorithms: a. What is a lower bound on
the number of page faults? b. What is an upper bound on the number of page faults?

Q2. With an average page-fault service time of 8 milliseconds and a memory access time of
200 nanoseconds, the effective access time in nanoseconds is ___________________.
Assume, If one access out of 1,000 causes a page fault.

Q3. Consider a demand paging system with four-page frames (initially empty) and LRU page
replacement policy. For the following page reference string

7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1
Compute the page fault rate. The page fault rate is defined as the ratio of number of page
faults to the number of memory accesses.

Q4. Calculate page faults for (LRU, FIFO, OPT) for following page reference sequences
where page frame is three.
0,1,2,1,4,2,3,7,2,1,3,5,1,2,5.

Q5 A process generates the following sequence of memory references when its instructions
are executed.
Assuming page size as 100 bytes, answer the following questions.
(a) Generate a reference string for page replacement from the above given memory
references.
(b) Compute the number of page faults for FIFO Page Replacement Algorithm.

Q6. Consider a demand paging system with four-page frames (initially empty) and LRU page
replacement policy. For the following page reference string

7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1
Compute the page fault rate. The page fault rate is defined as the ratio of number of page
faults to the number of memory accesses.

Q7. An operating system supports a paged virtual memory. The central processor has a cycle
time of 1 microsecond. It costs an additional 1 microsecond to access a page other than the
current one. Pages have 1,000 words, and the paging device is a drum that rotates at 3,000
revolutions per minute and transfers 1 million words per second. The following statistical
measurements were obtained from the system:
- One percent of all instructions executed accessed a page other than the current page.
- Of the instructions that accessed another page, 80 percent accessed a page already in
memory. 442 Chapter 10 Virtual Memory
- When a new page was required, the replaced page was modified 50 percent of the
time.
Calculate the effective instruction time on this system, assuming that the system is running
one process only and that the processor is idle during drum transfers.

Q8. Consider the page table for a system with 12-bit virtual and physical addresses and 256-
byte pages. The list of free page frames is D, E, F (that is, D is at the head of the list, E is
second, and F is last). A dash for a page frame indicates that the page is not in memory.
Convert the following virtual addresses to their equivalent physical addresses in hexadecimal.
All numbers are given in hexadecimal.
(a) 9EF (b) 111 (c) 700 (d) 0FF

Q9. Consider a system uses working-set model for frame allocations. Working-set window
size is 7. Following is sequence of virtual page references:

5, 4, 3, 3, 4, 1, 2, 2, 1, 2, 1, 1, 5, 4, 3, 5

What will be the minimum number of elements in a working set on execution of the above
sequence?

Q10. In a system with 62 frames, if there is a process of 10KB and another process of
127KB, then how many frames should be allocated to the first process and second process
as per the proportional allocation scheme?

SECTION - C: Mass Storage Structure

Q1. Describe the HDD disk-head moving mechanism with a neat and clean diagram.

Q2. Compute rotational latency of a drum that rotates at 3000 revolutions per minute.

Q3. A time of 20 ms (milli seconds) is required to move the disk arm to the required track
while accessing the desired data. It takes a time of 1 ms for the beginning of the required
sector to reach the head. Assuming the desired data has 100 pages of 4KB (Kilo Bytes) and it
takes a time of one second to transfer 1000 bytes. Compute the disk access time?

Q4. Consider a disk pack with 16 surfaces, 128 tracks per surface and 256 sectors per track.
512 bytes of data are stored in a bit serial manner in a sector. Calculate the capacity of the
disk pack and the number of bits required to specify a particular sector in the disk.

Q5. Suppose the order of request is- (82,170,43,140,24,16,190)


And current position of Read/Write head is: 50
Compute the head movements for the following disk scheduling algorithms - FCFS, SCAN,
and C-SCAN.

Q6. Suppose a disk has 201 cylinders, numbered from 0 to 200. At some time the disk arm is
at cylinder 100, and there is a queue of disk access requests for cylinders 30, 85, 90, 100, 105,
110, 135, and 145. If FCFS, SCAN, and C-SCAN disk scheduling algorithms are being used
for scheduling the disk access, the request for cylinder 90 is serviced after servicing ______,
______, and _________ the number of requests for each scheduling algorithm written in the
sequence.

Q7. Consider an operating system capable of loading and executing a single sequential user
process at a time. The disk head scheduling algorithm used is First Come First Served
(FCFS). If FCFS is replaced by SCAN, claimed by the vendor to give 50% better benchmark
results, what is the expected improvement in the I/O performance of user programs?

Q8. Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a
transfer rate of 50 × 10^6 bytes/sec. If the average seek time of the disk is twice the average
rotational delay and the controller’s transfer time is 10 times the disk transfer time, the
average time (in milliseconds) to read or write a 512-byte sector of the disk is
_____________.
Q9. Suppose the following disk request sequence (track numbers) for a disk with 100 tracks
is given: 45, 20, 90, 10, 50, 60, 80, 25, 70. Assume that the initial position of the R/W head is
on track 50. The additional distance that will be traversed by the R/W head when the Shortest
Seek Time First (SSTF) algorithm is used compared to the SCAN (Elevator) algorithm
(assuming that SCAN algorithm moves towards 100 when it starts execution) is _________
tracks.

Q10. Consider a storage disk with 4 platters (numbered as 0, 1, 2 and 3), 200 cylinders
(numbered as 0, 1,…, 199), and 256 sectors per track (numbered as 0, 1, … , 255).
The following 6 disk requests of the form [sector number, cylinder number, platter
number] are received by the disk controller at the same time:

[120, 72, 2], [180, 134, 1], [60, 20, 0], [212, 86, 3], [56, 116, 2], [118, 16, 1]

Currently the head is positioned at sector number 100 of cylinder 80, and is moving
towards higher cylinder numbers. The average power dissipation in moving the head
over 100 cylinders is 20 milliwatts and for reversing the direction of the head movement once
is 15 milliwatts. Powerdissipation associated with rotational latency and switching of head
between different platters is negligible. Calculate total power consumption in milliwatts to
satisfy all of the above disk requests using the Shortest Seek Time First (SSTF) disk
scheduling algorithm.

You might also like