logo
  • write-homewrite-home-active首页
  • icon-chaticon-chat-activeAI 智能助手
  • icon-pluginicon-plugin-active浏览器插件
  • icon-subjecticon-subject-active学科题目
  • icon-uploadicon-upload-active上传题库
  • icon-appicon-app-active手机APP
首页
/
计算机
题目

as a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) manage- ment of the operation and control of i/o devices.? 环境提供者,为计算机用户提供一个环境,使得能够在计算机硬件[1]上方便、高效的执行程序 ? 资源分配者,为解决问题按需分配计算机的资源,资源分配[2]需尽可能公平、高效 ? 控制程序监控用户程序的执行,防止出错和对计算机的不正当使用管理i/o设备的运行和控制1.6 define the essential properties of the following types of operating systems: a. batchb. interactive c. time sharing d. real time e. networkf. distributeda. batch. jobs with similar needs are batched together and run through the computer as a group by an operator or automatic job sequencer. performance is increased by attempting to keep cpu and i/o devices busy at all times through buffering, off-line operation, spooling, and multiprogramming. batch is good for executing large jobs that need little interaction; it can be submitted and picked up later.b. interactive. this system is composed of many short transactions where the results of the next transactionmay be unpredictable. response time needs to be short (seconds) since the user submits and waits for the result.c. time sharing.thissystemsuses cpu scheduling and multiprogramming to provide economical interactive use of a system. the cpu switches rapidly from one user toanother. instead of having a job de?ned by spooled card images, each program readsits next control card from the terminal, and output is normally printed immediately to the screen.d. real time. often used in a dedicated application, this system reads information from sensors and must respond within a ?xed amount of time to ensure correct perfor- mance.e. network.f. distributed.this system distributes computation among several physical processors. the processors do not share memory or a clock. instead, each processor has its own local memory. they communicate with each other through various communication lines, such as a high-speed bus or telephone line.a. batch相似需求的job分批、成组的在计算机上执行,job由操作员或自动job程序装置装载;可以通过采用 buffering, off-line operation, spooling, multiprogramming 等技术使cpu 和 i/o不停忙来提高性能批处理[3]适合于需要极少用户交互的job。 b. interactive由许多短交易组成,下一次交易的结果可能不可预知需要响应时间短 c. time sharing使用cpu调度和多道程序[4]提供对系统的经济交互式使用,cpu快速地在用户之间切换 一般从终端读取控制,输出立即打印到屏幕 d. real time在专门系统中使用,从传感器读取信息,必须在规定时间内作出响应以确保正确的执行 e. network 在通用os上添加 联网、通信功能 远程过程调用[5] 文件共享f. distributed 具有联网、通信功能 提供远程过程调用提供多处理机的统一调度调度 统一的存储管理[6] 分布式文件系统[7]2.3 what are the differences between a trap and an interrupt? what is the use of each function?answer: an interrupt is a hardware-generated change-of-?ow within the system. aninterrupt handler is summoned to deal with the cause of the interrupt; control is then re-turned to the interrupted context and instruction. a trap is a software-generated interruptan interrupt can be used to signal the completion of an i/o to obviate the need for device polling. a trap can be used to call operating system routines or to catch arithmetic errors.an interrupt是硬件产生的系统内的流的改变 a trap是软件产生的“中断”。interrupt可以被i/o用来产生完成的信号,从而避免cpu对设备的轮询[8] a trap可以用来调用os的例程[9]或者捕获算术错误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.answer: the following instructions should be privileged: a. set value of timer. b. clear memory.c. turn off interrupts.d. switch from user to monitor mode.3.7 what is the purpose of system calls?answer: system calls allow user-level processes to request services of the operating sys- tem.让用户级进程可以请求操作系统所提供的服务6.3 consider the following set of processes, with the length of the cpu-burst time given inmilliseconds: processbursttime priorityp110 3 p21 1 p323 p41 4 p55 2the 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 allprocesses)?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 leftcarefully in the following settings: a. mainframe or minicomputer systems b. workstations connected to serversc. handheld computersanswer:a. mainframes:memory and cpu resources, storage, network bandwidth.b. workstations: memory and cpu resoucesc. handheld computers: power consumption, memory resources.1.3 under what circumstances would a user be better off using a timesharing system rather than a pc or single-user workstation?answer: when there are few other users, the task is large, and the hardware is fast, time-sharingmakes sense. the full power of the system can be brought to bear on the user’s problem. the problemcan be solved faster than on a personal computer. another case occurs when lots of other users need resources at the same time.a personal computer is best when the job is small enough to be executed reasonably on it and when performance is sufficient to execute the program to the user’s satisfaction.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. 10.53 ((8-0)+(12-0.4)+(13-1.0))/3 = 10.53 b. 9.53 ((8-0)+(13-0.4)+(9-1.0))/3 = 9.53c. 6.86 ((14-0)+(6-0.4)+(2-1.0))/3 = 6.877.8 the sleeping-barber problem. a barbershop consists of a waiting room with n chairsand 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.理发师和顾客同步,理发师必须由顾客唤醒,理发师给一个顾客理发完,要让理发完的顾客退出,让等待顾客进入,顾客互斥的占用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给理发师, mutexchair制约顾客对椅子的互斥占领int number = 0;/顾客的共享变量,记录已经有的顾客数 scuthair=0; mutexchair =1;customer i:wait(mutexchair);/申请对共享变量number的操作(申请占用椅子) if(number = = n-1)(signal(mutexchair); exit;) number = number +1;signal(scuthair);/给理发师发一个信号 signal(mutexchair); 等待理发? 理发完毕?wait(mutexchair);/申请对共享变量number的操作 number = number -1; signal(mutexchair); 离开理发店barber: do (wait(scuthair);/检查是否有顾客,无,就睡眠给某个顾客理发 ) while (1);8.13consider the following snapshot of a system:p0 p1 p2 p3 p4allocation a b c d 0 0 1 2 1 0 0 0 1 3 5 4 0 6 3 2 0 0 1 4max a b c d 0 0 1 2 1 7 5 0 2 3 5 6 0 6 5 2 0 6 5 6available a b c d 1 5 2 0answer the following questions using the banker’s algorithm: a. what is the content of the matrix need? b. is the system in a safe state?[篇三:操作系统概念第七版4-6章课后题答案(中文版)]举两个多线程[10]程序设计的例子来说明多线程不比单线程方案提高性能

