计算机概论第十章

Answers are in blue.

Computer Science Illuminated, Seventh EditionNell Dale, PhD; John Lewis, PhD

CHAPTER 10

EXERCISES AND ANSWERS

For Exercises 1–18, mark the answers true and false as follows:
  1. True
  2. False
    1. An operating system is an example of application software. B系统软件
    2. An operating system provides a basic user interface that allows the user to use the computer.

    1. A computer can have more than one operating system, but only one OS is in control at any given time.

A

    1. Multiprogramming is the technique of using multiple CPUs to run programs.

B

    1. In the 1960s and 1970s, a human operator would organize similar computer jobs into batches to be run.

A

    1. Batch processing implies a high level of interaction between the user and the program.

B

    1. A timesharing system allows multiple users to interact with a computer at the same time.

A

    1. A dumb terminal is an I/O device that connects to a main- frame computer.

A

    1. A logical address specifies an actual location in main memory. B
    2. An address in a single contiguous memory management sys- tem is made up of a page and an offset.

B

    1. In a fixed partition system, main memory is divided into sev- eral partitions of the same size.

B

    1. The bounds register contains the last address of a partition. B It contains the length of the partition.
    2. The first page in a paged memory system is page 0. A
    3. A process in the running state is currently being executed by the CPU.

A

 
    1. The process control block (PCB) is a data structure that stores all information about a process.

A

    1. CPU scheduling determines which programs are in memory. B
    2. The first-come, first-served scheduling algorithm is provably optimal.

B

    1. A time slice is the amount of time each process is given before being preempted in a round-robin scheduler.

A

操作系统是应用软件的一个例子。B

操作系统提供了一个基本的用户界面,允许用户使用计算机。A

一台计算机可以安装多个操作系统,但在任何给定时间只有一个操作系统控制。A

多道程序设计是利用多个CPU运行程序的技术。B

多个CPU?确定不是驻留多个程序竞争CPU

在20世纪60年代和70年代,一个人类操作员会将相似的计算机作业组织成批次运行。A

批处理处理意味着用户与程序之间有很高的互动水平。B

不是这样的吧,批处理只是方便

分时系统允许多个用户同时与计算机交互。A

哑终端是连接到主机计算机的I/O设备。A

逻辑地址指定主存中的实际位置。B物理地址才是

在单一连续内存管理系统中,地址由页面和偏移量组成。B

这个我不太懂就不误人子弟了,课本上好像是逻辑由页编号和偏移量组成,这个位置是在页式管理系统里的,我觉得不是单一连续内存管理系统

在固定分区系统中,主存被划分为几个相同大小的分区。B

大小可以不同,课本说

边界寄存器包含分区的最后地址。B 它包含分区的长度。

界限是长度,就算是基址,也是起始位置

在分页内存系统中,第一页是页面0。A

运行状态的进程当前正在由CPU执行。A

进程控制块(PCB)是一个存储有关进程的所有信息的数据结构。A

CPU调度确定哪些程序在内存中。B

?应该是哪些程序什么时候可以访问CPU罢

先来先服务的调度算法被证明是最优的。B不是

时间片是在轮转调度程序中每个进程在被抢占之前被分配的时间。A

For Exercises 19–23 , match the operating system with information about it.

  1. MacOS
  2. UNIX
  3. Linux
  4. DOS
  5. Windows
    1. Which is the operating system of choice for Apple Computers?

A

    1. Historically, which is the operating system of choice for seri- ous programmers?

B

    1. Which is the PC version of Unix? C
    2. What is the Microsoft operating system family provided on PCs called?

E

    1. What is the original PC operating system called? D

哪个是Apple电脑的首选操作系统?
A

历史上,哪个是严肃程序员的首选操作系统?
B

哪个是Unix的PC版本?
C

在PC上提供的Microsoft操作系统家族被称为什么?
E

最初的PC操作系统叫什么?
D

这个可能比较陌生,需要康康

For Exercise 24–26, match the following software type with its definition.

      1. Systems software
      2. Operating system
      3. Application software
    1. Programs that help us solve real-world problems. C
    1. Programs that manage a computer system and interact with hardware.

A

    1. Programs that manage computer resources and provide an interface for other programs.

B

Exercises 27–72 are problems or short answer questions.

    1. Distinguish between application software and system software.

Systems software are tools to help others write programs; they manage a computer system and interact with hard- ware. Application software are programs to solve specific problems.

系统软件是帮助其他人编写程序的工具;它们管理计算机系统并与硬件交互。应用软件是解决特定问题的程序。

    1. What is an operating system?

An operating system is a piece of software that manages a computer’s resources and provides an interface for system interaction.

