已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 机械设计制造及其自动化专业职业生涯规划书
- 《儿童巨细胞病毒感染专科护理》
- 事情现场控制安保人员预案
- 数据存储与恢复解决方案
- 环保理念从小事做起小学主题班会课件
- 环保行业工业废水处理技术升级方案
- 建筑公司幕墙工程验收标准流程手册
- 建筑工程预算编制流程规范方案
- 办公设备维护与维修流程指南
- 供应商付款安排通知函2026年5篇
- 施工现场迎检布置实施方案
- GB/T 1969-2026多孔陶瓷渗透率试验方法
- 2026贵州省专业技术人员继续教育公需科目考试题库
- 2026年重庆市中考历史真题(原卷版+解析版)
- 2025-2026学年广东省梅州市五华县八年级下册期末数学试题 含答案
- 2026年高考陕晋青宁卷地理高考真题试题(含答案解析)
- 2026年黑龙江、吉林、辽宁、内蒙古高考物理试卷(含答案及解析)
- 2026上海市检察系统辅助文员招聘考试参考试题及答案解析
- 高处作业安全管理程序
- GB/T 7134-2008浇铸型工业有机玻璃板材
- 认知障碍评定与康复版课件
评论
0/150
提交评论