操作系统英文课件:Chapter 5 InputOutput

上传人:M****1 文档编号:568610493 上传时间:2024-07-25 格式:PPT 页数:89 大小:1.90MB
返回 下载 相关 举报
操作系统英文课件:Chapter 5 InputOutput_第1页
第1页 / 共89页
操作系统英文课件:Chapter 5 InputOutput_第2页
第2页 / 共89页
操作系统英文课件:Chapter 5 InputOutput_第3页
第3页 / 共89页
操作系统英文课件:Chapter 5 InputOutput_第4页
第4页 / 共89页
操作系统英文课件:Chapter 5 InputOutput_第5页
第5页 / 共89页
点击查看更多>>
资源描述

《操作系统英文课件:Chapter 5 InputOutput》由会员分享,可在线阅读,更多相关《操作系统英文课件:Chapter 5 InputOutput(89页珍藏版)》请在金锄头文库上搜索。

1、MODERN OPERATING SYSTEMSThird EditionANDREW S. TANENBAUMChapter 5Input/OutputTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pBesides software, the OS also controls all the computer I/O devices.-It must issue commands to devices, catches interru

2、pts and handle errors.-It should also provide an interface between the devices and the rest of the system. The interface should be device independent.-Here we focus on programming I/O devices (i.e., I/O controller and software) rather than hardware operation (i.e., mechanical part).pI/O devices are

3、roughly divided into two categories:-A block device is one that stores information in fixed-size blocks, each with its own address. All transfers are in units of one or more entire blocks (e.g., the disk).-A character device delivers or accepts a stream of characters, without regard to any block str

4、ucture. It is not addressable and does not have any seek operation (e.g., printers, network interfaces).pSome devices just do not fit in the above categories (e.g., clocks).Input / Output (I/O)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Fig

5、5-1. Some typical device, network, and bus data rates.I/O DevicesTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pI/O devices cover a huge range in speeds, which puts considerable pressure on the software to perform well over many orders of magn

6、itude in data rates (Fig 5-1).pMost of these devices tend to get faster as time goes on.pI/O units typically consist of a mechanic component and an electronic component. The former is the device itself, and the latter is called device controller (or adapter).pOn PCs, an adapter often takes the form

7、of a chip on the parent- board or a printed circuit card that can be inserted into a (PCI) expansion slot (see Fig 1-6). pThe interface between the controller and the device is often a very low level interface, e.g., having many particulars related to device operations. For example,-For a block devi

8、ce like a disk, the controllers job is to convert the serial bit stream into a block of bytes and perform any error control when necessary. -The controller for a monitor also works as a bit serial device at an equally low level, e.g., reading bytes containing the characters to be displayed from memo

9、ry and generating the signals used to modulate the CRT beamDevice ControllersTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Communication between CPU and ControllerTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights

10、 reserved. 0-13-6006639pEach controller has a few control registers that are used for communicating with CPU (issuing/accepting commands):-By writing into these registers, the OS can command the device to deliver data, accept data, switch itself on or off or otherwise perform some action;-By reading

11、 from these registers, the OS can learn what devices state is, whether it is prepared to accept a new command, and so on.pMany devices also have a data buffer(registers) that the OS can read and write, e.g., video RAM.pHow can the CPU communicate with the control registers and device data buffers?(a

12、)Each control register is assigned an I/O port number. The set of all I/O ports forms the I/O port space(registers) and is protected, and a special set of instructions can be designed for the port operation (see examples on page 333). (b)Memory-mapped I/O: it maps all the control registers into memo

13、ry space. Each register is assigned a unique memory address to which no memory is assigned.Fig 5-2. (a) Separate I/Oand memoryspace. (b) Memory-mapped I/O.(c) Hybrid.Memory-Mapped I/O (2)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639(c)A hybri

14、d scheme uses memory-mapped I/O data buffers and separate I/O ports for the control registers. pThey work as follows:In all cases, when the CPU wants to read a word, it puts the address on the bus address lines and then asserts a READ signal on a bus control line. A second signal line is used to tel

15、l whether I/O space or memory space is needed.With (b), every memory module and I/O device compares the address lines to the range of addresses it services. If the address falls in its range, it responds to the request.Fig 5-3. (a)A single-bus architecture. (b) A dual-busmemoryarchitecture.Memory-Ma

16、pped I/O: Pros & ConsTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639+ Device control registers are just variables in memory and can be accessed in C rather than in assemble used in other cases;+ No special protection mechanism is needed to keep

17、 user processes from performing I/O (by defining the virtual space mapping);+ Every instruction that can reference memory can also reference control registers._ Modern computers have some form of caching of memory words. Caching a device control register would be disastrous;_ All memory modules and

18、all I/O devices must examine all memory references to see which ones to responds to: easy with (a) but difficult with (b) since with (b), I/O devices cannot see memory addresses.Direct Memory Access (DMA)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-

19、6006639pRequesting data from an I/O controller one byte/word at a time wastes the CPUs time. So DMA is proposed to handle this issue.-It has access to the system bus independent of the CPU.-It contains several registers that can be read and written by the CPU, which include a memory address register

20、, a byte count register and one or more control registers.-The control registers specify the I/O port to use, the direction of transfer and the number of bytes to transfer in one burst.pDisk transfer without using DMA:-The disk controller reads the block from the driver serially, bit by bit, until t

21、he entire block is in the controllers internal buffer.-Then it computes the checksum to verify that no read errors have occurred, and then causes an interrupt if there is no error. -Then the OS reads the disk block from the controllers buffer a byte or word at a time by executing a loop, with each i