操作系统是一种软件,管理计算机的资源并提供系统交互的界面。

    1. Explain the term multiprogramming.

Multiprogramming is the technique of keeping multiple pro- grams in main memory at the same time, each competing for time on the CPU.

多道程序设计是一种在主内存中同时保留多个程序的技术,每个程序都竞争获取 CPU 时间。

    1. The following terms relate to how the operating system man- ages multiprogramming. Describe the part each plays in this process.
      1. Process

A process is a program in execution.

进程是正在执行的程序。

      1. Process management

Process management is keeping track of necessary information for active processes.

进程管理是跟踪活动进程所需信息的过程。

      1. Memory management

Memory management is keeping track of how and where programs are loaded into main memory.

内存管理是跟踪程序加载到主内存的方式和位置的过程。

      1. CPU scheduling

CPU scheduling is determining which process in mem- ory is given access to the CPU so that it may execute.

CPU 调度是确定哪个内存中的进程获得对 CPU 的访问权以便执行的过程。

    1. What constitutes a batch job?批处理作业的单词混个眼熟

A batch job was made up of the program and the instructions regarding the system software and other resources needed to execute the job.

一个批处理作业由程序和执行该作业所需的系统软件和其他资源的指令组成。

程序和系统软件和指令

    1. Describe the evolution of the concept of batch processing from the human operator in the 1960s and 1970s to the oper- ating systems of today.

Originally, the instructions regarding the system software needed for a program were given to the human operator. Today, the instructions are given directly to the computer through OS commands that are part of the file containing the program. Today, batch processing has come to mean a system in which programs and system resources are coordi- nated and executed without interaction between the user and the program.

    1. Define timesharing.

Timesharing is a technique by which CPU time is shared among multiple interactive users at the same time.

分时操作是一种技术,通过它在同一时间内将 CPU 时间共享给多个交互式用户。

 

What is the relationship between multiprogramming and timesharing?

Multiprogramming allows multiple processes to be active at once. Timesharing allows the multiple processes to be inter- active ones.

这是一种技术,允许多个程序同时存在于主内存中,并且CPU在它们之间切换。它能够更好地利用CPU,因为当一个程序在等待I/O操作时,CPU可以执行另一个程序。

被称为多任务处理,分时操作是一种技术,允许多个用户同时与计算机进行交互。每个用户获得一小段或量化的CPU时间,系统迅速在不同用户的任务之间切换。这使得每个用户都似乎拥有自己专用的机器,尽管他们共享相同的物理资源。

    1. Why do we say that users in a timesharing system have their own virtual machine?

Users have the illusion of having the computer all to themselves.

用户有一种独占计算机的错觉。

    1. In Chapter 6, we defined a virtual machine as a hypothetical machine designed to illustrate important features of a real machine. In this chapter, we define a virtual machine as the illusion created by a timesharing system that each user has a dedicated machine. Relate these two definitions.

The illusion created in a timesharing situation is that the user owns a single hypothetical machine. The hypotheti- cal machine illustrates the important features of the single machine the user needs.

们将虚拟机定义为一个假想的机器,旨在展示实际机器的重要特征。在本章中,我们将虚拟机定义为分时系统创建的一种错觉,即每个用户拥有一台专用机器。将这两个定义联系起来。

在分时系统中产生的错觉是用户拥有一台假想的单一机器。这台假想的机器展示了用户所需的单一机器的重要特征。

    1. How does the timesharing concept work?

Each user is represented by a login process that runs on the mainframe. When the user runs a program, another process is created that competes for CPU time with other processes. The rationale is that the computer is so fast that it can handle multiple users without anyone having to wait.

每个用户由在主机上运行的登录进程表示。当用户运行程序时,会创建另一个进程,与其他进程竞争 CPU 时间。其基本原理是计算机运算速度非常快,可以处理多个用户而无需等待。

    1. What is a real-time system?

A real-time system is a system in which the speed of an answer is crucial.

实时系统是一个对答案速度至关重要的系统。

    1. What is response time?

Response time is how long it takes to get an answer. The expression comes from the delay between receiving a stimu- lus (asking a question) and producing a response (answering the question).

    1. What is the relationship between real-time systems and response time?

Time is critical in many real-time situations, so the response time must be kept to a minimum.

    1. In a multiprogramming environment, many processes may be active. What are the tasks that the OS must accomplish in order to manage the memory requirements of active processes?

The OS must keep track of where and how a program resides in memory and convert logical program addresses into actual memory addresses.

    1. Distinguish between logical addresses and physical addresses.

A physical address is an actual address in the computer’s main memory device. A logical address is an address relative to the program. A logical address is sometimes called a rela- tive address for obvious reasons.

    1. What is address binding?

