操作系统课后重点习题整理
第一章
1.17 Define the essential properties of the following types of operating systems: 列出下列操作系统的基本特点: a. Batch批处理
b. Interactive交互式 c. Time sharing分时 d. Real time实时 e. Network网络
g. Distributed分布式
f.并行式h.集群式i.手持式 Answer:作业ch1-第四题 (第六版答案) a. Batch
相似需求的Job分批、成组的在计算机上执行,Job由操作员或自动Job程序装置装载; 可以通过采用 buffering, off-line operation, spooling, multiprogramming 等技术使CPU 和 I/O不停忙来提高性能
批处理适合于需要极少用户交互的Job。 b. Interactive
由许多短交易组成,下一次交易的结果可能不可预知 需要响应时间短 c. Time sharing
使用CPU调度和多道程序提供对系统的经济交互式使用,CPU快速地在用户之间切换 一般从终端读取控制,输出立即打印到屏幕 d. Real time
在专门系统中使用,从传感器读取信息,必须在规定时间内作出响应以确保正确的执行 e. Network 在通用OS上添加 联网、通信功能 远程过程调用 文件共享
f. Distributed 具有联网、通信功能 提供远程过程调用
提供多处理机的统一调度调度 统一的存储管理 分布式文件系统 第二章
第六版2.3 What are the differences between a trap and an interrupt? What is the use of each function? 答:作业ch2-第二题
(第六版答案) An interrupt是硬件产生的系统内的流的改变
A trap是软件产生的“中断”。
interrupt可以被I/O用来产生完成的信号,从而避免CPU对设备的轮询 A trap可以用来调用OS的例程或者捕获算术错误
第七版2.3讨论向操作系统传递参数的三个主要的方法。 1.通过寄存器来传递参数 2.寄存器传递参数块的首地址
3.参数通过程序存放或压进堆栈中,并通过操作系统弹出堆栈。 第三章
第七版3.1 论述短期,中期和长期调度之间的区别.
a.短期调度:在内存作业中选择就绪执行的作业,并为他们分配CPU。 b.中期调度:作为一种中等程度的调度程序,尤其被用于分时系统,一个交换方案的实施,将部分运行程序移出内存,之后,从中断处继续执行。 c.长期调度(作业调度程序):确定哪些作业调入内存以执行.
它们主要的不同之处是它们的执行的频率。短期调度必须经常调用一个新进程,由于在系统中,长期调度处理移动的作业时,并不频繁被调用,可能在进程离开系统时才被唤起。
第七版3.2 问:描述一下内核在两个进程间进行上下文功换的动作.
答:总的来说,操作系统必须保存正在运行的进程的状态,恢复进程的状态。保存进程的状态主要包括CPU寄存器的值以及内存分配,上下文切换还必须执行一些确切体系结构的操作,包括刷新数据和指令缓存。
(书中答案)进程关联是由进程的PCB来表示的,它包括CPU寄存器的值和内存管理信息等。当发生上下文切换时,内核会将旧进程的关联状态保存在其PCB中,然后装入经调度要执行的新进程的已保存的关联状态。 第五章 第七版5.4 Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:(考虑下列进程集,进程占用的CPU区间长度以毫秒来计算:)
错误!未指定书签。
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.(假设在时刻0以进程P1,P2,P3,P4,P5的顺序到达。)
a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1) scheduling.(画出4个Gantt图分别演示用FCFS、SJF、非抢占优先级(数字小代表优先级高)和RR(时间片=1)算法调度时进程的执行过程。)
b. What is the turnaround time of each process for each of the scheduling algorithms in part a?(在a里每个进程在每种调度算法下的周转时间是多少?)
c. What is the waiting time of each process for each of the scheduling algorithms in part a?(在a里每个进程在每种调度算法下的等待时间是多少?) d. Which of the schedules in part a results in the minimal average waiting time (over all processes)?(在a里哪一种调度算法的平均等待时间对所有进程而言最小?) 答:作业ch6-第三题 第六章
第六版6.4 Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. In answering the questions, use nonpreemptive scheduling and base all decisions on the information you have at the time the decision must be made.
a. What is the average turnaround time for these processes with the FCFS scheduling algorithm?
b. What is the average turnaround time for these processes with the SJF scheduling algorithm?
c. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may increase. This algorithm could be known as future-knowledge scheduling. 答:
a.((8-0)+(12-0.4)+(13-1.0))/3 = 10.53 ; b.((8-0)+(13-0.4)+(9-1.0))/3 = 9.53; c.((14-0)+(6-0.4)+(2-1.0))/3 = 6.87; 第六版(理发师)第4题:
The Sleeping-Barber Problem. A barbershop consists of a waiting room with n chairs and the barber room containing the barber chair. If there are no customers to be served, the barber goes to sleep. If a customer enters the barbershop and all chairs are occupied, then the customer leaves the shop. If the barber is busy but chairs are available, then the customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the barber. Write a program to coordinate the barber and the customers. 答:作业ch7-第四题
理发师和顾客同步,理发师必须由顾客唤醒,理发师给一个顾客理发完,要让理发完的顾客退出,让等待顾客进入,顾客互斥的占用n个位置
//共享变量
semaphore Scuthair, Snumchair;// Scuthair制约理发师, Snumchair制约顾客 Scuthair=0; Snumchair=0;
barber: do {
wait(Scuthair);//检查是否有顾客,无就睡眠 给某个顾客理发
signal(Snumchair);//让理发完的顾客退出,让等待的一个顾客进入 } while (1);
Customer i:
wait(Snumchair);//申请占用椅子
signal(Scuthair);//给理发师发一个信号 坐在椅子上等着理发//共享变量
semaphore Scuthair, Mutexchair;// Scuthair给理发师 …… 此处隐藏:5398字,全部文档内容请下载后查看。喜欢就下载吧 ……
相关推荐:
- [高等教育]公司协助某村精准扶贫工作总结.doc
- [高等教育]高二生物知识点总结(全)
- [高等教育]苏教版数学三年级下册《解决问题的策略
- [高等教育]仪器分析课程学习心得
- [高等教育]2017年五邑大学数学与计算科学学院333
- [高等教育]人教版七年级下册语文第四单元测试题(
- [高等教育]2018年秋七年级英语上册Unit7Howmuchar
- [高等教育]2017年八年级下数学教学工作小结
- [高等教育]湖南省怀化市2019届高三统一模拟考试(
- [高等教育]四年级下册科学_基础训练及答案教材
- [高等教育]城郊煤矿西风井管路伸缩器更换施工安全
- [高等教育]昆八中20182019学年度上学期期末考试
- [高等教育]项目部各类人员任命书
- [高等教育]上市公司经营水务产业的模式
- [高等教育]人教版高二化学第一学期第三章水溶液中
- [高等教育]【中考物理第一轮复习资料】四.压强与
- [高等教育]金坑水电站报废改建工程机电设备更新改
- [高等教育]高中生物教学工作计划简易版
- [高等教育]2017年西华大学攀枝花学院(联合办学)44
- [高等教育]最新整理超短爆笑英文小笑话大全
- 优秀教师继续教育学习心得体会
- 阳历到阴历的转换
- 留守儿童教育案例分析
- 华师17春秋学期《玩教具制作与环境布置
- 测速传感器新型安装装置的现场应用
- 人教版小学数学三年级下册第四单元
- 创业个人意向书
- 山东省潍坊市2012年高考仿真试题(三)
- [恒心][好卷速递]四川省成都外国语学校
- 多少人错把好转反应当成了病情加重处理
- 中外广播电视史复习资料整理
- 江苏省扬州市江都区宜陵镇中学2014-201
- 工程造价专业毕业实习报告
- 广西师范学院心理与教育统计
- aympkrq基于 - asp的博客网站设计与开
- 建筑业外出经营相关流程操作(营改增后
- 人治 德治 法治
- [精华篇]常识判断专项训练题库
- 中国共产党为什么要实行民主集中
- 小学数学第三册第一单元试卷(A、B、C