22、teration reading one byte or word from a controller device register and storing it in main memory. Fig 5-4.Operationof a DMAtransfer.DMA: OperationTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-60066391)The CPU programs the DMA controller by setting i

23、ts registers so it knows what to transfer where. It also issues a command to the disk controller telling it to read from the disk into its internal buffer and verify the checksum. When valid data are in the disk controllers buffer, DMA begins.2)The DMA controller initiates the transfer by issuing a

24、request over the bus to the disk controller. This request looks like any other read requests.3)The write of data to memory is another standard bus cycle.4)When the write is complete, the disk controller sends an acknowledgement signal to the DMA controller over the bus.pDMA repeats steps 2-4 until t

25、he byte count is equal to 0, and then interrupts the CPU. Fig 5-5. Connectionsbetween devices andthe interrupt controlleractually use interruptlines on the bus ratherthan dedicated wires.Interrupts RevisitedTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-

26、13-6006639pHow an interrupt happens :-When an I/O device has finished the work given to it, it causes an interrupt by asserting a signal on a bus line that it has been assigned.-This signal is detected by the interrupt controller chip on the parent board, which then decides what to do.-If no other i

27、nterrupts are pending, the controller processes this interrupt immediately; otherwise, the one with the highest priority is serviced, while the others are ignored but continue to assert interrupt signals on the bus until their requests have been handled.Interrupt HandlingTanenbaum, Modern Operating

28、Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pTo handle the interrupt:-The interrupt controller puts a number on the address lines specifying which device wants attention and asserts a signal to interrupt the CPU. -The interrupt signal causes the CPU to stop what is doi

29、ng and start the interrupt procedure. (The above number is used as an index into a table called the interrupt vector to fetch a new program counter, which points to the start of the corresponding interrupt procedure.)-Shortly after it starts running, the interrupt service procedure acknowledges the

30、interrupt by writing a certain value to one of the interrupter controllers I/O ports.-This ACK tells the controller that it is free to issue another interrupt.-By having the CPU delay this acknowledgement until it is ready to handle the next interrupt, race condition involving multiple interrupts ca

31、n be avoided.-The hardware always needs to save certain information before starting the service procedure, e.g., the program counter and registers.pOne issue is where to save this information (pls read pp340).One problem is caused by the fact that most modern CPUs are heavily superscalar (internally

32、 parallel, see P21):pA precise interrupt is an interrupt that leaves the machine in a well-defined state with the following properties:1.PC (Program Counter) is saved in a known place.2.All instructions before the one pointed to by the PC have fully executed.3.No instruction beyond the one pointed t

33、o by the PC has been executed.4.Execution state of the instruction pointed to by the PC is known.pAn imprecise interrupt does not meet these requirements, and the OS needs to figure out what has happened and still has to happen.-Machines usually vomit a large amount of internal state onto the stack

34、to give the OS the probability to figure out what was going on.-The code necessary to restart the machine is typically extremely complicated.-Saving a large amount of information to memory on every interrupt makes interrupt slow and recovery even worse.Precise and Imprecise Interrupts (1)Tanenbaum,

35、Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Fig 5-6. (a) A precise interrupt. (b) An imprecise interrupt.Precise and Imprecise Interrupts (2)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639(a)All i

36、nstructions up to PC (316) have been completed and none of those beyond it have started.(b)Different instructions near the PC are in different stage of completion, with older ones not necessarily more complete than younger ones.pA key concept in designing I/O software is device independence, i.e., i

37、t should be possible to write programs that can access any I/O device without having to specify the device in advance.pIt is up to the OS to take care of the problems caused by the fact that these devices really are different and require different command sequences to read or write. pSome issues to

38、be addressed:-Uniform naming: the name of the file or a device should simply be a string or an integer and not depend on the device in any way (addressed the same way).-Error handling: Error should be handled as close to the hardware as possible. Only if the lower layers are not able to deal with th

39、e problem should the upper layers be told about it.-Synchronous (blocking) versus asynchronous (interrupt-driven) transfer: most I/O is asynchronous, and the CPU starts the transfer and goes off to do others.-Buffering: often data that come off a device cannot be stored directly in its destination,

40、e.g., packets from the network are of a bit-by-bit accumulation.Goals of the I/O SoftwareTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pProgrammed I/O has the CPU to do all work (simplest form).-The CPU continuously polls the device to see if

41、it is ready to continue next. This behavior is often called polling or busy-waiting.pInterrupt-driven I/O allows the CPU to do something else while waiting for the I/O device (e.g., printers) to become ready through using interrupts (e.g., the time taken by a printer to print a character is much lar

42、ger than the CPUs processing time) . -An interrupt occurs on every character for printing, and interrupt takes time and wastes a certain amount of CPU time.pI/O using DMA lets the DMA controller feed the characters to the printer one at a time, without the CPU being bothered. -Special hardware, i.e.

43、, the DMA controller is required.Three Ways To Perform I/OTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Fig 5-7. Steps in printing a string.Programmed I/O for PrintingTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All ri

44、ghts reserved. 0-13-6006639(a)A user process first assembles the string in a buffer in user space. It then acquires the printer for writing by making a system call to open it.(b)The OS then copies the buffer to kernel space. Once the printer is available, the OS copies the first character to the pri