Address binding is the mapping of a logical address into a physical address.

    1. Name three memory management techniques and give the general approach taken in each.

Single contiguous memory management: Only the OS and one application program are loaded into memory at the same time.

Static and dynamic partitions: More than one program is loaded into memory with the OS at the same time. Each application program is given its own partition of memory.

Paging: Main memory is divided into fixed-sized blocks called frames and processes are divided into fixed-sized blocks called pages. Any number of programs can be loaded with the OS, but a process does not necessarily have to be in contiguous memory and not all of a process need be in memory at the same time.

响应时间是获取答案所需的时间。该表达式来源于接收刺激(提问)和产生响应(回答问题)之间的延迟。

    1. When is a logical address assigned to a variable? When the program is compiled.
    2. 逻辑地址分配在编译时候
    3. When does address binding occur?

When the program is loaded into memory.

地址联编在载入内存的时候

    1. How is memory divided in the single contiguous memory management approach?

Memory is divided into two sections: one for the operating system and one for the application program.

在单一连续内存管理方法中,内存被划分为两个部分:一个用于操作系统,另一个用于应用程序。

    1. When a program is compiled, where is it assumed that the program will be loaded into memory? That is, where are log- ical addresses assumed to begin?

At location 0.

当程序被编译时,假定程序将被加载到内存的哪个位置?也就是说,逻辑地址被假定从哪里开始?

在位置0。

    1. If, in a single contiguous memory management system, the program is loaded at address 30215, compute the physical addresses (in decimal) that correspond to the following log- ical addresses:
      1. 9223

39438

      1. 2302

32517

      1. 7044

37259

    1. In a single contiguous memory management approach, if the logical address of a variable is L and the beginning of the application program is A, what is the formula for binding the logical address to the physical address?

L + A

    1. If, in a fixed partition memory management system, the current value of the base register is 42993 and the current value of the bounds register is 2031, compute the physical addresses that correspond to the following logical addresses:
      1. 104

43097

      1. 1755

44748

      1. 3041

Address out of bounds of partition

    1. If more than one partition is being used (either fixed or dynamic), what does the base register contain?

The base register contains the beginning address of the cur- rent partition.

基址寄存器包含当前分区的起始地址

    1. Why is the logical address compared to the bounds register before a physical address is calculated?

The bounds register contains the length of the current parti- tion. If the logical address is greater than the bounds register, then the physical address is not within the current partition.

54. 为什么在计算物理地址之前要将逻辑地址与边界寄存器进行比较?

边界寄存器包含当前分区的长度。如果逻辑地址大于边界寄存器的值,那么物理地址就不在当前分区内。

 
    1. If, in a dynamic-partition memory management system, the current value of the base register is 42993 and the current value of the bounds register is 2031, compute the physical addresses that correspond to the following logical addresses:
      1. 104

43097

      1. 1755

44748

      1. 3041

Address out of bounds of partition.

Exercises 55 and 56 use the following state of memory.

Operating system

Process 1

Empty 60 blocks

Process 2

Process 3

Empty 52 blocks

Empty 100 blocks

    1. If the partitions are fixed and a new job arrives requiring 52 blocks of main memory, show memory after using each of the following partition selection approaches:
      1. First fit
      2. Best fit
      3. Worst fit
  1. First fit

Operating system

Process 1

New process

Process 2

Process 3

Empty 52 blocks

Empty 100 blocks

  1. Best fit

Operating system

Process 1

Empty 60 blocks

Process 2

Process 3

New process

Empty 100 blocks

  1. Worst fit

Operating system

Process 1

Empty 60 blocks

Process 2

Process 3

Empty 52 blocks

New process

    1. If the partitions are dynamic and a new job arrives requiring 52 blocks of main memory, show memory after using each of the following partition selection approaches:
      1. First fit
      2. Best fit
      3. Worst fit
  1. First fit

Operating system

Process 1

New process

Empty 8 blocks

Process 2

Process 3

Empty 52 blocks

Empty 100 blocks

  1. Best fit

Operating system

Process 1

Empty 60 blocks

Process 2

Process 3

New process

Empty 100 blocks

  1. Worst fit

Operating system

Process 1

Empty 60 blocks

Process 2

Process 3

Empty 52 blocks

New process

Empty 48 blocks

    1. If a logical address in a paged memory management system is <2, 133>, what do the values mean?

This address means the 133rd byte on page 2.

第二页的第133个字节

 

Exercises 58–60 refer to the following PMT.

Page

0

1

2

3

Frame

5

2

7

3

    1. If the frame size of 1024, what is the physical address associ- ated with the logical address <2, 85>?

