0% found this document useful (0 votes)
10 views4 pages

2020期末模拟

Uploaded by

1812870253
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

2020期末模拟

Uploaded by

1812870253
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

题号 一 二 三 四 五 六 七 八 九 总分

满分 10 12 13 15 12 13 12 13 100

一. (10 points) Select the best answer for each blank


1. In the following comments, __________ are correct.
(1) Android is a widely used embedded operating system devoted to smart phones and tablet computers.
(2) Microsoft Windows Phone lists Top 1 in terms of the market share among the operating systems
dedicated to smart phones.
(3) Unix has some distribution versions supporting server or mainframe computers.
(4) Linux is a type of open source operating systems.
(5) Windows XP is the operating system with the layered structure.
A. (1) and (2) B. (2) and (3) C. (3) and (4) D. (4) and (5)
2. In the booting procedure, when a PC computer is powered up, the chunk of codes that the CPU will at
first execute is ___________ .
A. OS kernel B. bootstrap in BIOS C. boot block on disk D. system programs
3. Among the following comments, only ____________ are correct.
(1) The cache is a type of non-volatile storage device; it will not lose its contents in the case of system
failure.
(2) In a system with the operating system supporting kernel-level threads, the thread is the basic unit for
CPU scheduling, and the process is the basic unit for resources allocation.
(3) PCB contains the process state, the program counter, CPU registers, and user data.
(4) For several threads created by one process, they can share the files opened in the process.
(5) The round robin algorithm could result in starvation.
A. (1) and (2) B. (3) and (4) C. (4) and (5) D. (2) and (4) E. (2) and (5)
4. In the following , _________ is not one of the conditions which should be satisfied for a good solution to
critical section problem.
A. mutual exclusion B. fairness C. bounded waiting D. progress
5 A major problem for the __________ scheduling algorithm is starvation.
A. Multilevel feedback queue B. FCFS C. RR D. Priority
6. Which one of the following memory management schemes suffers from external fragmentation?
_________
A. Fixed-sized partition B. Paging C. Segmentation D. Segmentation with paging
7. Which one of the following memory allocation schemes can be used for allocating memory for kernel
data structures? _____________
A. paging B. segmentation C. fixed-size partition D. buddy allocation
8. Which one of the following operations is to be performed not only on directory?
A. Search a file B. Rename a file C. Open a file D. Read a record from a file
9. In the following algorithms, which is a disk-scheduling algorithm ? ___________
A. CLOCK B. LRU C. SSTF D. SRTF
10. The disk free-space list is implemented as a bitmap. If the size of the disk space is 128 blocks, and each
block is of 512 bytes, then__________ bytes are needed to store the bitmap.
A.128 B.512 C.16 D.8192
二. (12 points)
As shown below, OS takes a two-level feedback-queue scheme to allocate CPU for concurrent processes. A
process entering the system is at first put in queue 0.
In queue 0, the preemptive priority scheduling algorithm is used, and assuming a small priority number has
higher priority. If a process is dispatched onto the CPU, it will be given a CPU time slice of 10 milliseconds. If it
does not finish within this time, it is moved to the tail of queue 1, while running, if it is preempted, it will reenter
the tail of queue 0 again.
In queue 1, FCFS scheduling algorithm is used. Processes in queue 1 are permitted to run only when there is no
process in queue 0. When a process Pi in queue 1 is running on CPU and a new process Pj enters the system, Pj
will preempt the CPU occupied by Pi.
queue 0

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.

Allocation Request Available


A B C D A B C D A B C D
P1 0 0 1 0 2 0 0 1 2 1 0 0
P2 2 0 0 1 1 0 1 0
P3 0 1 2 0 2 1 0 0
P4 0 0 0 0 0 0 3 0

Answer the following questions on the basis of the deadlock-detecting algorithm.


(1) What are the total numbers of the instances for the type A, B, C and D, respectively?
(2) Is the system in a deadlock state, and why?
(3) If P2’s request vector is changed into (2, 1, 0, 1), is there a deadlock in the system? And if the system is
deadlocked, indicate the process/processes involved in deadlock.
四. (15 points)
A telecom company took out 100 mobile phones for sales promotion. There is only one salesman in the sales
hall, so only one customer can be served at a time, and each customer is limited to buy one. The hall can
accommodate 20 customers at the same time. Customer who comes to buy mobile phones will leave if he find the
hall is full of customer, otherwise he will enter the hall to wait. When it's a customer's turn to buy, if the mobile
phone has been sold out, then the customer leave the hall directly, otherwise, he can buy one and then leave the
hall.
Please using semaphore mechanism, write out the processes to simulate the behavior of salesmen and
customers.
(1) give out the definitions and initial values of semaphores, and
(2) write out the code structure of the salesman process and the customer process respectively.

五. (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.

Figure 1 directory file Figure 2 FCB structure Figure 3 directory tree

(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?

You might also like