as a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) manage- ment of the operation and control of i/o devices.

? 环境提供者,为计算机用户提供一个环境,使得能够在计算机硬件[1]上方便、高效的执行程序 ? 资源分配者,为解决问题按需分配计算机的资源,资源分配[2]需尽可能公平、高效 ? 控制程序

监控用户程序的执行,防止出错和对计算机的不正当使用管理i/o设备的运行和控制

1.6 define the essential properties of the following types of operating systems: a. batch

b. interactive c. time sharing d. real time e. network

f. distributed

a. batch. jobs with similar needs are batched together and run through the computer as a group by an operator or automatic job sequencer. performance is increased by attempting to keep cpu and i/o devices busy at all times through buffering, off-line operation, spooling, and multiprogramming. batch is good for executing large jobs that need little interaction; it can be submitted and picked up later.

b. interactive. this system is composed of many short transactions where the results of the next transactionmay be unpredictable. response time needs to be short (seconds) since the user submits and waits for the result.

c. time sharing.thissystemsuses cpu scheduling and multiprogramming to provide economical interactive use of a system. the cpu switches rapidly from one user to

another. instead of having a job de?ned by spooled card images, each program readsits next control card from the terminal, and output is normally printed immediately to the screen.

d. real time. often used in a dedicated application, this system reads information from sensors and must respond within a ?xed amount of time to ensure correct perfor- mance.

e. network.

f. distributed.this system distributes computation among several physical processors. the processors do not share memory or a clock. instead, each processor has its own local memory. they communicate with each other through various communication lines, such as a high-speed bus or telephone line.

a. batch

相似需求的job分批、成组的在计算机上执行,job由操作员或自动job程序装置装载;

