You are on page 1of 4

OS Homework Assignment

(All homework assignments are individual efforts)


(Due by 1:30 PM on Nov. 27, 2023)
(Submission via Blackboard)

1. (2 points) The aspect of disk performance that represents the time it takes
to position the head at the desired track is known as:
a. Seek time
b. Rotational delay
c. Access time
d. None of the above

2. (2 points) The data structure that maintains information on available disk space
is called the:
a. File Allocation Table (FAT)
b. Disk Allocation Table
c. Bitmap
d. None of the above

3. (2 points) Which of the following is NOT an advantage of Continuous Allocation as


a Disk Block Allocation algorithm? (assume “extents” are not used)
a) It is effective for sequential access
b) It is effective for direct access
c) Given the logical block number, the corresponding physical block number
can be easily computed
d) There is no need to know the file’s maximum size when it is first created

4. (6 points). Consider a file F whose data is spread over 1000 physical disk blocks
on the disk. Assume the size of a logical block is equal the size of a physical block.
Given a logical block number X, what is the maximum number of disk accesses
that you would need to retrieve the physical block that corresponds to X?
Assume the file control block of F and the directory entry that contains information
about F are cached in the main memory.

Give and explain your answer for each of the following cases:

i.) Continuous allocation


In this scenario, retrieving the physical block corresponding to logical block X necessitates a
single disk access. The file control block for F is stored in main memory, eliminating the need for
disk access to ascertain the location of physical block X.

iii.)Linked allocation

In this situation, obtaining the physical block corresponding to logical block X entails two disk
accesses. Initial access is made to the cached file control block for F in main memory, offering
the location of the initial physical block in the file. The second access is then made to the
physical block containing the link to the specific physical block corresponding to logical block X.
v.) Indexed allocation (Assume an index block may have up to 1024 entries)

In this instance, retrieving the physical block corresponding to logical block X involves two disk
accesses. Initial access is made to the cached file control block for F in main memory, providing
the location of the index block that holds the information about the physical block corresponding
to logical block X. The second access is then made to the index block to retrieve the precise
location of the physical block.
5. (15 points) Consider the organization of a UNIX file as represented by the inode.
Assume that there are 12 direct block pointers and a singly, doubly, and triply
indirect pointer in each inode. Further, assume that the system block size and the
disk sector size are both 8 K. If the disk block pointer is 32 bits, with 8 bits to identify
the physical disk and 24 bits to identify the physical block, then
a. What is the maximum file size supported by this system?

Block size is 4096 bytes and can contain 1024 block references.
12 slots for direct disk blocks
One slot each for single indirect = 1024 = 2^10 and double indirect. = 1024^2 = 2^20

Maximum file size = (12 + 2^10 + 2^20) * 2^12 = 2^32


(12 + 1024 + 1024^2) * 4096 = 4GB

b. What is the maximum file system partition supported by this system?

The size of each disk block is 1 KB = 210 bytes.


There are 8 direct blocks = 8 × 1 KB = 23 × 210 bytes = 213 bytes.
Size of each disk block is 1 KB and size of each disk block address is 32 bit = 210 bytes / 4
bytes = 28 blocks.

single indirect block address = 28 × 1 KB = 28 × 210 bytes = 218 bytes


double indirect block address = 28 × 28 × 210 bytes = 226 bytes
triple indirect block address = 28 × 28 × 28 × 210 bytes = 234 bytes

Thus, the maximum file size is 213 + 218 + 226 + 234 bytes = 234 bytes ≈ 16 GB.

c. Assuming no information other than that the file inode is already in main
memory, how many disk accesses are required to access the byte in position
13,423,956?

We need two disk accesses to access the byte in position 13,423,956, we can use either
direct node pointer or indirect node pointer.

6. (8 points) How long does it take to perform the following disk read? The
specifications of Cheetah and Barracuda are given in the following table. Assume
the block size for Cheetah is 4 KB and for Barracuda is 8KB.

(a) 4KB read w/ Cheetah


1 1000
Total Disk Read Time ¿( ×
2 250
)+
4 KB
4 MB ( )
+4 MS =7 ms

(b) 8KB read w/ Barracuda

Total Disk Read Time ¿ ( 12 × 1000


120 ) +(
3 M B)
4 KB
+11 ms=17.76 ms

(c) 4MB sequential read w/ Cheetah

Total Disk Time ¿ ( 12 × 1000


250 ) +(
130 MB )
4 MB
+ 4 ms=36.76 ms
(d) 6MB sequential read w/ Barracuda

Total Disk Time = ( 12 × 1000


120 ) +(
112 MB )
6 MB
+11 ms=4.23 ms

Cheetah Barracuda
RPM 15,000 7,200
Avg Seek 4ms 11ms
Max Transfer 130MB/s 112MB/s

7. (15 points) Given a stream of I/O requests (within a cylinder range of 0-299): 46,
254, 16, 196, 205, 251, 32, 35, 48, 280, 157, calculate the number of cylinders the
head movement covers. Initially, the arm head points to 151.
(a) FIFO
- Total head movement of 1376
(b) SPTF
- Total head movement of 393
(c) SCAN
- Total head movement of 431
(d) C-SCAN
- Total head movement of 495 or 592
(e) C-LOOK
- Total head movement of 425

You might also like