2020期末模拟
2020期末模拟
满分 10 12 13 15 12 13 12 13 100
time slice = 10
queue 1
FCFS
Consider the processes P0, P1, P2, P3. For 0≤ i ≤3, the arrival time, the length of the CPU burst time, and the
priority of each Pi are given as below.
Process Arrival time Burst Time Priority
P0 0 7 10
P1 4 20 8
P2 8 3 6
P3 15 15 4
For the snapshot shown above, suppose that two-level feedback-queue scheduling is employed.
(1) Draw the Gantt chart that illustrates the execution of these processes.
(2) What are the turnaround times for the four processes?
三. (13 points)
Consider a system with four processes P1 through P4 and four resource types A, B, C and D. the system snapshot
at time T0 is shown as following table.
五. (12 points)
We traced the execution of a process P1 in a demand-paging system, and recorded the following logical address
sequence (in decimal values) during a particular period:
0100, 0124, 0212, 0224, 0320, 0404, 0424, 0464, 0212, 0140, 0144, 0212, 0216, 0324, 0356, 0360, 0524, 0528,
0612, 0616, 0620, 0724, 0728, 0620, 0624, 0224, 0228, 0140, 0144, 0150, 0240, 0244, 0248, 0660, 0668.
Answer the following questions:
(1) Assuming the page size is 100 bytes (in decimal values), what is the reference string?
(2) Assuming four frames are allocated to this process and all frames are initially empty. How many page faults
would occur for the LRU replacement algorithms?
六. (13 points)
A system using segmentation with paging has a 216 bytes logical address space with 2 segments per process and a
page size of 4096 bytes.
The content of the segment and page tables is specified below (all values in decimal).
For the following logical addresses, indicate corresponding physical address, or if they would occur a page fault.
0, 20123
0, 12300
1, 5000
七. (12 points)
On a disk drive with 5000 cylinders, numbered from 0 to 4999, the last request served was at cylinder 125,
and the head is at cylinder 143. The queue of pending request, in FIFO order, is
86 1470 913 1774 948 1509 1022 1750 130.
Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to
satisfy all the pending requests in the queue, for the following disk scheduling algorithms?
It is required that the procedure of the arm moving to serve the requests should be illustrated by a figure.
(1) SSTF
(2) C-SCAN
(3) SCAN
八. (13 points)
Consider a file system on a disk. The size of disk blocks is 512B. The directory is organized into a tree
structure, and the root directory resides in memory. Directory files are organized into linked files, and common
data files are organized into indexed files.
Each directory entry has one bit to define the entry as a subdirectory or as a file, and two 2-bype fields, one
holds file name and the other holds a pointer to a disk block. For a directory file, the directory name and its first
disk block address are recorded. For a data file, the file name and the disk address where its FCB resides are
recorded. The structure of the directory file is shown in Figure 1, and the structure of FCB is shown in Figure 2.
There are 13 pointers in the file’s FCB. Each pointer (disk address) requires 2 bytes. The first 10 of these
pointers point to direct blocks, i.e data blocks, the next three pointers point to indirect blocks. The first points to a
single indirect block, which is an index block containing the addresses of data blocks. The second points to a
double indirect block, which contains the address of index blocks, and the index blocks contain the addresses of
data blocks. The last pointer contains the address of a triple indirect block.
(1) Calculate the file size that can be accessed directly through FCB.
(2) Calculate the maximum address space accessible through the FCB.
(3) Suppose the directory tree of the file system is shown in Figure 3.
Now, we want to read the contents at 10KB of file M into memory, how many and which disk blocks must be
read into memory?