zoukankan      html  css  js  c++  java
  • 第一章 PROBLEMS

    2019-06-15

    23:16:13

    1. What are the two main functions of an operating system?

    1. An operating system must provide the users with an extended machine, and it must manage the I/O devices and other system resources. To some extent, these are different functions.两个功能:1.管理资源 2.提供抽象。

    在资源管理观点中,操作系统的任务是有效地管理系统的各个部分。在扩展的机器观点中,系统的任务是为用户提供比实际机器更便于运用的抽象。这些抽象包括进程,地址空间以及文件。


    2. In Section 1.4, nine different types of operating systems are described. Give a list of applications for each of these systems (one per operating systems type).

    Mainframe operating system: Claims processing in an insurance company(在保险公司处理索赔)

     Server operating system: Speech-to-text conversion service for Siri. 

    Multiprocessor operating system: Video editing and rendering(视频编辑和渲染)

    Personal computer operating system: Word processing application

    Handheld computer operating system: Context-aware recommendation system. (上下文感知推荐系统)

     

    Embedded operating system: Programming a DVD recorder for recording TV

    注意嵌入式操作系统和Handheld(掌上)操作系统的区别:

    Sensor-node operating system: Monitoring temperature in a wilderness area

     

    Real-time operating system: Air traffic control system

    Smart-card operating system: Electronic payment


    3. What is the difference between timesharing and multiprogramming systems?(分时和多道的区别)

     In a timesharing system, multiple users can access and perform computations on a computing system simultaneously using their own terminals.

    Multiprogramming systems allow a user to run multiple programs simultaneously. All timesharing systems are multiprogramming systems but not all multiprogramming systems are timesharing systems since a multiprogramming system may run on a PC with only one user.、


     4.To use cache memory, main memory is divided into cache lines, typically 32 or 64 bytes long. An entire cache line is cached at once. What is the advantage of caching an entire line instead of a single byte or word at a time?(cache为什么是按32或64字节读取,而不是按字节读取?)

    Empirical evidence shows that memory access exhibits the principle of locality of reference, where if one location is read then the probability of accessing nearby locations next is very high, particularly the following memory locations. So, by caching an entire cache line, the probability of a cache hit next is increased. Also, modern hardware can do a block transfer of 32 or 64 bytes into a cache line much faster than reading the same data as individual words. (

    经验证据表明,存储器访问表现出参考局部性的原理,其中如果读取一个位置,则接下来访问附近位置的概率非常高,尤其是以下存储器位置。
    因此,通过缓存整个缓存行,接下来缓存命中的概率会增加。
    此外,现代硬件可以将32或64字节的块传输到高速缓存行中,比将单个字读取相同的数据快得多。)


    5. On early computers, every byte of data read or written was handled by the CPU (i.e., there was no DMA). What implications does this have for multiprogramming?(

    5.在早期计算机上,每个读取或写入的数据字节都由CPU处理(即

    没有DMA)。
    这对多道程序设计有什么影响?

    The prime reason for multiprogramming is to give the CPU something to do while waiting for I/O to complete. If there is no DMA, the CPU is fully occupied doing I/O, so there is nothing to be gained (at least in terms of CPU utilization) by multiprogramming. No matter how much I/O a program does, the CPU will be 100% busy. This of course assumes the major delay is the wait while data are copied. A CPU could do other work if the I/O were slow for other reasons (arriving on a serial line, for instance)

    多道程序设计的主要原因是在等待I / O完成时为CPU提供一些操作。
    如果没有DMA,则CPU完全占用I / O,因此通过多道程序无法获得资源(至少在CPU利用率方面)
    无论程序执行多少I / O,CPU都将100%忙碌。
    这当然假设主要的延迟是数据被复制时的等待。
    如果由于其他原因(例如,到达串行线路)I / O很慢,CPU可以执行其他工作


    7. The family-of-computers idea was introduced in the 1960s with the IBM System/360 mainframes. Is this idea now dead as a doornail or does it live on?

    7. It is still alive. For example, Intel makes Core i3, i5, and i7 CPUs with a variety of different properties including speed and power consumption. All of these machines are architecturally compatible. They differ only in price and performance, which is the essence of the family idea.  


    9. There are several design goals in building an operating system, for example, resource utilization, timeliness, robustness, and so on. Give an example of two design goals that may contradict one another.

    Consider fairness and real time. Fairness requires that each process be allocated its resources in a fair way, with no process getting more than its fair share. On the other hand, real time requires that resources be allocated based on the times when different processes must complete their execution. A realtime process may get a disproportionate share of the resources.

    考虑公平和实时。
    公平要求每个流程都以公平的方式分配其资源,没有任何流程获得超过其公平份额的流程。
    另一方面,实时需要根据不同进程必须完成执行的时间来分配资源。
    实时过程可能会获得不成比例的资源份额。


    10. What is the difference between kernel and user mode? Explain how having two distinct modes aids in designing an operating system.

    10. Most modern CPUs provide two modes of execution: kernel mode and user mode. The CPU can execute every instruction in its instruction set and use ev ery feature of the hardware when executing in kernel mode. However, it can execute only a subset of instructions and use only subset of features when executing in the user mode. Having two modes allows designers to run user programs in user mode and thus deny them access to critical instructions.

    用户态可以使用的指令是全部指令的子集。有些关键性的指令不能给用户态使用


     11. A 255-GB disk has 65,536 cylinders with 255 sectors per track and 512 bytes per sector. How many platters and heads does this disk have? Assuming an average cylinder seek time of 11 ms, average rotational delay of 7 msec and reading rate of 100 MB/sec, calculate the average time it will take to read 400 KB from one sector.

    11. Number of heads = 255 GB / (65536*255*512) = 16 Number of platters = 16/2 = 8 The time for a read operation to complete is seek time + rotational latency + transfer time. The seek time is 11 ms, the rotational latency is 7 ms and the transfer time is 4 ms, so the average transfer takes 22 msec.

    读取操作完成的时间是寻道时间+旋转延迟+传输时间
    寻道时间为11 ms,旋转延迟为7 ms,传输时间为4 ms,因此平均传输时间为22 ms。(读取速率为100MB/s,题中要求读取400KB,那么传输时间就是4ms)


    12. Which of the following instructions should be allowed only in kernel mode? (a) Disable all interrupts. (b) Read the time-of-day clock. (c) Set the time-of-day clock. (d) Change the memory map. 

    12. Choices (a), (c), and (d) should be restricted to kernel mode


     13. Consider a system that has two CPUs, each CPU having two threads (hyperthreading). Suppose three programs, P0, P1, and P2, are started with run times of 5, 10 and 20 msec, respectively. How long will it take to complete the execution of these programs? Assume that all three programs are 100% CPU bound, do not block during execution, and do not change CPUs once assigned.

    13. It may take 20, 25 or 30 msec to complete the execution of these programs depending on how the operating system schedules them. If P0 and P1 are scheduled on the same CPU and P2 is scheduled on the other CPU, it will take 20 msec. If P0 and P2 are scheduled on the same CPU and P1 is scheduled on the other CPU, it will take 25 msec. If P1 and P2 are scheduled on the same CPU and P0 is scheduled on the other CPU, it will take 30 msec. If all three are on the same CPU, it will take 35 msec.


    14. A computer has a pipeline with four stages. Each stage takes the same time to do its work, namely, 1 nsec. How many instructions per second can this machine execute?

    Every nanosecond one instruction emerges from the pipeline. This means the machine is executing 1 billion instructions per second. It does not matter at all how many stages the pipeline has. A 10-stage pipeline with 1 nsec per stage would also execute 1 billion instructions per second. All that matters is how often a finished instruction pops out the end of the pipeline.

    每一纳秒的指令都从管道中出现。
    这意味着机器每秒执行10亿条指令。
    根本没关系管道有多少个阶段。
    每级1 nsec的10级流水线每秒也会执行10亿条指令。
    重要的是一条完成的指令弹出管道末端的频率。(指令流水暑假时要补一下!



    16. When a user program makes a system call to read or write a disk file, it provides an indication of which file it wants, a pointer to the data buffer, and the count. Control is then transferred to the operating system, which calls the appropriate driver. Suppose that the driver starts the disk and terminates until an interrupt occurs. In the case of reading from the disk, obviously the caller will have to be blocked (because there are no data for it). What about the case of writing to the disk? Need the caller be blocked aw aiting completion of the disk transfer?

     


    17. What is a trap instruction? Explain its use in operating systems.

    17. A trap instruction switches the execution mode of a CPU from the user mode to the kernel mode. This instruction allows a user program to invoke functions in the operating system kernel


     18. Why is the process table needed in a timesharing system? Is it also needed in personal computer systems running UNIX or Windows with a single user?

    The process table is needed to store the state of a process that is currently suspended, either ready or blocked. Modern personal computer systems have dozens of processes running even when the user is doing nothing and no programs are open. They are checking for updates, loading email, and many other things, On a UNIX system, use the ps -a command to see them. On a Windows system, use the task manager.

    需要进程表来存储当前挂起的进程的状态,无论是就绪还是阻止。
    现代个人计算机系统即使在用户什么都不做而且没有打开程序的情况下也有许多进程在运行
    他们正在检查更新,加载电子邮件和许多其他事情,在UNIX系统上,使用ps -a命令查看它们。
    在Windows系统上,使用任务管理器。


    19. Is there any reason why you might want to mount a file system on a nonempty directory? If so, what is it?(在非空的目录上装文件系统)

     Mounting a file system makes any files already in the mount-point directory inaccessible, so mount points are normally empty. Howev er, a system administrator might want to copy some of the most important files normally located in the mounted directory to the mount point so they could be found in their normal path in an emergency when the mounted device was being repaired. 

    安装文件系统会使安装点目录中的任何文件无法访问,因此安装点通常为空。
    但是,系统管理员可能希望将通常位于安装目录中的一些最重要的文件复制到安装点,以便在安装设备修复时可以在紧急情况下找到它们的正常路径。


    20. For each of the following system calls, give a condition that causes it to fail: fork, exec, and unlink.

    20. Fork can fail if there are no free slots left in the process table (and possibly if there is no memory or swap space left). Exec can fail if the file name given does not exist or is not a valid executable file. Unlink can fail if the file to be unlinked does not exist or the calling process does not have the authority to unlink it


    21. What type of multiplexing (time, space, or both) can be used for sharing the following resources: CPU, memory, disk, network card, printer, keyboard, and display? 


  • 相关阅读:
    linux 系统层/用户层资源使用信息监控
    人工神经网络学习
    刷题
    使用机器学习进行气象数据分析
    kaggle 从零开始记录遇到的问题
    大数据平台资料收集
    MacOS应用cocoa application问题
    Latex学习手记(持续更新)
    Matplotlib折线图
    Android的系统架构——安卓运行库
  • 原文地址:https://www.cnblogs.com/JasonPeng1/p/11029321.html
Copyright © 2011-2022 走看看