首页 > > 详细

辅导data程序、讲解c/c++,Python编程、Java程序调试 调试C/C++编程|讲解R语言编程

Q1
Assume that the maximum capacity of a file system space is 8TB (1TB = 240 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) 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) 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?
Q2
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.
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.

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!