45、nters register for printing.(c)As soon as the OS has copied the first character to the printer, it checks to see(polling) if the printer is ready to accept another one (a second register gives its status).Fig 5-8. Writing a string to the printer using programmed I/O.Programmed I/O: CodeTanenbaum, Mo

46、dern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639-First the data are copied to the kernel.-Then the OS enters a tight loop outputting the characters one at a time;Interrupt-Driven I/O: CodeTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc.

47、All rights reserved. 0-13-6006639The buffer is copied to kernel space. After the first character is copied to the printer, the CPU calls the scheduler and some other process is run. The process that asked for the string to be printed is blocked until the entire string has printed.When the printer is

48、 prepared to accept the next character, it generates an interrupt, which stops the current process and saves its state.Fig 5-9. Writing a string to the printer using interrupt-driven I/O. (a) Code executed at the time the print system call is made. (b) Interrupt service procedure for the printer.Fig

49、 5-10. Printing a string using DMA. (a) Code executed when the print system call is made. (b) Interrupt service procedure.I/O Using DMA: codeTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639-DMA is programmed I/O, only with the DMA controller doi

50、ng all the work, instead of the main CPU.-The big win with DMA is reducing the number of interrupts from one character to one per buffer printed. If there are many characters and interrupts are slow, using it is a big improvement.-The DMA controller is usually much slower than the main CPU. If DMA c

51、annot drive the device at full speed, or CPU usually has nothing to do while waiting for the DMA interrupt, interrupt-driven I/O or even programmed I/O may be better.Fig 5-11. Layers of the I/O software system.I/O Software LayersTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. A

52、ll rights reserved. 0-13-6006639pI/O software is typically organized in four layers, each of which has a well-defined function to perform and well-defined interface to the adjacent layers. (similar to protocol stack)pThe four layers are -Interrupter handlers, Device drivers, Device-independent OS so

53、ftware and User-level I/O software.Interrupt HandlersTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pSteps to handle an interrupt:1.Save registers not already been saved by interrupt hardware.2.Set up a context for the interrupt service procedu

54、re, e.g., setting TLB (Translation lookaside table), MMU (Memory Management Unit) and page table;3.Set up a stack for the interrupt service procedure.4.Acknowledge the interrupt controller. 5.Copy the registers from where they were saved to the process table.6.Run the interrupt service procedure.7.C

55、hoose which process to run next.8.Set up the MMU context for the process to run next.9.Load the new process registers, including its PSW.10.Start running the new process.pInterrupt processing is far from trivial, and also takes a considerable number of CPU instructions.Fig 5-12. Logical positioning

56、ofdevice drivers. In reality all communication between drivers and device controllers goes over the bus.Device DriversTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pEach I/O device attached to a computer needs some device-specific code (driver

57、) for controlling it.pThis code is generally written by the devices manufacture. pEach device driver normally handles one device type.Position of Device DriversTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pIn order to access the device hardwa

58、re (i.e., the controllers hardware), the device driver normally has to be part of the OS kernel (e.g., at least with the current structure like desktop PC). pTo this end, a well-defined model of what a driver does and how it interacts with the rest OS is needed in the OS. Normally the drivers are po

59、sitioned below the rest of the OS (see Fig 5-12).pMost OSs define a standard interface that all block drivers must support and another one that all character drivers must support.pIn OSs in a single binary program, all the drivers are complied into the OS, hence recompiling the kernel for every new

60、device. pActually, it is possible to construct drivers that run in user space, with system calls for reading and writing device registers, in order to isolate the kernel from drivers and the drivers from each other (e.g., MINIX 3).User vs. Kernel Spaces/ModesTanenbaum, Modern Operating Systems 3 e,

