A computer system consists of hardware, system programs, and application programs figs 5

52 404 0
A computer system consists of hardware, system programs, and application programs figs 5

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

MULTIPROCESSORS 8.2 MULTICOMPUTERS 8.3 DISTRIBUTED SYSTEMS 8.4 RESEARCH ON MULTIPLE PROCESSOR SYSTEMS 8.5 SUMMARY

5 INPUT/OUTPUT 5.1 PRINCIPLES OF I/O HARDWARE 5.2 PRINCIPLES OF I/O SOFTWARE 5.3 I/O SOFTWARE LAYERS 5.4 DISKS 5.5 CLOCKS 5.6 CHARACTER-ORIENTED TERMINALS 5.7 GRAPHICAL USER INTERFACES 5.8 NETWORK TERMINALS 5.9 POWER MANAGEMENT 5.10 RESEARCH ON INPUT/OUTPUT 5.11 SUMMARY Device Keyboard Mouse 56K modem Telephone channel Dual ISDN lines Laser printer Scanner Classic Ethernet USB (Universal Serial Bus) Digital camcorder IDE disk 40x CD-ROM Fast Ethernet ISA bus EIDE (ATA-2) disk FireWire (IEEE 1394) XGA Monitor SONET OC-12 network SCSI Ultra disk Gigabit Ethernet Ultrium tape PCI bus Sun Gigaplane XB backplane Data rate 10 bytes/sec 100 bytes/sec KB/sec KB/sec 16 KB/sec 100 KB/sec 400 KB/sec 1.25 MB/sec 1.5 MB/sec MB/sec MB/sec MB/sec 12.5 MB/sec 16.7 MB/sec 16.7 MB/sec 50 MB/sec 60 MB/sec 78 MB/sec 80 MB/sec 125 MB/sec 320 MB/sec 528 MB/sec 20 GB/sec Fig 5-1 Some typical device, network, and bus data rates Two address 0xFFFF… One address space Two address spaces Memory I/O ports (a) (b) (c) Fig 5-2 (a) Separate I/O and memory space (b) Memory-mapped I/O (c) Hybrid CPU reads and writes of memory go over this high-bandwidth bus CPU Memory All addresses (memory and I/O) go here (a) I/O CPU Memory I/O This memory port is to allow I/O devices access to memory Bus (b) Fig 5-3 (a) A single-bus architecture (b) A dual-bus memory architecture Drive CPU CPU programs the DMA controller DMA controller Main memory Disk controller Buffer Address Count Control Interrupt when done Ack DMA requests transfer to memory Data transferred Bus Fig 5-4 Operation of a DMA transfer CPU CPU acks interrupt Interrupt controller Device is finished Disk Keyboard Controller issues interrupt 11 12 10 Clock Printer Bus Fig 5-5 How an interrupt happens The connections between the devices and the interrupt controller actually use interrupt lines on the bus rather than dedicated wires User space String to be printed Printed page Printed page ABCD EFGH A Next Kernel space ABCD EFGH (a) (b) Fig 5-6 Steps in printing a string AB Next ABCD EFGH (c) copy from user(buffer, p, count); for (i = 0; i < count; i++) { while (*printer status reg != READY) *printer data register = p[i]; } return to user( ); /* p is the kernel bufer */ /* loop on every character */ ;/* loop until ready */ /* output one character */ Fig 5-7 Writing a string to the printer using programmed I/O copy from user(buffer, p, count); if (count == 0) { enable interrupts( ); unblock user( ); while (*printer status reg != READY) ; } else { *printer data register = p[0]; *printer data register = p[i]; scheduler( ); count = count − 1; i = i + 1; } acknowledge interrupt( ); return from interrupt( ); (a) (b) Fig 5-8 Writing a string to the printer using interrupt-driven I/O (a) Code executed when the print system call is made (b) Interrupt service procedure copy from user(buffer, p, count); set up DMA controller( ); scheduler( ); (a) acknowledge interrupt( ); unblock user( ); return from interrupt( ); (b) Fig 5-9 Printing a string using DMA (a) Code executed when the print system call is made (b) Interrupt service procedure Escape sequence ESC [ n A ESC [ n B ESC [ n C ESC [ n D ESC [ m ; n H ESC [ s J ESC [ s K ESC [ n L ESC [ n M ESC [ n P ESC [ n @ ESC [ n m ESC M Meaning Move up n lines Move down n lines Move right n spaces Move left n spaces Move cursor to (m,n) Clear screen from cursor (0 to end, from start, all) Clear line from cursor (0 to end, from start, all) Insert n lines at cursor Delete n lines at cursor Delete n chars at cursor Insert n chars at cursor Enable rendition n (0=normal, 4=bold, 5=blinking, 7=reverse) Scroll the screen backward if the cursor is on the top line Fig 5-37 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 CPU Graphics adapter Memory Video RAM Bus Video controller Analog video signal Parallel port Fig 5-38 With memory-mapped displays, the driver writes directly into the display’s video RAM Video RAM Screen RAM address A BCD 0123 25 lines …×3×2×1×0 …×D×C×B×A 0×B00A0 0×B0000 160 characters 80 characters (a) (a) Fig 5-39 (a) A video RAM image for a simple monochrome display in character mode (b) The corresponding screen The ×s are attribute bytes (1023, 0) (0, 0) (200, 100) Menu bar Tool bar Title bar File Edit View Tools Options Help 11 12 10 Thumb Client area Scroll bar Window (0, 767) (1023, 767) Fig 5-40 A sample window located at (200, 100) on an XGA display #include int WINAPI WinMain(HINSTANCE { WNDCLASS wndclass; MSG msg; HWND hwnd; h, HINSTANCE, hprev, char *szCmd, int iCmdShow) /* class object for this window */ /* incoming messages are stored here */ /* handle (pointer) to the window object */ /* Initialize wndclass */ wndclass.lpfnWndProc = WndProc; /* tells which procedure to call */ wndclass.lpszClassName = "Program name"; /* Text for title bar */ wndclass.hIcon = LoadIcon(NULL, IDI APPLICATION);/* load program icon */ wndclass.hCursor = LoadCursor(NULL, IDC ARROW); /* load mouse cursor */ RegisterClass(&wndclass); /* tell Windows about wndclass */ hwnd = CreateWindow ( ) /* allocate storage for the window */ ShowWindow(hwnd, iCmdShow); /* display the window on the screen */ UpdateWindow(hwnd); /* tell the window to paint itself */ while (GetMessage(&msg, NULL, 0, 0)) { /* get message from queue */ TranslateMessage(&msg); /* translate the message */ DispatchMessage(&msg); /* send msg to the appropriate procedure */ } return(msg.wParam); } long CALLBACK WndProc(HWND hwnd, UINT message, UINT wParam, long lParam) { /* Declarations go here */ } switch (message) { case WM CREATE: ; return ; /* create window */ case WM PAINT: ; return ; /* repaint contents of window */ case WM DESTROY: ; return ; /* destroy window */ } return(DefWindowProc(hwnd, message, wParam, lParam));/ * default */ Fig 5-41 A skeleton of a Windows main program Fig 5-42 An example rectangle drawn using Rectangle Each box represents one pixel 8 8 8 Window Window 2 8 Window Window (a) (b) Fig 5-43 Copying bitmaps using BitBlt (a) Before (b) After 20 pt: 53 pt: 81 pt: Fig 5-44 Some examples of character outlines at different point sizes Remote host Window manager Application program X terminal Motif User space Window Intrinsics Xlib X client UNIX UNIX Hardware Kernel space X server Hardware X protocol Network Fig 5-45 Clients and servers in the M.I.T X Window System #include #include main(int argc, char *argv[]) { Display disp; Window win; GC gc; XEvent event; int running = 1; /* server identifier */ /* window identifier */ /* graphic context identifier */ /* storage for one event */ disp = XOpenDisplay("display name"); /* connect to the X server */ win = XCreateSimpleWindow(disp, ); /* allocate memory for new window */ XSetStandardProperties(disp, ); /* announces window to window mgr */ gc = XCreateGC(disp, win, 0, 0); /* create graphic context */ XSelectInput(disp, win, ButtonPressMask | KeyPressMask | ExposureMask); XMapRaised(disp, win); /* display window; send Expose event */ while (running) { XNextEvent(disp, &event); /* get next switch (event.type) { case Expose: ; break; case ButtonPress: ; break; case Keypress: ; break; } } XFreeGC(disp, gc); XDestroyWindow(disp, win); XCloseDisplay(disp); } event */ /* repaint window */ /* process mouse click */ /* process keyboard input */ /* release graphic context */ /* deallocate window’s memory space */ /* tear down network connection */ Fig 5-46 A skeleton of an X Window application program Computer center Disks Dedicated network connection Server(s) Switch Fig 5-47 The architecture of the SLIM terminal system Thin client Message SET FILL BITMAP COPY CSCS Meaning Update a rectangle with new pixels Fill a rectangle with one pixel value Expand a bitmap to fill a rectangle Copy a rectangle from one part of the frame buffer to another Convert a rectangle from television color (YUV) to RGB Fig 5-48 Messages used in the SLIM protocol from the server to the terminals Device Li et al (1994) Lorch and Smith (1998) Display 68% 39% CPU 12% 18% Hard disk 20% 12% Modem 6% Sound 2% Memory 0.5% 1% Other 22% Fig 5-49 Power consumption of various parts of a laptop computer Window Window Window Window Zone (a) (b) Fig 5-50 The use of zones for backlighting the display (a) When window is selected it is not moved (b) When window is selected, it moves to reduce the number of zones illuminated 0.75 Power 1.00 0.75 Power 1.00 0.50 0.25 0 T/2 Time (a) T 0.50 0.25 0 T/2 T Time (b) Fig 5-51 (a) Running at full clock speed (b) Cutting voltage by two cuts clock speed by two and power consumption by four ... line, one bit at a time Terminal data structure Terminal data structure Central buffer pool Terminal Terminal Buffer area for terminal Buffer area for terminal (a) (b) Fig 5- 35 (a) Central buffer... diode Fig 5- 22 Cross section of a CD-R disk and laser (not to scale) A silver CD-ROM has a similar structure, except without the dye layer and with a pitted aluminum layer instead of a gold layer... video RAM Video RAM Screen RAM address A BCD 0123 25 lines …×3×2×1×0 …×D×C×B? ?A 0×B0 0A0 0×B0000 160 characters 80 characters (a) (a) Fig 5- 39 (a) A video RAM image for a simple monochrome display

Ngày đăng: 28/04/2014, 16:35

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan