




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 全国青岛版信息技术九年级上册第4单元第3课《VJC1.6编程软件简介》说课稿
- 一、功说课稿-2025-2026学年初中物理北师大版北京八年级全一册-北师大版北京2013
- 2.1 文字处理教学设计初中信息技术重大版2019七年级上册-重大版2019
- 第6课 战国时期的社会变革(说课稿)2024-2025学年七年级历史上册同步高效课堂(统编版2024)
- 岗位安全责任协议书范例
- 补充合同协议的样本
- 第一节 ATP和酶说课稿-2025-2026学年高中生物苏教版必修1分子与细胞-苏教版
- Unit 1 What did you put in your bag 教学设计-2025-2026学年小学英语五年级下册外研版(一起)
- 物业安全巡逻与隐患排查标准
- 工业冷却塔设计与水处理技术方案
- 2025年中级制图员《理论知识》考试真题(含新版解析)
- 广东省2025年度初级注册安全工程师职业资格考试金属非金属矿山安全复习题及答案
- 小学教师网络信息安全管理规范
- 惊恐障碍课件
- 视频监控巡查管理办法
- 银行招聘考试题目及答案
- 房地产渠道销售代理合同范本
- 十二经络课件
- Starter Unit 3 Welcome 单元测试(含答案)人教版(2024)七年级英语上册
- 糖尿病患者抗感染管理要点
- 《国际法的基本原则与实践:大学法律课程教案》
评论
0/150
提交评论