可以通过采用 buffering, off-line operation, spooling, multiprogramming 等技术使cpu 和 i/o不停忙来提高性能

批处理[3]适合于需要极少用户交互的job。 b. interactive

由许多短交易组成,下一次交易的结果可能不可预知

需要响应时间短 c. time sharing

使用cpu调度和多道程序[4]提供对系统的经济交互式使用,cpu快速地在用户之间切换 一般从终端读取控制,输出立即打印到屏幕 d. real time

在专门系统中使用,从传感器读取信息,必须在规定时间内作出响应以确保正确的执行 e. network 在通用os上添加 联网、通信功能 远程过程调用[5] 文件共享

f. distributed 具有联网、通信功能 提供远程过程调用

提供多处理机的统一调度调度 统一的存储管理[6] 分布式文件系统[7]

2.3 what are the differences between a trap and an interrupt? what is the use of each function?

answer: an interrupt is a hardware-generated change-of-?ow within the system. an

interrupt handler is summoned to deal with the cause of the interrupt; control is then re-turned to the interrupted context and instruction. a trap is a software-generated interrupt

an interrupt can be used to signal the completion of an i/o to obviate the need for device polling. a trap can be used to call operating system routines or to catch arithmetic errors.

an interrupt是硬件产生的系统内的流的改变 a trap是软件产生的“中断”。

interrupt可以被i/o用来产生完成的信号,从而避免cpu对设备的轮询[8] a trap可以用来调用os的例程[9]或者捕获算术错误

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.

answer: the following instructions should be privileged: a. set value of timer. b. clear memory.

c. turn off interrupts.

d. switch from user to monitor mode.

3.7 what is the purpose of system calls?

answer: system calls allow user-level processes to request services of the operating sys- tem.

让用户级进程可以请求操作系统所提供的服务

6.3 consider the following set of processes, with the length of the cpu-burst time given in

milliseconds: processbursttime priority

p110 3 p21 1 p323 p41 4 p55 2

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.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

carefully in the following settings: a. mainframe or minicomputer systems b. workstations connected to serversc. handheld computers

answer:

a. mainframes:memory and cpu resources, storage, network bandwidth.

b. workstations: memory and cpu resouces

c. handheld computers: power consumption, memory resources.

1.3 under what circumstances would a user be better off using a timesharing system rather than a pc or single-user workstation?

answer: when there are few other users, the task is large, and the hardware is fast, time-sharingmakes sense. the full power of the system can be brought to bear on the user’s problem. the problemcan be solved faster than on a personal computer. another case occurs when lots of other users need resources at the same time.

a personal computer is best when the job is small enough to be executed reasonably on it and when performance is sufficient to execute the program to the user’s satisfaction.

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. 10.53 ((8-0)+(12-0.4)+(13-1.0))/3 = 10.53 b. 9.53 ((8-0)+(13-0.4)+(9-1.0))/3 = 9.53

c. 6.86 ((14-0)+(6-0.4)+(2-1.0))/3 = 6.87

7.8 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.

理发师和顾客同步,理发师必须由顾客唤醒,理发师给一个顾客理发完,要让理发完的顾客退出,让等待顾客进入,顾客互斥的占用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给理发师, mutexchair制约顾客对椅子的互斥占领

int number = 0;//顾客的共享变量,记录已经有的顾客数 scuthair=0; mutexchair =1;

customer i:

wait(mutexchair);//申请对共享变量number的操作(申请占用椅子) if(number = = n-1){signal(mutexchair); exit;} number = number +1;

signal(scuthair);//给理发师发一个信号 signal(mutexchair); 等待理发? 理发完毕?

wait(mutexchair);//申请对共享变量number的操作 number = number -1; signal(mutexchair); 离开理发店