61、(c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Functions of Device DriversTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pThe most obvious function is to accept abstract read and write requests from the device-independent softwar

62、e above it and see that they are carried out. Other ones include device initialization, power management and event log etc.pBut drivers are not allowed to make system calls for security. pMany device drivers have a similar general structure:-Checking the input parameters to see if they are valid: if

63、 so a translation from abstract to concrete terms may be needed (e.g., converting a linear block number into the head, track, sector and cylinder numbers); otherwise, an error is returned;-The driver may check if the device is currently in use: if idle, the hardware status is examined; otherwise, th

64、e request is queued for later processing.pA device is controlled via issuing a sequence of commands to it:-The driver is the place where the command sequence is determined, depending on what has to be done.-Once the driver knows the command to issue, it starts writing them into the controllers devic

65、e registers.Fig 5-13. Functions of the device-independent I/O software.Device-Independent I/O SoftwareTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pThe basic function of this software is to perform the I/O functions that are common to all dev

66、ices and to provide a uniform interface to the user-level software.pThe exact boundary between the drivers and this software is system (and device) dependent, because some functions that can be done in a device-independent way may actually be done in the drivers.Fig 5-14. (a) Without a standard driv

67、er interface. (b) With a standarddriver interface.Uniform Interfacing for Device DriversTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pA major issue in an OS is how to make all I/O devices and drivers look more or less the same (i.e., uniform)

68、. Two issues are:-The interface between the device drivers and the rest of the OS, two types:(a)Each device driver has a different interface to the OS, which means interfacing each new driver requires a lot of new programming effort.(b)All drivers have the same interface by defining a set of functio

69、ns that the driver must support for each class of devices.-How I/O devices are named: mapping symbolic device names onto the proper driver (e.g., Unix: /dev/disk0 containing device numbers).Fig 5-15. (a) Unbuffered input. (b) Buffering in user space. (c) Buffering in the kernel followed by copying t

70、o user space. (d) Double buffering in the kernel.Buffering (1)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pWithout buffering, input and output must be well synchronized.-Double buffering: two buffers take turns; if one is being copied to the

71、 user space, the other is accumulating new input. -A circular buffer consists of a region of memory and two points, one points to the next free word, the other to the first word of data in the buffer to be removed.Locked in memoryBeing swapped inFig 5-16. Networkingmay involvemany copiesof a packet.

72、Buffering (2)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pBuffering too much is not good to performance.(1)The kernel copies a packet to a kernel buffer to allow the user to reuse the buffer;(2)The driver copies the packet to the controllers

73、 buffer for output;(3)The packet is copied out onto the network(4)Almost a reverse process will be carried out at (immediate nodes) the receiver.Other functionsTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pError reporting: errors are far more

74、 common in the context of I/O than in other contexts:-Many errors are device-specific and must be handled by the appropriate driver, but the framework for error handling is device independent;-One class of I/O errors is programming errors (e.g., reading from output devices); the action is to just re

75、port back an error code to the caller;-Another class of errors is the class of actual I/O errors (e.g., writing to a damaged block). It is up to the driver to determine what to do, e.g., passing to device-independent software. pAllocating and releasing dedicated devices: some devices (CD recorder) c

76、an be used only by a single process at any given moment, and it is up to the OS to examine requests for device usage.pDevice-independent block size: Different disks may have different sector sizes. It is up to the device-independent software to hide this fact and provide a uniform block size to high

77、er layers.User-Space I/O SoftwareTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pMost of the I/O software is within the OS, but a small portion of it consists of libraries linked together with user programs, and even whole programs running outs

78、ide of the kernel (see examples on page 359).pNot all user-level I/O software consists of library procedures. Another important category is the spooling system, which deals with the dedicated I/O devices in a multiprogramming system.-The daemon is the only special process that has permission to use

79、the printers special file, and it is always running.-The spooling directory is the place where the files (e.g., a file to be printed) to be processed are put. (similar to buffering)-Example: to print a file, this file is first put in the spooling directory, and then the daemon selects one of the fil

80、es in this directory to print. Fig 5-17. Layers of the I/O system and the main functions of each layer.Summary of The I/O SystemTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pThis figure shows all the layers and the principal functions of each

81、 layer, i.e., from hardware to user processes.pThe arrows show the flow of control, e.g., when a user program tries to read a block from a file, the OS is invoked to carry out the call; then the device-independent software looks for it in the buffer cacheReal I/O Devices: DisksTanenbaum, Modern Oper

82、ating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pRedundant Array of Independent Disks (RAID)pCompact Disc Read Only Memory (CD-ROM)pCD-Recordables/RewritablespDigital Video Disk (DVD)pMagnetic Disks ()-Magnetic disks are organized into cylinders, each containing as m

83、any tracks as there are heads stacked vertically. The number of heads varies from 1 to 16.-The tracks are divided into sectors, with the number of sectors around the circumference. -The geometry specified and used by the driver software is almost different from the physical format.-On old disk, the

84、number of sectors per track was the same for all cylinders (b); but modern disks are divided into zones with more sectors on the outer zones than the inner ones (a). -To hide the details of how many sectors each track has, most modern disks have a virtual geometry that is presented to the OS.Magneti

85、c Disks (1)Fig 5-19. (a) Physicalgeometry of adisk with twozones. (b) Apossible virtual geometry for this disk. Magnetic Disks (2)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639-The software is instructed to act as though there are x cylinders,

86、 y heads, and z sectors per track. The controller then remap a request for (x,y,z) onto the real cylinder, head and sector.-A possible virtual geometry of the physical disk of fig (a) is shown in fig (b).pAll modern disks now support a system called logical block addressing, in which disk sectors ar

87、e just numbered consecutively starting at 0, without regard to the disk geometry.Fig 5-18. Disk parameters for the original IBM PC 360-KB floppy disk and a Western Digital WD 18300 hard disk after 20 years.Magnetic Disks (3)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All ri

88、ghts reserved. 0-13-6006639pAverage seek time is seven times better than it was, transfer rate is 1300 times better, while the capacity is up by a factor of 50,000.Fig 5-25. A disk sector.Disk Formatting (1)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-

89、13-6006639pBefore a disk can be used, each platter must receive a low-level format by software.pThe format consists of a series of concentric tracks, each containing some number of sectors, with short gaps between them.-The preamble starts with a certain bit pattern that allows the hardware to recog

90、nize the start of the sector. It also contains the cylinder and sector numbers and some other information; -The size of the data portion is determined by the low-level formatting program.-The ECC filed contains redundant information that can be used to recover from read errors. Its size and content

91、are determined by manufacturers.-All hard disks have some number of spare sectors allocated to be used to replace sectors with a manufacturing defect.Fig 5-26. An illustration of cylinder skew. Disk Formatting (2)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserv

92、ed. 0-13-6006639pThe position of sector 0 on each track is offset (called cylinder skew) from the previous track, which is used to improve read performance.pThe idea is to allow the disk to read multiple tracks in one continuous operation without losing data, see Fig 5-19(a) and Fig 5-26.Disk Format

93、ting (3)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pAs a result of the low-level formatting, disk capacity is reduced, depending on the sizes of the preamble, inter-sector gap, ECC and the number of spare sectors reserved.pThe formatted cap

94、acity is 20% lower than the unformatted one. pThe spare sectors do not count toward the formatted capacity. So all disks of a given type have exactly the same capacity.pFormatting also affects performance. Once the sector size is determined by formatting, the disk read speed is also fixed to Sector

95、size / Header passing time no matter what kind of interface is present.pFor example, if sector size = 512 bytes and header passing time is 20 msec. The read speed is 25.6MB/sec, while SCSI interface can be at 80 MB/sec or 160 MB/sec.Fig 5-27. (a) No interleaving. (b) Single interleaving. (c) Double

96、interleaving.Disk Formatting (4)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pAnother example is, a controller with a 1-sector buffer is given a command to read two consecutive sectors.pAfter the first sector has been read and calculated for

97、ECC, it must be transferred to memory. But during this transfer, the head may fly by the header so the controller has to wait an entire rotation time for the second sector to come around.pInterleaving is adopted to eliminate the problem.pTo avoid interleaving, the controller should buffer an entire

98、track.Insert one sector with an offset of 4Insert two sectorseach with an offset of 3Disk Formatting (5)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pAfter low level formatting is completed, the disk is partitioned. Partitions are needed to a

99、llow multiple OSs to co-exist.pThe final step in preparing a disk for use is to perform a high-level formatting of each partition (separately)-This operation lays down a boot block, the free storage administration (free list or bitmap), root directory, and an empty file system;-It also puts a code i

100、n the partition table entry to indicate which file system is used. P274-When the power is turned on, the BIOS runs initially and then read in the MBR and jumps to it.-This boot program then checks to see which partition is active. Then it reads in the boot sector from that partition and runs it.-The

101、 boot sectors contains a small program that loads a larger bootstrap loader that search the file system to find the OS kernel.-That program is loaded into memory and executed. Disk Arm Scheduling AlgorithmspHow long it takes to read or write a disk block is determined by the following three time fac

102、tors:1)Seek time (the time to move the arm to the proper cylinder).2)Rotational delay (the time for the proper sector to rotate under the head).3)Actual data transfer time.pFor most disks, the seek time dominates the other two times, so reducing the mean seek time can improve system performance.pIf

