29 Pts)(Name) (Section

29 Pts)(Name) (Section

Homework #8______

(29 pts)(Name) (Section)

File Management (Chapter 12)

Questions:

/

Answers:

1. (8 points) Rank each file organization (pile, sequential, indexed sequential, indexed, direct or hashed) in terms of sequential access speed, random access speed, efficient storage usage, and ease of updating (adding/deleting/modifying). (5=best ranking, 1=poorest ranking) / Sequential Access Speed:

Pile

/

Seq

/

Idx-Seq

/

Index

/

Direct

Random Access Speed:

Pile

/

Seq

/

Idx-Seq

/

Index

/

Direct

Efficient Storage Usage:

Pile

/

Seq

/

Idx-Seq

/

Index

/

Direct

Ease of updating:

Pile

/

Seq

/

Idx-Seq

/

Index

/

Direct

2. Directories can be implemented either as “special files” that can only be accessed in limited ways, or as ordinary data files. What are the advantages and disadvantages of each approach?
3. (9 points) One scheme to avoid the problem of pre-allocation versus waste or lack of contiguity is to allocate increasingly bigger file space blocks to the file as the file grows. For example, begin with a file size of one block and then for each allocation, allocate enough contiguous blocks such that the file size doubles.
Consider a file of n records, each of size b bytes and an allocation portion (blocking factor) consisting of f bytes. Suppose that a simple one-level index is used as a file allocation table (each table entry points to a contiguous allocation block – entry position determines the block size.)
a. What is the size of the allocation table (how many entries) if the file contains n records?
b. How much available file space (in bytes) is allocated to a file containing n records? (Do not include the allocation table.)
c. What is the amount of allocated file space (in bytes) that is unused by a file containing 200 records, each 32 bytes in size, and with a blocking factor of 512 bytes?
4. (9 points) Consider the organization of a UNIX like file system where 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 8K bytes. If the disk 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 possible file size?
b. What is the maximum file system partition (assuming a partition must be contained on a single disk)?
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?

BYU, CS 345, F2011Homework #8Page 1/2