barber: do {

wait(scuthair);//检查是否有顾客,无,就睡眠给某个顾客理发 } while (1);

8.13

consider the following snapshot of a system:

p0 p1 p2 p3 p4

allocation a b c d 0 0 1 2 1 0 0 0 1 3 5 4 0 6 3 2 0 0 1 4

max a b c d 0 0 1 2 1 7 5 0 2 3 5 6 0 6 5 2 0 6 5 6

available a b c d 1 5 2 0

answer the following questions using the banker’s algorithm: a. what is the content of the matrix need? b. is the system in a safe state?

[篇三:操作系统概念第七版4-6章课后题答案(中文版)]

举两个多线程[10]程序设计的例子来说明多线程不比单线程方案提高性能

题目解答

答案

答:1)任何形式的顺序程序对线程来说都不是一个好的形式。例如一个计算个人报酬

的程序。

2)另外一个例子是一个“空壳”程序,如c-shell和korn shell。这种程序

必须密切检测其本身的工作空间。如打开的文件、环境变量和当前工作目录。

4.2描述一下线程库采取行动进行用户级线程上下文切换[11]的过程

答:用户线程之间的上下文切换和内核线程之间的相互转换是非常相似的。但它依赖于

线程库和怎样把用户线程指给内核程序。一般来说,用户线程之间的上下文切换涉

及到用一个用户程序的轻量级进程(lwp)和用另外一个线程来代替。这种行为通

常涉及到寄存器[12]的节约和释放。

4.3在哪些情况下使用多内核线程的多线程方案比单处理器系统的单个线程方案提供更好

的性能。 答:当一个内核线程的页面发生错误时,另外的内核线程会用一种有效的方法被转换成

使用交错时间。另一方面,当页面发生错误时,一个单一线程进程将不能够发挥有

效性能。因此,在一个程序可能有频繁的页面错误或不得不等待其他系统的事件的

情况下,多线程方案会有比单处理器系统更好的性能。

4.4以下程序中的哪些组成部分在多线程程序中是被线程共享的? a.寄存值 b.堆内存 c.全局变量[13]

d.栈内存 答:一个线程程序的线程共享堆内存和全局变量,但每个线程都有属于自己的一组寄存值和栈内存。

4.5一个采用多用户线程的多线程方案在多进程系统中能够取得比在单处理器系统中更好

的性能吗?

答:一个包括多用户线程的多线程系统无法在多处理系统上同时使用不同的处理器。

操作系统只能看到一个单一的进程且不会调度在不同处理器上的不同进程的线程。因此,多处理器[14]系统执行多个用户线程是没有性能优势的。

4.6就如4.5.2章节描述的那样,linux没有区分进程和线程的能力。且linux线程都

是用相同的方法:允许一个任务与一组传递给clone()系统调用[15]的标志的进程或线程。但许多操作系统,例如windows xp和solaris,对进程和线程都是一视同仁。基本上,这种使用notation的系统,一个进程的数据结构包括一个指向属于进程的不同线程的指针。区别建模过程和在内核中线程的两种方法。

答:一方面,进程和线程被视为相似实体的系统中,有些系统代码可以简化。例如,

一个调度器可以在平等的基础上考虑不同的进程和线程,且不需要特殊的代码,在调度中审查有关线程的进程。另一方面,这种统一会使进程资源限制更加困难。相反,一些额外的复杂性被需要,用来确定哪个线程与哪个进程一致和执行重复的计数任务。

4.7由4.11给出的程序使用了pthread的应用程序编程接口(api),在程序的第c行

和第p行分别会输出什么? 答:c行会输出5,p行会输出0.

4.8考虑一个多处理器系统和用多线程对多线程模式编写的多线程程序。让程序中的用户线程数量多于系统中的处理器的数量,讨论下列情况下的性能意义: a.由程序分配的内核线程的数量比处理器少 b. 由程序分配的内核线程的数量与处理器相同

c. 由程序分配的内核线程的数量大于处理器数量但少于用户线程的数量

答:当内核线程的数量少于处理器时,一些处理器将仍然处于空闲状态。因为,调度图中

只有内核线程的处理器,而不是用户线程的处理器。当程序分配的内核线程的数量

与处理器相同时,那么有可能所有处理器将同时使用。然而,当一个内核块内的内核(因页面错误或同时援引系统调用)相应的处理器将闲置。当由程序分配的内核线程的数量大于处理器数量时,封锁一个内核线程并调出,换入另一个准备执行的内核线程。因此,增加多处理器系统的利用率。