103、the disk driver accepts requests one at a time and carries them out with the First-Come-First Service (FIFS) policy, little can be done to optimize seek time.pAlternatively, requests can be queued, sorted according to the cylinder number and then serviced in batch instead individually. pSo, disk dri

104、vers can maintain a table indexed by cylinder number, with all the pending requests for each cylinder chained together.Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Fig 5-28. SSF diskscheduling algorithm.Shortest Seek First (SSF)Tanenbaum, Mod

105、ern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pOnce the current request is finished, the driver always handles the closest request next rather in FIFS to minimize seek time.pExample for a disk with 40 cylinders: A request comes in to read a block on cylinde

106、r 11. While the seek to cylinder 11 is in progress, new requests come in for cylinders 1, 36, 16, 34, 9, and 12, in that order.pWith FIFS, arm motions numbers are 10, 35, 20, 18, 25 and 3.pWith SSF, the service order is 12, 9, 16, 1, 34, 36, and motion numbers are 1, 3, 7, 15, 33 and 2 (61111).Fig 5

107、-29.Elevator AlgorithmsTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pWith SSF, in a heavily loaded disk, the arm will tend to stay in the middle of the disk most of the time, so the request far from the middle may get poor service (unfair).pE

108、levator algorithm: the arms keep moving in the same direction until there are no more outstanding requests in that direction, then they switch directions.pIt requires the software to maintain the current direction bit: UP or DOWN. Fig 5-30. (a) A disk track with a bad sector. (b) Substituting a spar

109、e for the bad sector. (c) Shifting all the sectors to bypass the bad one.Error Handling (1)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pManufacturing defects introduce bad sectors, i.e., sectors that do not correctly read back what were just

110、 written to them. If the defect is very small, it is possible to let ECC correct the errors.pThere are two general approaches to deal with bad blocks:-In the controller: the disk is tested before being shipped and a list of bad sectors is maintained, and one spare sector is substituted for each bad

111、sector. There are two types of substitutions as illustrated in Figs (b) and (c).Error Handling (2)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pErrors can also develop during normal operation after the drive has been installed.-If ECC cannot

112、handle an error, just try the read again (e.g., transient errors);-If the controller is getting repeated error on a certain sector, it can switch to a spare sector. Here, no data are lost and it is transparent to the OS and user.-If the controller does not have the capability to transparently remap

113、sectors, the OS must first acquire a list of bad sectors, either by reading them from the disk or simply testing the disk;-In this case, the OS must make sure that bad sectors do not occur in any files nor in the free list or bitmaps. One way to do this is to create a secret file consisting of all t

114、he bad sectors (occupied). But the problem is from backup: If the disk is backed up file by file, the OS should hide the bad block file so well that even the back utility cannot find it.If the disk is backed up sector by sector, it will be more difficult.pSeek errors caused by mechanical problems in

115、 the arm also occur.Stable StoragepStable storage: When a write is issued to a disk, it either correctly writes the data or it does nothing, leaving the existing data intact.pAn solution for stable writes/read and crash recovery uses two identical disks based on the following assumptions:1)When a di

116、sk writes a block/sectors, the write error can be detected on a subsequent read by examining the values of the ECC field.2)A correctly written sector can spontaneously go bad and become unreadable. However, such events are so rare that having the same sector go bad on a second drive during a reasona

117、ble time is small enough to ignore.3)The CPU can fail, and any disk write in progress at the moment of failure also stops, leading to incorrect data writing and ECC setting (i.e., crash) pStable storage uses a pair of identical disks with the corresponding blocks working together to form one error-f

