欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    《操作系统概念》典型作业解答.ppt

    • 资源ID:5025139       资源大小:268.99KB        全文页数:35页
    • 资源格式: PPT        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    《操作系统概念》典型作业解答.ppt

    Chapter 1,1.1 What are the three main purposes of an operating system?环境提供者,为计算机用户提供一个环境,使得能够在计算机硬件上方便、高效的执行程序资源分配者,为解决问题按需分配计算机的资源,资源分配需尽可能公平、高效控制程序监控用户程序的执行,防止出错和对计算机的不正当使用管理I/O设备的运行和控制,1-cont.,1.3 What is the main advantage of multiprogramming?高效地使用CPU,通过重叠来自不同用户对CPU和I/O设备的需求增加CPU的利用,设法让CPU执行有意义的指令,1-cont.,1.5 In a multiprogramming and time-sharing environment,several users share the system simultaneously.This situation can result in various security problems.a.What are two such problems?b.Can we ensure the same degree of security in a time-shared machine as we have in a dedicated machine?Explain your answer.用户之间互相偷数据、代码对系统资源使用的记账信息,1-cont.,1.6 Define the essential properties of the following types of operating systems:a.Batch相似需求的Job分批、成组的在计算机上执行,Job由操作员或自动Job程序装置装载;可以通过采用 buffering,off-line operation,spooling,multiprogramming 等技术使CPU 和 I/O不停忙来提高性能批处理适合于需要极少用户交互的Job。b.Interactive由许多短交易组成,下一次交易的结果可能不可预知需要响应时间短,1-cont.,1.6 Define the essential properties of the following types of operating systems:c.Time sharing使用CPU调度和多道程序提供对系统的经济交互式使用,CPU快速地在用户之间切换一般从终端读取控制,输出立即打印到屏幕d.Real time在专门系统中使用,从传感器读取信息,必须在规定时间内作出响应以确保正确的执行,1-cont.,1.6 Define the essential properties of the following types of operating systems:e.Network在通用OS上添加联网、通信功能远程过程调用文件共享f.Distributed具有联网、通信功能提供远程过程调用提供多处理机的统一调度调度统一的存储管理分布式文件系统,1-cont.,1.9 Describe the differences between symmetric and asymmetric multiprocessing.What are three advantages and one disadvantage of multiprocessor systems?Symmetric multiprocessing中所有处理器同等对待,I/O可以在任意CPU上处理。Asymmetric multiprocessing具有一个主CPU和多个从CPU,主CPU将任务分派到从CPU,I/O通常只能由主CPU处理。多处理机系统的优点比多个计算机系统可能更省钱(同样CPU个数)执行程序更快可靠性更高缺点:软硬件更复杂,Chapter 2,2.2 How does the distinction between monitor mode and user mode function as a rudimentary form of protection(security)system?通过建立一组只能在monitor mode才能执行的特权指令集,OS能够确保总是能控制整个系统。,2-cont.,2.3 What are the differences between a trap and an interrupt?What is the use of each function?An interrupt是硬件产生的系统内的流的改变A trap是软件产生的“中断”。interrupt可以被I/O用来产生完成的信号,从而避免CPU对设备的轮询 A trap可以用来调用OS的例程或者捕获算术错误,2-cont.,2.5 Which of the following instructions should be privileged?a.Set value of timer.b.Read the clock.c.Clear memory.d.Turn off interrupts.e.Switch from user to monitor mode.a.Set value of timer.c.Clear memory.d.Turn off interrupts.e.Switch from user to monitor mode.,2-cont.,2.8 Protecting the operating system is crucial to ensuring that the computer system operates correctly.Provision of this protection is the reason behind dual-mode operation,memory protection,and the timer.To allow maximum flexibility,however,we would also like to place minimal constraints on the user.The following is a list of operations that are normally protected.What is the minimal set of instructions that must be protected?a.Change to user mode.b.Change to monitor mode.c.Read from monitor memory.d.Write into monitor memory.e.Fetch an instruction from monitor memory.f.Turn on timer interrupt.g.Turn off timer interrupt.b.Change to monitor mode.c.Read from monitor memory.d.Write into monitor memory.g.Turn off timer interrupt.,Chapter 3,3.1 What are the five major activities of an operating system in regard to process management?用户和系统进程地创建和删除 进程的挂起和恢复 提供进程同步的机制 提供进程通信的机制 提供死锁处理的机制,3-cont.,3.2 What are the three major activities of an operating system in regard to memory management?跟踪内存使用情况(哪一部分被使用、谁使用)当内存空间可用的时候,确定将哪些进程调入内存(job调度)按需要分配和回收内存,3-cont.,3.3 What are the three major activities of an operating system in regard to secondary-storage management?剩余空间的管理存储分配磁盘调度,3-cont.,3.4 What are the five major activities of an operating system in regard to file management?文件创建和删除目录创建和删除目录和文件操作原语的支持文件到二级存储的映射将文件备份到非易失存储设备,3-cont.,3.5 What is the purpose of the command interpreter?Why is it usually separate from the kernel?读取命令(从用户或者命令文件)并执行(转化成系统调用)可能会经常改变,3-cont.,3.7 What is the purpose of system calls?让用户级进程可以请求操作系统所提供的服务,3-cont.,3.10 What is the purpose of system programs?为程序开发和运行提供了方便的环境给用户提供基本的公共功能函数,为用户在不用自己写代码的情况下解决公用问题试着安装虚拟机VMWARE,然后在这台虚拟机上安装一个操作系统阅读Linux源码,给出某一个system call的源码并分析,分析init/main.c给出流程图,Chapter 4,4.2 Describe the differences among short-term,medium-term,and long-term scheduling.Short-term,CPU调度Long-term,job调度Medium-term,分时系统中的中间调度级,4-cont.,4.4 Describe the actions a kernel takes to context switch between processes.保存正在运行的进程的状态、恢复欲调度到CPU进程的状态,4-cont.,4.5 What are the benefits and detriments of each of the following?Consider both the systems and the programmers levels.a.Symmetric and asymmetric communicationb.Automatic and explicit bufferingc.Send by copy and send by referenced.Fixed-sized and variable-sized messages,4-cont.,4.6 The correct producerconsumer algorithm in Section 4.4 allows only n-1 buffers to be full at any one time.Modify the algorithm to allow all buffers to be utilized fully.,4-cont.,4.7 Consider the interprocess-communication scheme where mailboxes are used.a.Suppose a process P wants to wait for two messages,one from mailbox A and one from mailbox B.What sequence of send and receive should it execute?b.What sequence of send and receive should P execute if P wants to wait for one message either from mailbox A or from mailbox B(or from both)?c.A receive operation makes a process wait until the mailbox is nonempty.Either devise a scheme that allows a process to wait until a mailbox is empty,or explain why such a scheme cannot exist.areceive(A,m1)receive(B,m2)send(c,m3)receive(B,m1)receive(A,m2)send(c,m3)breceive(A,m1)receive(B,m2)send(c,m3)receive(B,m1)receive(A,m2)send(c,m3)receive(A,m1)send(c,m3)receive(B,m2)receive(B,m1)send(c,m3)receive(A,m2),4-cont.,阅读分析Linux终止进程的源码编程,实现一个简单网络聊天程序,用到socket和fork()(接受和发送在fork出的进程中),Chapter 5,5.1 Provide two programming examples of multithreading giving improved performance over a single-threaded solution.可以并发的多任务Web浏览器,数据可并行处理5.2 Provide two programming examples of multithreading that would not improve performance over a single-threaded solution.不可以并发的单任务用多个线程读一个文件后续的结果必须依赖于前面的,5 cont.,5.3 What are two differences between user-level threads and kernel-level threads?Under what circumstances is one type better than the other?内核可知与不可知调度者不同与进程的关系运行效率、内核复杂度、用户可控程度5.6 What resources are used when a thread is created?How do they differ from those used when a process is created?,5 cont.,5.6 What resources are used when a thread is created?How do they differ from those used when a process is created?TCB,寄存器组,栈,调度信息PCB,所有与进程执行和调度相关的资源与信息,内存,打开的文件,环境变量,5-cont.,5.9 Write a multithreaded Pthread or Java program that outputs prime numbers.This program should work as follows:The user will run the program and will enter a number on the command line.The program will then create a separate thread that outputs all the prime numbers less than or equal to the number that the user entered.编程,实现一个简单网络聊天程序,用到socket和pthread(接受和发送在pthread创建的线程中),Chapter 6,6.1 A CPU scheduling algorithm determines an order for the execution of its scheduled processes.Given n processes to be scheduled on one processor,how many possible different schedules are there?Give a formula in terms of n.N个进程的排列问题Pnn=n!6.2 Define the difference between preemptive and nonpreemptive scheduling.State why strict nonpreemptive scheduling is unlikely to be used in a computer center.对CPU控制权的主动还是被动放弃不可能采用纯非剥夺机制:考虑到多道程序、分时共享,公平和轻重缓急,6-cont.,6.3 Consider the following set of processes,with the length of the CPU-burst time given in milliseconds:The processes are assumed to have arrived in the order P1,P2,P3,P4,P5,all at time 0.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.b.What is the turnaround time of each process for each of the scheduling algorithms in part a?c.What is the waiting time of each process for each of the scheduling algorithms in part a?d.Which of the schedules in part a results in the minimal average waiting time(over all processes)?,6-cont.,6.3 a.b.c.d.SJF,6-cont.,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?(8-0)+(12-0.4)+(13-1.0)/3=10.53 b.What is the average turnaround time for these processes with the SJF scheduling algorithm?(8-0)+(13-0.4)+(9-1.0)/3=9.53c.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.(14-0)+(6-0.4)+(2-1.0)/3=6.87,6-cont.,6.7 Consider the following preemptive priority-scheduling algorithm based on dynamically changing priorities.Larger priority numbers imply higher priority.When a process is waiting for the CPU(in the ready queue but not running),its priority changes at a rate A;when it is running,its priority changes at a rate B.All processes are given a priority of 0 when they enter the ready queue.The parameters A and B can be set to give many different scheduling algorithms.a.What is the algorithm that results from BA0?b.What is the algorithm that results from AB0?FCFSLIFO,6-cont.,6.8 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 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(最短job优先级最高)b.Multilevel feedback queues and FCFS(MLFQ的最低级是FCFS)c.Priority and FCFS(FCFS给存在时间最长的优先级最高)d.RR and SJF(none),6-cont.,6.9 Suppose that a scheduling algorithm(at the level of short-term CPU scheduling)favors those processes that have used the least processor time in the recent past.Why will this algorithm favor I/O-bound programs and yet not permanently starve CPU-bound programs?阅读分析Linux sched.c,

    注意事项

    本文(《操作系统概念》典型作业解答.ppt)为本站会员(牧羊曲112)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开