相关问题

  • 程序=算法+()A. 数据结构B. 程序结构C. 控制结构[1]D. 体系结构

  • 网络安全包括物理安全[1]、逻辑安全、操作系统安全及联网安全,其中逻辑安全包括访问控制[2]、加密、安全管理及用户身份认证。A. 正确B. 错误

  • 路径排序算法的工作流程主要有三步()A. 特征计算B. 特征抽取C. 分类器训练D. 因果推断

  • 下列哪项不是求解对抗搜索问题的基本算法( ) A.反向传播算法 B.广度优先排序算法 C.Alpha-Beta剪枝算法D.最小最大搜索算法

  • 网络安全包括物理安全[1]、逻辑安全、操作系统安全及联网安全,其中逻辑安全包括访问控制[2]、加密、安全管理及用户身份认证。A. 正确B. 错误

  • 3.判断题K-means聚类算法对数据的尺寸敏感。()A. 对B. 错

  • 下列不属于量子机器学习算法的是()A. 量子支持向量机B. 量子主成分分析C. 薛定谔方程求解D. 深度量子学习

  • 2.单选题 讯飞星火可以实现多种文案类型和语言风格的文本写作。讯飞星火(网页版)“内容写作”功能可选的“语言风格”不包括( )。A. 口语化B. 高情商C. 专业D. 热情

  • 网络诈骗中常见的“钓鱼网站”目的是()?A. 传播病毒B. 窃取个人信息C. 提供免费电影

  • 7、 加强电脑安全防护,及时升级病 毒库,安装防火墙,及时查杀病毒和木马,是防范 电信网络诈骗的有效做法。A. 正确B. 错误

  • 以下哪种方法属于卷积神经网络的基本组件()。A. 卷积层B. 池化层C. 激活函数D. 复制层

  • 下列哪项贪婪最佳优先搜索算法的描述正确()A. 贪婪最佳优先搜索不属于启发式搜索算法B. 贪婪最佳优先搜索是一种A*搜索算法C. 贪婪最佳优先搜索是一种广度优先搜索算法D. 贪婪最佳优先搜索属于有信息搜索算法

  • 下列哪个方法属于知识图谱推理方法()A. 路径排序算法B. 深度学习推断C. 广度优先搜索D. 归纳逻辑程序设计

  • Windows中“复制”操作的快捷键是Ctrl+V。

  • 由脸书(Facebook)公司开发的深度学习编程框架是()A. TensorFlowB. PaddlePaddleC. PyTorchD. Mindspore

  • 下列哪项属于因果推理模型()A. 因果图B. 神经符号推理C. 符号推理模型D. 结构因果模型

  • 下列哪个方法属于知识图谱推理方法()A. 广度优先搜索B. 深度学习推断C. 路径排序算法D. 归纳逻辑程序设计

  • AdaBoosting采用多个单一分类器组成一个强分类器()A. 错误B. 正确

  • 下列哪项关于监督学习算法的描述正确()A. 强化学习的训练效果一定优于监督学习B. 主要的监督学习方法包括生成方法和判别方法C. 广度优先搜索算法是一种监督学习算法

  • 在决策树建立过程中,使用一个属性对某个结点对应的数集合进行划分后,结果具有高信息熵(highentropy),对结果的描述,最贴切的是()。A. 纯度高B. 纯度低C. 有用D. 无用E. 以上描述都不贴切

上一页下一页
logo
广州极目未来文化科技有限公司
注册地址:广州市黄埔区揽月路8号135、136、137、138房
关于
  • 隐私政策
  • 服务协议
  • 权限详情
学科
  • 医学
  • 政治学
  • 管理
  • 计算机
  • 教育
  • 数学
联系我们
  • 客服电话: 010-82893100
  • 公司邮箱: daxuesoutijiang@163.com
  • qt

©2023 广州极目未来文化科技有限公司 粤ICP备2023029972号    粤公网安备44011202002296号