118、ree block. To achieve this goal, the following three operations are defined. Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Stable Storage w/n CPU CrashesTo achieve stable storage, the following three operations are definedpStable writes:1) Wri

119、te the block on drive 1, then read it back for validation. 2) If the write is incorrect, repeat the above operations for n times. 3) If it is unsuccessful, the block is remapped onto a spare sector and the operation is repeated until it succeeds. 4) After the write to drive 1 has succeeded, the corr

120、esponding block on drive 2 is written in the same way.pStable reads: 1) Read the block from drive 1 first. 2) If the read fails n time, then read the block from drive 2. According to assumption 2, a stable read always succeeds. pCrash recovery: After a crash, a recovery program scans both disks. If

121、one of them has an ECC error, the bad block is overwritten with the corresponding good block. If both are good but different, the block from driver 1 is written onto drive 2.Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Fig 5-31. Analysis of t

122、he influence of crashes on stable writes.In The Case of CPU CrashesTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639In this case, it depends on precisely when the crash occurs: pIn the cases of (a), (c) and (d), the crashes have no impact on stab

123、le writes/reads;pIn the cases of (b) and (d), there is always one correctly written drive, which can be written to the other one;pThere are also some enhancements to this approach, e.g., keeping track of which block is written.Clock and Clock HardwareTanenbaum, Modern Operating Systems 3 e, (c) 2008

124、 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pClocks (timers) maintain the time of day and prevent one process from monopolizing the CPU, and are essential to the operation of many multi-programmed system.pClock hardware: two types of clocks:-The simpler ones are tied to the 110 or 220-volt

125、 power line and causes an interrupt at 50 or 60 Hz.-The other one is built out of three components: a crystal oscillator, a counter and a holding register. Quartz crystal (石英晶体) can generate a periodic signal of very accuracy in the range of several hundred megahertz. Using electronics, this base si

126、gnal can be multiplied by a small integer to get frequencies up to 1000 MHz or even more.At least one such circuit is usually found in any computer, providing a synchronizing signal to the computers various circuits.This signal is fed into the counter to make it count down to zero. When the counter

127、gets zero, it causes a CPU interrupt.Fig 5-32. A programmableclock.A Programmable Clock.Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pProgrammable clocks typically have several modes of operation.-One slot mode: when the clock is started, it

128、copies the value of the holding register into the counter and then decrements the counter at each pulse from the crystal;When the counter gets zero, it causes an interrupt and stops until it is explicitly started again by the software.-Square-wave mode: after getting to zero and causing the interrup

129、t, the holding register is automatically copied into the counter, and the whole process is repeated again indefinitely. Clock SoftwarepAll the clock hardware does is to generate interrupts at known time interval. Everything else involving time must be done by software.pTypical duties of a clock driv

130、er include:1.Maintaining the time of day ().2.Preventing processes from running longer than they are allowed to.3.Accounting (记账) for CPU usage.4.Handling alarm system calls made by user processes.5.Providing watchdog timers for parts of the system itself.6.Doing profiling, monitoring, statistics ga

131、thering.Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Fig 5-33. Three ways to maintain the time of day.Maintaining The Time of DayTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pIt just r

132、equires incrementing a counter at each clock tick. pThe only thing to watch out for is the number of bits in the time-of day counter. With a clock rate of 60 Hz, a 32-bit counter will overflow just two years (232/60 seconds=2.26y). Three solutions:(a)Set a 64-bit counter, which is expensive;(b)Maint

133、ain the time of day in seconds using a subsidiary counter in ticks;(c)Count in ticks, starting from the time the system was booted rather than relative to a fixed external time (i.e., Jan 1st 1970).Fig 5-34. Simulatingmultiple timers with a single clock.Multiple Timers with A Single ClockTanenbaum,

134、Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pIf many signals are expected, it is more efficient to simulate multiple clocks as follows:-Chain all the pending clock requests together, sorted on time, in a linked list.-Every entry on the list tells how m

135、any clock ticks following the previous one to do wait before causing a signal.-Example: 4200+3, 4203+4, 4207+6, 4213+2 and 4215+1.Soft TimerspGenerally, there are two ways to manage I/O by CPU: -Interrupt: low latency but with large overhead caused by context switching.-Polling: substantial latency,

136、 which is half the polling interval on average. pFor some applications, neither the overhead of interrupts nor the latency of polling is acceptable (e.g., high-speed networks).-Soft timers is adopted, which is a second programmable clock that can be set to cause interrupts at whatever rate a program

137、 needs as follows(reducing the cost for interrupts):Whenever the kernel is running for some other reason, just before it returns to user mode it checks the real time clock to see if a soft timer expires;If the timer has expired, the scheduled event is performed with no need to switch into kernel mod

138、e since it is already in this mode;After the work has been performed, the soft timer is reset to go off again (copying the current clock and adding the timeout interval to it). pSoft timers stand or fall with the rate at which kernel entries (i.e., system calls, TLB misses, page faults, I/O interrup

139、ts and the CPU going idle) are made for other reasons.Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639User InterfacespEvery general-computer has a keyboard and monitor as well as usually a mouse to allow people to interact with it, and user inpu

140、t comes primarily from the keyboard and mouse.pThe following issues to be addressed:-Input software:Keyboard software ()Mouse software ()-Output softwareText windows ()The X-Window systemGraphical user interfaceBitmaps ()Fonts ()Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. A

