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

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中的引用序列的最小页错误数为多少?
...全文
1495 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
michney 2008-03-14
  • 打赏
  • 举报
回复
操作系统公司?
vxworks?
pingfanhuan 2008-03-14
  • 打赏
  • 举报
回复 1
果然很长啊,看得有点累
第一个题的answer:
to a.Priority and SJF
如果我们规定短作业的优先级高,那么Priority此时就变成了SJF(Short Job First,短作业优先)

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

to c. Priority and FCFS
同情况a,如果规定优先级根据谁先来而决定,也就是说先来的作业优先级高,那么此时的Priority就成为了FCFS

to d. RR and SJF
假定RR的参数time slice为作业的时间,就是SJF了
!!!

至于第二题,长!

独孤过儿 2008-03-14
  • 打赏
  • 举报
回复
啥样算是会呢?

这几个问题任何一个拿出来,都够写一本书了...要是写代码,至少都是用千行来计算的,难道帮你写出来就是会了?而且,即使写出来了,你

就一定能看懂吗?
con_con 2008-03-14
  • 打赏
  • 举报
回复

不会
tangqiaoboy 2008-03-14
  • 打赏
  • 举报
回复
没有人会吗?
闪破风浪 2008-03-13
  • 打赏
  • 举报
回复
很长很强大!
独孤过儿 2008-03-13
  • 打赏
  • 举报
回复
第一个叫 进程调度算法,主要用来解决进程管理问题

第二个叫 银行家算法,主要用来预防死锁问题

第三个叫 内存管理,主要是用来解决页面在内存中的调度问题
郭建宝 2008-03-13
  • 打赏
  • 举报
回复
關注
IT_lau 2008-03-13
  • 打赏
  • 举报
回复
关注

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