# 某操作系统公司面试题，求答案

tangqiaoboy 2008-03-13 09:51:45
1．Many CPU scheduling algorithms are parameterized. For example ,the RR algorithm requires
a parameter to indicate the time slice. Multilevel feedback queues require parameters to define the
number of queues , the scheduling algorithms for each queue , the criteria used to move processes
between queues, and so on.
These algorithms are thus really sets of algorithms (for example, the set of RR algorithms for all time slices, and so on). One set of algorithms may include another (for example , the FCFS(first come first serve) algorithm is the RR algorithm with an infinite time quantum). What (if any) relation holds between the following pairs of sets of algorithms?
a. Priority and SJF
b. Multilevel feedback queues and FCFS
c. Priority and FCFS
d. RR and SJF

2. A bank teller provides service to customers who arrive in a Poisson pattern at an average
rate of 20 per hour. Service times are distributed exponentially with an average time of two
minutes.
a) What is the mean waiting time for each customer?
b) A second teller arrives back from lunch and begins serving customers. A single line
continues to serve both tellers. What is the mean waiting time when both tellers are working?
HINT: Refer to Allen's paper. Erlang's C formula for 2 servers can be given as
C(2,U) = U / (2 + 2U - U2)

A page-replacement algorithm should minimize the number of page faults. We can achieve this minimization by distributing heavily used pages evenly over all of memory, rather than having them compete for a small number of page frames. We can associate with each page frame a counter of the number of pages associated with that frame. Then , to replace a page ,we can search
for the page frame with the smallest counter.
a. Define a page-replacement algorithm using this basic idea. Specifically address these problems:
1. What the initial value of the counters is
2. When counters are increased
3. When counters are decreased
4. How the page to be replaced is selected
b. How many page faults occur for your algorithm for the following reference string, with four page frames?
1,2,3,4,5,3,4,1,6,7,8,7,8,9,7,8,9,5,4,5,4,2.
c. What is the minimum number of page faults for an optimal page-replacement strategy for the reference string in part b with four page frames?

a． 基于这种基本思想，定义一个页面置换算法。特别注意的问题：
1． 计数器初始值是多少？
2． 什么时候计数器值增加？
3． 什么时候计数器值减小?
4． 怎样选择要被置换的页？
b． 设有4个页帧，对于下面引用序列，你的算法会发生多少次页错误。
1,2,3,4,5,3,4,1,6,7,8,7,8,9,7,8,9,5,4,5,4,2.
c． 最佳页面置换算法对于4页帧的题b中的引用序列的最小页错误数为多少？
...全文
1434 9 打赏 收藏 举报

9 条回复

michney 2008-03-14
• 打赏
• 举报

vxworks?
pingfanhuan 2008-03-14
• 打赏
• 举报

to a.Priority and SJF

to b. Multilevel feedback queues and FCFS
Multilevel feedback queues（多级反馈轮转），如果假定多级反馈轮转算法中的反馈和轮转的标准（criteria）是作业的等待时间（FCFS，First Come First Service，先来先服务）的话，此时的多级反馈轮转就变成了FCFS

to c. Priority and FCFS

to d. RR and SJF

！！！

• 打赏
• 举报

con_con 2008-03-14
• 打赏
• 举报

tangqiaoboy 2008-03-14
• 打赏
• 举报

• 打赏
• 举报

• 打赏
• 举报

• 打赏
• 举报

IT_lau 2008-03-13
• 打赏
• 举报

6.3w+

C++ 语言相关问题讨论，技术干货分享，前沿动态等
c++ 技术论坛（原bbs）

2008-03-13 09:51

1. 请不要发布与C++技术无关的贴子
2. 请不要发布与技术无关的招聘、广告的帖子
3. 请尽可能的描述清楚你的问题，如果涉及到代码请尽可能的格式化一下