141、ll rights reserved. 0-13-6006639Keyboard HardwareTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pThe keyboard contains an embedded microprocessor which usually communicates through a special serial port with a controller chip on the parentboard

142、 (although increasingly keyboards are connected by a USB port). pAn interrupt is generated whenever a key is struck and a second is generated whenever a key is released. In this case, some strike combinations can be formed.pAt each of these keyboard interrupts, the keyboard driver extracts the infor

143、mation about what happens from the I/O port associated with the keyboard.pEverything else happens in software and is pretty much independent of the hardware.pThe number in the I/O port is the key number (called the scan code), not the ASCII code.Keyboard SoftwareTanenbaum, Modern Operating Systems 3

144、 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pKeyboards have fewer than 128 keys, so only 7 bits are needed to represent the key number. The eighth bit is set to 0 on a key press and to 1 on a key release.pIt is up to the driver to keep track of the status of each key (e.g., upp

145、er case or lower case) since the driver call can tell which keys have been struck but not yet released, so it has enough information to do the job.pTwo philosophies can be adopted for the driver:-The drivers job is just to accept input and pass it upward unmodified, which allows the user to bind an

146、arbitrary action to any character or sequence of characters (character-oriented, for sophisticated screen editor, e.g., emacs).-Some programs just want corrected input but not the exact sequence of how it was produced. So, the driver handles all the intra-line editing, and just delivers corrected li

147、nes to the user programs (line-oriented).Characters must be stored until the entire line has been accumulated, because the user may subsequently decide to change part of it.Keyboard and MonitorsTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pEc

148、hoing: Many users have grown accustomed to seeing the characters they have just typed appear on the screen. But keyboard and monitor are logically separate devices.-Echoing is complicated by the fact that a program may be writing to the screen while the user is typing. At the very least, the keyboar

149、d driver has to figure out where to put the new input without it being overwritten by program output.-Echoing also get complicated when more than 80 characters have to be displayed in a window with 80-character lines (or some other numbers): wrapping around or truncating lines is required.pTab handl

150、ing: It is usually up to the driver to compute where the cursor is currently located, taking into account both output from programs and output from echoing, and compute the proper number of spaces to be echoed.Mouse SoftwareTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All ri

151、ghts reserved. 0-13-6006639pMouse types: Rubber ball mouse and optical mice.pMice can have one, two or three buttons, some can have wheels that can send additional data back to the computer.pWhenever a mouse has moved a certain minimum distance in either direction (The minimum distance is about 0.1m

152、m, which is called micky) or a button is depressed or released, a message is sent to the computer.pThe message contains three items: -x, y: the changes in x and then y positions since the last message;-The status of buttons (i.e., pressed or released).pThe mouse only indicates changes in positions,

153、not absolute position itself.pSome GUIs distinguish between single clicks and double click of a mouse button.Output: Text Windows (1)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pOutput is simpler than input when the output is sequentially in

154、 a single font, size and color.pFor the most part, the program sends characters to the current window where they are going to be displayed.pScreen editors and many other sophisticated programs need to be able to update the screen in complex ways (e.g., replacing one line in the middle of the screen)

155、.pTo accommodate this need, most output drivers support a series of commands to move the cursor, insert and delete characters or lines at the cursor (called escape sequences).pHowever, there were hundreds of terminal types, each with its own escape sequences. Consequence, it is difficult to write so

156、ftware that worked on more than one terminal type.Fig 5-36. The ANSI escape sequences accepted by the terminal driver on output. ESC denotes the ASCII escape character (0x1B), and n, m, and s are optional numeric parameters.Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All ri

157、ghts reserved. 0-13-6006639Output: Text Windows (2)pStandardization is required, so an ANSI standard was developed, and a few values are listed below:Fig 5-41. An example rectangle drawn using Rectangle. Each box represents one pixel.Bitmaps (1)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prent

158、ice-Hall, Inc. All rights reserved. 0-13-6006639pVector graphics: It is used to place geometric figures and texts on the screen, and device independent.pA collection of calls to GDI (Graphic Device Interface) procedures can be assembled in a file for complex drawing metafile (图元文件).pThe average red,

159、 green and blue values of each grid square are sampled and saved as the value of one pixel Bitmap.pBitmaps do not scale.Fig 5-42. Copying bitmaps using BitBlt. (a) Before. (b) After.Bitmaps (2)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639p An

160、other use for bitmaps is for text: One way to represent a particular character in some font is as a small bitmapp Adding the text to the screen then becomes a matter of moving bitmaps.Fig 5-43. Some examples of character outlines at different point sizes.TrueType FontsTanenbaum, Modern Operating Sys

161、tems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639p Each TrueType character is defined by a sequence of points around its perimeter. All the points are related to the (0,0) origin.p Scaling character: multiply each coordinate by the same scale factor.p Once at the proper size,

162、the points are connected using the follow-the-dot algorithm.p After the outline has been completed, the character can befilled in.Fig 5-44. The THINC protocol display commands.Thin ClientsTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pCentrali

163、zed computers versus distributed computers (e.g, PC):-Each PC has a large hard disk and complex software that must be maintained.-At most corporations, the labor costs of doing this kind of software maintenance dwarf the actual hardware and software costs, and many individuals cannot do it.-Users sh

164、ould make regular backups of their gigabyte file systems.-Resource sharing with PCs (e.g., memory, hard disk) is very difficult or impossible.-Now there is a shit from PC-centric computing to Web centric computing.-Most users want high-performance interactive computing but do not really want to admi

