




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
10北京邮电大学2011-2012学年第一学期计算机科学与技术学院(09405-08408)“Operating Systems” Test(1)1. (10 points) Describe the principle of signals Answers: Unix、Linux等操作系统提供的一种基于事件驱动的进程间通信机制。当系统内发生某种特定事件时,OS将产生1个信号,并以信号方式通知特定进程;当进程收到信号后,将转入内核态下的信号处理程序,以响应所发生的事件,对其进行处理。2. (10 points) Describe the principle of pipe-based inter-process communications. Answer:是一种OS提供的基于共享文件的进程间通信方式。2个需要进行通信的进程共享1个称为管道的文件,发送方通过执行“写文件”系统调用向管道中写入数据,接收方通过“读文件”系统调用从管道中读取数据,传递的数据为无格式字节流,由此实现2个进程间数据量通信。OS提供了管道的创建/打开/关闭/读写等原语。或(书上):相互通信进程由1个共享文件管道连接。管道是用于连接读进程和写进程、实现它们之间通信的软件,向管道提供输入的发送进程以字符流形式将数据批量写入管道,接收进程从管道中读取数据。3. (25 points) In a computer system, the users submit to the system their computational tasks as jobs, and all these jobs are then stored as the standby jobs on the disk. The job scheduler (also known as long-term scheduler) selects the standby jobs on the disk, creates new processes in memory for them, and then starts executing these processes. Each jobs ID is the same as that of the process created for it, for example, Ji and Pi. When the number of concurrent processes in memory is lower than three, the job scheduler takes the FCFS algorithm to select a standby job on the disk to create a new process. Otherwise, the processes should wait in the disk.For the processes in memory, the process scheduler (also known as short-term scheduler) takes the non-preemptive priority-based algorithm to select a process and allocates the CPU to it. It is assumed the system costs resulting from job and process scheduling are omitted. Consider the following set of Jobs J1, J2, J3 , J4 and J5. For 1 i 5, the arrival time of each Ji , the length of the CPU burst time of each process Pi, and the priority number for each Ji/Pi are given as below, and a smaller priority number implies a higher priority. Job Arrival Time Burst Time Priority Number (minute) J1 14:00 40 4 J2 14:20 30.01 2 J3 14:30 50.01 3 J4 14:50 20.01 5 J5 15:05 10.01 5 (1) Illustrate the execution of each job/process by charts. (2) What is the turnaround time of each job?(3) What is the waiting time of each job? Note: The waiting time of a job includes the time it waits on the disk and that it waits in memory.Answer:答案:(1)注:图中Ji部分表示作业被调入内存,Pi表示进程被调度执行。J1到达时,并发进程数3,作业被直接调入内存,创建进程P1;P1被调度程序选中,开始执行。J2到达时,并发进程数3,作业被直接调入内存,创建进程P2;此时P1在执行,因此P2处于就绪等待状态。P1结束后,系统内有2个作业J1、J2对应的进程P1、P2,优先级高的进程P2开始执行。J3到达时,并发进程数=23,作业被直接调入内存,创建进程P3,等待P2执行完毕。P2执行完毕后,系统内有2个作业J3、J4对应的进程P3、P4,优先级高的进程P3被调度程序选中,开始执行。J4到达时,并发进程数=23,作业被直接调入内存,创建进程P4,等待P3执行完毕。P3执行完毕后,系统内有2个作业J4、J5对应的进程P4、P5,2者的优先级相同,按照FCFS原则,P4先执行。J5到达时,并发进程数=3,必须等到P2结束后,系统内并发进程数2) processes. . Answers:具体参见讲义第6章n Shared datan boolean choosingn; /* choosingi=true: Pi begins/wants to apply for ticket*/ n int numbern; /* numberi: ticket# for Pi , numberi0 表示Pi需要进入临界区: */n data structures are initialized to false and 0 respectivelyProcess Pi:do choosingi = true; /*begin to apply for ticket*/numberi = max(number0, number1, , numbern 1) + 1; /* a ticket whose number is maximum is given , first come first given, in non-decreasing order */choosingi = false; /* end application */ for (j = 0; j n; j+) /*考虑所有进程*/ while (choosingj) ; /*如有其它进程正在申请,等待Pj 申请完*/while (numberj != 0) & (numberj, j) P1 (2,3,2) P2 (4,6,4) P3 (5,6,5)or:P1 (
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024内蒙古融信科技服务有限公司公开招聘人员6人笔试参考题库附带答案详解
- 2024中石油(上海)新材料研究院发布高层次人才招聘笔试参考题库附带答案详解
- 二年级语文下册 课文4 14 小马过河第2课时教学设计 新人教版
- 2025年江苏省徐州市铜山区中考一模道德与法治试题(原卷版+解析版)
- 2024北京一七一中初一(下)期中语文试题及答案
- 绿色旅游发展策略
- 立秋节气教育实施
- 2025合同授权委托书模板
- 行业数据:中国数字胰岛素冷藏箱市场现状研究分析与发展前景预测报告
- 慢病规范化管理
- 医疗美容病历模板范文
- 2018年四川省高考数学试卷(文科)(全国新课标Ⅲ)
- 前列腺增生患者的护理查房课件
- 2023年四川农信(农商行)招聘笔试真题
- 苏教版五年级下册数学期中考试试卷含答案
- 陕煤集团榆林化学有限责任公司招聘笔试题库2024
- 呼兰河传(2022年黑龙江牡丹江中考语文试卷记叙文阅读题及答案)
- 小学英语“教学评一体化”实施
- 人教版道德与法治三年级下册全册课件(完整版)
- 2024年中考英语作文热点主题:人工智能满分范文10篇精彩表达25句
- 2024Growatt 15000-25000UE古瑞瓦特光伏逆变器用户手册
评论
0/150
提交评论