7253

    1. If the frame size of 1024, what is the physical address associ- ated with the logical address <3, 555>?

3627

    1. If the frame size of 1024, what is the physical address associ- ated with the logical address <3, 1555>?

Illegal address. The offset is larger than the page size.

非法地址。偏移量大于页大小。

    1. What is virtual memory and how does it apply to demand paging?

Virtual memory is the illusion that memory is limitless and thus there is no limit on the size of a program. Demand pag- ing is the technique where pages are brought into memory only when they are referenced (needed). Demand paging allows programs of any size, thus giving the illusion of infinite memory.

虚拟内存是一种使内存看起来无限的错觉,因此程序的大小没有限制。需求分页是一种技术,只有在引用(需要)时才将页面调入内存。需求分页允许任意大小的程序,从而产生无限内存的错觉。

    1. What are the conceptual stages through which a process moves while being managed by the operating system? New, ready, running, waiting, and terminated
    2. 新建、就绪、运行、等待和终止。
    3. Describe how a process might move through the various pro- cess states. Create specific reasons why this process moves from one state to another.

A new process begins in the new state. When the process has no bars to its execution, it moves into the ready state. It waits in the ready state until it gets time in the running state. It runs for a while and issues a command for file input. The process is moved into the waiting state until the I/O has been com- pleted, at which time it moves into the ready state to await another turn in the running state. Eventually it gets back to the CPU and runs until it needs access to a part of the pro- gram that is on secondary storage. It moves into the waiting state until the needed pages are brought in; then it moves back to the ready state. It gets its third shot at the CPU and finishes, and moves into the terminated state.

新进程开始于新建状态。当进程没有执行的障碍时,它进入就绪状态。在就绪状态等待,直到在运行状态获得时间。运行一段时间后,发出文件输入命令。进程移至等待状态,直到I/O完成,然后返回就绪状态等待在运行状态中的另一个轮次。最终回到CPU并运行,直到需要访问存储在二级存储器上的程序部分。进程移至等待状态,直到所需的页面被调入,然后返回就绪状态。进程第三次获得CPU并完成后,移至终止状态。

    1. What is a process control block?

A process control block (PCB) is a data structure that contains information about a process. A PCB is created for each new process. When a process moves from one state to another, its PCB is moved with it.

进程控制块(PCB)是包含有关进程信息的数据结构。为每个新进程创建一个PCB。当进程从一个状态移动到另一个状态时,它的PCB也会随之移动。

    1. How is each conceptual stage represented in the OS?

Each conceptual stage is represented by a list of the PCBs in that stage.

每个概念阶段在操作系统中如何表示?

每个概念阶段由该阶段的PCB列表表示。

    1. What is a context switch?

When a process is moved out of the CPU, the current con- tents of the registers, including the program counter, must be saved in the process’s PCB. When a new process moves into the CPU, the contents of the registers from this process’s PCB are restored. This process of saving and restoring regis- ters is called a context switch.

当进程从CPU移出时,必须保存寄存器的当前内容,包括程序计数器,保存在进程的PCB中。当新进程移入CPU时,将从该进程的PCB中恢复寄存器的内容。保存和恢复寄存器的过程称为上下文切换。

    1. Distinguish between preemptive scheduling and nonpre- emptive scheduling.

With nonpreemptive scheduling, once a process is in the running state, it remains there until it voluntarily leaves. With preemptive scheduling, the OS can move a process from the running state to the waiting state or ready state.

    1. Name and describe three CPU scheduling algorithms.

First-come, first-served: The processes are moved into the running state in the order in which they arrive in the ready.

Shortest job next: When the CPU is ready for anther job, the process in the ready state that takes the shortest time is

 

moved into the running state. The estimated length of time that a process needs the CPU may or may not be accurate.

Round robin: Each process stays in the running state for a predetermined amount of time, called a time slice. When a process’s time slice is over, it is moved back into the ready state, where it stays until it is its turn again for the CPU.

Use the following table of processes and service time for Exercises 69 through 71.

Process

P1

P2

P3

P4

P5

Service time

120

60

180

50

300

    1. Draw a Gantt chart that shows the completion times for each process using first-come, first-served CPU scheduling.

 

    1. Draw a Gantt chart that shows the completion times for each process using shortest-job-next CPU scheduling.

 

    1. Draw a Gantt chart that shows the completion times for each process using round-robin CPU scheduling with a time slice of 60.

 

    1. Distinguish between fixed partitions and dynamic partitions. The sizes of the partitions are fixed in a fixed-partition scheme, although they are not necessarily the same size. In

a dynamic-partition scheme, the partitions are allocated as needed.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值