165、nister a computer, e.g., via the timesharing using dumb terminals (thin terminal).-The user machines had no software at all, just acts as a display, for example.Power ManagementTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pNowadays, power man

166、agement for computer is an important issue, and the OS plays a role here since it controls all devicespDesktop PCs:-It often has a 200-watt power supply typically with an efficiency of 85% and a loss of 15% to heat;-If 100 million of these PCs are turned on at once worldwide, together they use 20,00

167、0 megawatts of electricity, which is the total output of 20 nuclear power plants.pBatter-powered computers (notebooks, handhelds ):-Make computers use less energy to existing batteries last longer.pTwo approaches are used to reduce energy consumption:- The OS turns off parts of computer (mostly I/O

168、devices);-Application program uses less energy, possibly by degrading the quality of the user experience.Hardware IssuesTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639p The general approach for battery conservation is to have multiple states: o

169、n, sleeping, hibernation, and off. p To use the device, it must be on. Getting a device out of hibernation often takes more time and energy than getting it out of sleeping state.p Managing the state transitions at the right moment is an critical issue, and many other issues need to be addressed (wha

170、t and how).Fig 5-45. Power consumption of various parts ofa notebookcomputer.OS IssuesTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pSince the OS controls all the devices, it must decide what to shut down and when to shut it down.-If a shut-do

171、wn device is needed again quickly, there may be an annoying delay while it is restarted.-If it waits too long to shut down a device, energy is wasted.pGetting a device out of hibernation often takes more time and energy than getting it out of sleeping state.pFind algorithms and heuristics that let t

172、he OS make good decisions.pMajor parts to be addressed: -Display: shutting down the display when there has been no activity for some time.-Hard disk: 1) spinning the disk down after some time of inactivity; 2) having a substantial disk cache in RAM.-CPU: whenever the CPU goes idle, it goes to sleep,

173、 and is waken up by an interrupt.-Memory: switching off the cache after flushing and memory after writing it to disk. -Wireless communication: reducing the time of always-on-state.-Thermal management: when the temperature is very high, the OS switches on fan or reduces power consumption by reducing

174、the backlighting of the screen;-Battery management: using smart battery for the OS to take proper actions.Application Program IssuesTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639pTell the program to use less energy, even if this means providin

175、g a poorer user experience.pThis information is passed on when the battery charge is below some threshold.pIt is up to the programs to decide between degrading performance to lengthen battery life or maintain performance and risk running out of energy.pHow can a program degrade its performance to sa

176、ve energy?-When no degradation is present, the best possible information is presented;-When degradation is present, the fidelity (accuracy) of the information to the user is worse than what it could have been seen.-Example: play a color video in white and black, or reduce the frame rate, which leads

177、 to flicker and gives the movie a jerky quality. The EndFigure 5-20. RAID levels 0 through 5. Backup and parity drives are shown shaded.RAID (1)passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-20. RAID levels 0 through 5. Backup and

178、parity drives are shown shaded.RAID (2)passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-21. Recording structure of a compact disc or CD-ROM.CD-ROMs (1)passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All righ

179、ts reserved. 0-13-6006639Figure 5-22. Logical data layout on a CD-ROM.CD-ROMs (2)passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-23. Cross section of a CD-R disk and laser. A silver CD-ROM has similar structure, except without dye l

180、ayer and with pitted aluminum layer instead of gold layer.CD-Recordables (1) passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639DVD (1)passDVD Improvements on CDs1.Smaller pits (0.4 microns versus 0.8 microns for CDs).2.A tighter spiral (0.74 m

181、icrons between tracks versus 1.6 microns for CDs).3.A red laser (at 0.65 microns versus 0.78 microns for CDs).Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639DVD (2)passDVD Formats1.Single-sided, single-layer (4.7 GB).2.Single-sided, dual-layer

182、(8.5 GB).3.Double-sided, single-layer (9.4 GB).4.Double-sided, dual-layer (17 GB).Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-24. A double-sided, dual-layer DVD disk.DVD (3)passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prent

183、ice-Hall, Inc. All rights reserved. 0-13-6006639Fig 5-35. Charactersthat are handled specially in canonical mode.Keyboard Software (pass)Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639p?Figure 5-37. Clients and servers in the M.I.T. X Window Sy

184、stem.The X Window System (2) passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639The X Window System (3) passTypes of messages between client and server:1.Drawing commands from the program to the workstation.2.Replies by the workstation to progr

185、am queries.3.Keyboard, mouse, and other event announcements.4.Error messages.Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-38. A skeleton of an X Window application program.Graphical User Interfaces (1) passTanenbaum, Modern Operating

186、 Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639. . .Figure 5-38. A skeleton of an X Window application program.Graphical User Interfaces (2) passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639. . .Figure 5-39. A sam

187、ple window located at (200, 100) on an XGA display.Graphical User Interfaces (3) passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-40. A skeleton of a Windows main program.Graphical User Interfaces (4) passTanenbaum, Modern Operating

188、Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639. . .Figure 5-40. A skeleton of a Windows main program.Graphical User Interfaces (5) passTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639. . .Fig 5-46. The use of zones f

189、or backlighting the display. (a) When window 2 is selected it is not moved. (b) When window 1 is selected, it moves to reduce the number of zones illuminated.Power Management: The DisplayTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Fig 5-47. (a) Running at full clock speed. (b) Cutting voltage by two cuts clock speed by two and power consumption by four.Power Management: The CPUTanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号