COMP SCI 3004/7064 Assignment Part 2: Work-through Questions solution


Original Work ?


5/5 - (3 votes)

Question 1

Assume that the maximum capacity of a file system space is 8TB (1TB = 2 bytes), and the disk block size is 2KB. The file control block (FCB) contains an index table of 512 bytes. Answer the following questions: (1) [4 MARKS] Suppose that the index table only adopts the direct index structure, and stores the disk block numbers occupied by the file.

How many bytes are required for each index table entry to represent a disk block number? What is the maximum length of a single file that can be supported by this scheme? (2) [4 MARKS] Suppose that the index table area adopts the following structure: the first 8 bytes (0 ~ 7 ) use to represent the pre-allocated continuous storage space during file creation, in which the start block number accounts for 6 bytes, and the number of blocks accounts for 2 bytes; the remaining 504 bytes use the direct index structure, and one index entry accounts for 6 bytes.

What is the maximum length of a single file that can be supported by this scheme? In order to maximize the length of a single file, what values of the start block number and number of blocks should be set at? 40                         12pt Paragraph  0 words

Question 2

12 pts A bank has 4 service-windows, and 2 customer waiting rooms each containing 30 waiting seats and a number machine that can be accessed by only one customer at a time. When a customer arrives at the bank, if there is an empty seat in either room, the customer will enter that room and pick up a number from the number machine in that room and then wait for the call of a service-window.

The two number machines are controlled centrally and issue numbers in a globally increasing order. When a service-window is free, it calls and serves the next customer. The activities of customers and service windows are described as follows: Process Customer { Get a waiting seat; Get a number from a number machine; Waiting for a call;

Saved at 18:27 HTML Editor Access to services; } Process Service-window { while(true) { Call a customer; Serve the customer; } } Please add the necessary semaphores (wait (), signal ()) operations to achieve mutual exclusion and synchronization of the above processes.

You should give the complete processes of customer and service-window respectively, explain the meanings of the semaphores and assign initial values to them.                         12pt Paragraph  0 words Submit quiz