Question

In: Other

Consider a file currently consisting of 200 blocks. Assume that the file control block (and the...

Consider a file currently consisting of 200 blocks. Assume that the file control block (and the index block, in the case of indexed allocation) is already in memory. Calculate how many disk I/O operations are required for contiguous, linked, and indexed (single-level) allocation strategies, if the following conditions hold. In the contiguous allocation case, assume that there is no room to grow in the beginning, but there is room to grow in the end. Assume that the block information to be added is stored in memory. For linked allocation, there is a tail pointer pointing to the last node.

  1. The block is added at the beginning
  2. The block is added at the end
  3. The block is removed from the beginning
  4. The block is removed from the end

More Assumptions:

  • Read one whole block = one I/O operation

  • Write one whole block = one I/O operation

  • For linked allocation, a file allocation table (FAT) is not used, i.e., only the address of the starting block is in memory

  • All preparation of a block (including putting in the data and any link value) is done in main memory and then the block is written to disk with one write operation

  • The file control block does not have to be written to disk after a change (this is typical where many operations are performed on a file)

  • At most one index block is required per file and it does not have to be written to disk after a change.

  • For contiguous, linked and indexed allocations, assume that no I/O operations are necessary to add a freed block to the free list

Note that while calculating the total number of I/O operations for each, also indicate how many came from r(read) and w(write).

Solutions

Expert Solution

Contiguous Linked Indexed

1. The block is added at the beginning

401 1 1

2. The block is added at the end

1 2 1

3. The block is removed from the beginning

0 or 398 1 0

4. The block is removed from the end

0 200 0

1. The block is added at the the beginning.

Contiguous: Shift all the block down and an extra operation to write. As a result, there are 401 I/O operations.

Linked: Add to block at the beginning 1 write operation.

Indexed: Add to block at the beginning 1 write operation.

2. The block is added at the end

Contiguous: Add to block at the end 1 write operation.

Linked: Add to block at the end - 1 write operation and to fix the last pointer -1 write operation. So 2

Indexed: Add to block at the end 1 write operation.

3. The block is removed from the beginning

Contiguous: Only the FCB has to be updated which is in memory so there are 0. Or, the last 199 blocks can be shifted down for which 199*2 = 398 I/O

Linked: 1 I/O operation - reset the starting pointer

Indexed: 0 I/O operations - index block has to be updated

4. The block is removed from the end

Contiguous: 0 I/O operations file control block has to be updated

Linked: 200 I/O operations. Read first 199 blocks and reset the pointer.

Indexed: 0 I/O operations index block has to be updated


Related Solutions

Consider a file currently consisting of 100 blocks. Assume that the File Control Block (or, the...
Consider a file currently consisting of 100 blocks. Assume that the File Control Block (or, the index block, in case of indexed allocation) is already in the RAM. Calculate how many disk I/O operations (“read block” or “write block”) are required for contiguous, linked, and indexed (single-level) allocation strategies, if the following conditions hold (In the contiguous allocation case, assume that there is no room to grow in the beginning, but there is a room to grow in the end....
Assume there is a file which consists of 20 blocks. Consider that the file-control block is...
Assume there is a file which consists of 20 blocks. Consider that the file-control block is already stored in the memory. Calculate the number of disk I/O operations are required for contiguous and linked allocation strategies, if, for one block, the following conditions hold. Also assume that the block information to be added is stored in memory. a. The block is added at the beginning. b. The block is added in the middle. c. The block is added at the...
Write a program that reads a file consisting of students’ test scores in the range 0–200....
Write a program that reads a file consisting of students’ test scores in the range 0–200. It should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. Output the score ranges and the number of students. (Run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200,...
Consider the following four blocks, all of which are attached to identical springs: block A: mass...
Consider the following four blocks, all of which are attached to identical springs: block A: mass = 200·g, spring stretched 10·cm block B: mass = 800·g, spring stretched 20·cm block C: mass = 400·g, spring stretched 20·cm block D: mass = 400·g, spring stretched 20·cm. (a) All the blocks are placed on a level surface that has no significant friction. For each of the following ranking tasks use the symbols > and = to indicate your ranking (ties are possible),...
For this question (Determine the velocity of the 60 kg block A if the two blocks...
For this question (Determine the velocity of the 60 kg block A if the two blocks are released from rest and the 40 kg block B moves 0.6 m up the in cline. The coefficient of kinetic friction between both blocks and the inclined planes is = 0.05.), how is T(2) = 110 V(a)^2 instead of T(2) = -50V(a)^2
Suppose that two blocks are positioned on an Atwood machine so that the block on the...
Suppose that two blocks are positioned on an Atwood machine so that the block on the right of mass m1 hangs at a lower elevation than the block on the left of mass m2. Both blocks are at rest. Based on this observation, what can you conclude? A) m1>m2 B) m1<m2 C) m1=m2 D) You cannot conclude anything with the given information.
Consider a process consisting of three resources. Assume there exists unlimited demand for the product.
PA 3-3 (Static) Consider a process consisting of three... Consider a process consisting of three resources. Assume there exists unlimited demand for the product. • Resource 1 has a processing time of 6 minutes per unit. • Resource 2 has a processing time of 3 minutes per unit. • Resource 3 has a processing time of 5 minutes per unit. The three resources are staffed by different workers individually. The flow diagram is shown above. Round "Capacity of resource" to 3 decimal places. a. What is the...
Consider a process consisting of three resources. Assume thereexists unlimited demand for the product, and...
Consider a process consisting of three resources. Assume there exists unlimited demand for the product, and that all activities are always performed in the following sequence.Resource 1 has a processing time of 6 minutes per unit.Resource 2 has a processing time of 3 minutes per unit.Resource 3 has a processing time of 5 minutes per unit.All three resources are staffed by one worker and each worker gets paid $12 per hour.f. If one additional worker could be hired, to which...
Consider a process consisting of three resources. Assume there exists unlimited demand for the product, and...
Consider a process consisting of three resources. Assume there exists unlimited demand for the product, and that all activities are always performed in the following sequence.  • Resource 1 has a processing time of 7 minutes per unit.  • Resource 2 has a processing time of 4 minutes per unit.  • Resource 3 has a processing time of 6 minutes per unit.  All three resources are staffed by one worker and each worker gets paid $10 per hour.    a....
Four blocks are connected by a weightless cord. Block A hangs from a table on the...
Four blocks are connected by a weightless cord. Block A hangs from a table on the left. Block B and C rest upon the table. Block D hangs from the table on the right. Block A and D are over pulleys. Block B has a weight of 1N, Block C=4N and Block D=7N. a. Find the weight of Block A such that the accelartion of Block B is (g/7) b. Find the coefficient of friction for the table, if the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT