Content. 5: Input/Output. I/O Devices. Principles of I/O hardware. I/O Devices. I/O Devices

Size: px
Start display at page:

Download "Content. 5: Input/Output. I/O Devices. Principles of I/O hardware. I/O Devices. I/O Devices"

Transcription

1 Content 5: Input/Output Principles of I/O hardware Principles of I/O Software I/O software layers Disks Clocks Power management 1 2 Principles of I/O hardware People look at hardware in different ways EE people look at hardware in terms of: Chips, wires, power suppliers, motors, etc. i.e. physical components that make up it Programmers look at the interface Commands, functions, and errors reported back I/O Devices Roughly classified into two classes: Block devices and character devices One stores data in fixed-sized blocks Blocks are addressable The other in/outputs a stream of characters Characters are not addressable 3 4 I/O Devices Example of block devices: Disks, tapes (?) Example of character devices: Mouse, keyboard, printers, NIS Some devices do not fit in any class Clocks (can it be considered a IO device?) I/O Devices IO devices cover a wide range in speeds Puts pressure on software to perform well Need to hid the discrepancies in IO speed So that user operation is independent of it 5 6 1

2 Data Rate of Typical Devices Data Rate of Typical Devices Device Keyboard Mouse 56K modem Telephone channel Dual ISDN lines Laser printer Scanner Data Rate (per second) 10 bytes 100 bytes 7 KB 8 KB 16 KB 100 KB 400 KB Device Classic Ethernet USB Digital camcorder IDE disk 40x CD-ROM Fast Ethernet ISA bus EIDE (ATA-2) disk Data Rate 1.25 MB 1.5 MB 4 MB 5 MB 6 MB 12.5 MB 16.7 MB 16.7 MB 7 8 Data Rate of Typical Devices Device Controllers Device FireWire XGA monitor SONET OC-12 SCSI Ultra 2 disk Gigabit Ethernet Ultrium tape PCI bus Sun Gigaplane XB backplane Data Rate 50 MB 60 MB 78 MB 80 MB 125 MB 320 MB 528 MB 20 GB I/O devices have components: mechanical component electronic component Electronic component is device controller may be able to handle multiple devices Also called adapter Often takes the form of a printed circuit card 9 10 Device Controllers Device Controllers Controller's tasks Control the physical operation of the device convert serial bit stream to block of bytes perform error correction as necessary

3 Device Controllers Exchange data with CPU via registers By writing into these registers OS can command it to deliver or accept data Or switch the device on or off By reading from the registers OS can learn the status of the device Device Controllers In addition, controllers often have buffers Which the OS can read or write Ex: a video controller may have Video RAM A data buffer programs can write or read I/O Approaches 3 ways for CPU to communicates with the control registers and its device buffers Dedicated I/O Memory-mapped I/O Hybrid Dedicated I/O Each control register assigned an IO port i.e. an 8 or 16 bit integer IO port and memory are separate OS uses special instructions to read/write IN REG, PORT for reading from the device OUT PORT, REG for writing to the device Dedicated I/O Computers use dedicated I/O include Early computers, mainframes (IBM 360/370) Problems with this approach? Controls are at low-level No high level languages has IN/OUT operations Protections can be problematic Memory-Mapped I/O An alternative to Dedicated I/O Each control register is assigned a unique memory address Input/output done by reading/writing to the designated memory addresses Just like a ordinary memory access Introduced in PDP-11 computer

4 Hybrid Approach Memory-mapped data buffer Dedicated I/O ports For example, Pentium use address: 640K to 1M for device data buffers 0 to 64K for I/O ports Memory-Mapped I/O 2 address 1 address space 2 address space memory 0xFFFF I/O ports 0 (a) (b) (c) Dedicated I/O Memory-mapped I/O Hybrid Memory-Mapped I/O Problems for memory-mapped I/O? Cache cause problems For 1-bus system, both memory and device have to examine addresses on the bus For system with multiple memory buses: Devices may not see the addresses on the bus Memory-Mapped I/O (a) A single-bus architecture A dual-bus memory architecture Memory-Mapped I/O Address Filtering in Pentium Many ways to solve the multiple buses issue Fail and try If memory fails to respond, try other buses Snooping A snooping device on the bus passes to devices Address filtering

5 Direct Memory Access Memory-mapped or not, CPU needs to address controllers to exchange data Can request data one byte at a time Or request data in bulk This is accomplished via DMA Direct Memory Access Can use only if there is DMA controller DMA controller can be built in device controller requires one DMA controller for each device More commonly, a single DMA controller One the parentboard Direct Memory Access Direct Memory Access DMA controller vary in sophistication Simplest one handles 1 transfer at a time Complex one have multiple channels With each channel deals with one device Operation of a DMA transfer Issues with DMA How to access the bus? Cycle stealing or burst mode? Where to store the data? Directly into memory or in DMA buffer? How to address the memory? Virtual or physical address? Pros and Cons of DMA + free up CPU - Use CPU instead of DMA if: Device speed is fast if CPU has nothing else to do Save money (by getting rid of DMA)

6 Principles of I/O Software Device independence is a key concept OS Program should access all I/O devices in same or similar ways i.e. without specify the device in advance Ex: when reading a file, do not care if The file is in floppy, disk, or CD-ROM Principles of I/O Software This is the responsibility of I/O software Goals of I/O Software Device independence programs can access any I/O device without specifying device in advance (floppy, hard drive, or CD-ROM) Goals of I/O Software Uniform naming name of a file or device a string or an integer not depending on which machine Error handling handle as close to the hardware as possible Goals of I/O Software Synchronous vs. asynchronous transfers blocked transfers vs. interrupt-driven Buffering data coming off a device cannot be stored in final destination right away Goals of I/O Software Sharable vs. dedicated devices Make dedicated devices appear sharable Some devices are not sharable Disks are sharable Printer can be made sharable Tape drives would not be sharable

7 Programmed I/O Three different ways to perform I/O Programmer I/O is the simplest Interrupt-driven is the most common DMA I/O used to improve efficiency Programmed I/O CPU wait for the I/O to complete This is called Polling or Busy waiting Very bad But simple to program Programmed I/O Programmed I/O Copy_from_user(buffer,p,count) /*p is kernel buffer */ For (i=0;i<count;i++) { /*loop on every character*/ while(*printer_status_reg!=ready); /*loop until ready*/ *printer_data_register=p[i]; /*output one character*/ } Return_to_user(); Writing a string to printer using programmed I/O Steps in printing a string Interrupt-Driven I/O Interrupt-Driven I/O CPU setups and start I/O operation CPU goes off to do other things When I/O is done, CPU is interrupted CPU handles the interrupt CPU resumes interrupted operation

8 Interrupt-Driven I/O Code executed when print system call is made Copy_from_user(buffer,p,count) Enable_interrupts(); while(*printer_status_reg!=ready); *printer_data_register=p[0]; Scheduler(); Interrupt-Driven I/O Interrupt service procedure If(count==0){ unblock_user(); } else { *printer_data_register=p[i]; count-count-1; i=i+1; } acknowledge interrupt(); return_from_intertupt(); I/O Using DMA An obvious con for interrupt-driven I/O is the frequent interrupts The solution is to use DMA I/O Using DMA Idea is to let DMA controller handle the I/O one character at a time In other words, busy wait with DMA I/O Using DMA Printing a string using DMA Copy_from_user(buffer,p,count); acknowledge_interrupt(); Set_up_DMA_controller(); unblock_user(); Scheduler(); return_from_interrupt); (a) (b) I/O Software Layers IO software are organized into layers Each layer has a: Well-defined function to perform Well-defined interface to the adjacent layer Exact division differs by systems

9 I/O Software Layers User-level I/O software Device independent operating system software Device drivers Interrupt handlers Hardware I/O Software Layer Interrupt Handlers Most I/O are interrupt-driven Only rarely programmed I/O is used Therefore interrupt handlers is an integral part of the I/O software Interrupt Handlers Interrupt handlers are best hidden So as little of OS know about it as possible Best way to hid is to: have the driver starting an I/O operation block until interrupt notifies of completion A drive can block itself by performing a down ops on a semaphore or other methods Interrupt Handlers When notified of an interrupt: The interrupt procedure does its task then unblocks the driver that started the I/O Interrupt handler unblocks the driver by: Sending a signal Perform an up operation on a semaphore Interrupt Steps Save registers that are not already saved by interrupt hardware Set up context for interrupt handler Set up stack for interrupt handler Ack interrupt controller Reenable interrupts Interrupt Steps Copy registers from where saved Run service procedure Setup MMU for process to run next Load new process' registers Start running the new process

10 Device Drivers The software that talks to the controller Device specific Tailored to individual device characteristics Written by device manufacturers Part of the OS Kernel Device Drivers Know about the details of the devices Disk driver knows about sectors, tracks, cylinders, heads, arm motions, motor drives Mouse driver knows about button pressed Device Drivers Device drivers tasks: Accept abstract read/write requests from device-independent software above it See that read/write requests carried out Initialize device, turn on/off device Power management for device Device Drivers Communications between drivers and device controllers goes over the bus Logical position of device drivers Device Drivers Most OS define a standard interfaces for Block devices Character devices The interface consists of a number of procedures that the rest of OS can call Device Drivers On UNIX, OS is a single binary with device drivers compiled into it Adding new drivers or modifying existing ones means recompile the OS

11 Device Drivers In Windows, drivers are dynamically loaded Device Driver Operation Checking input parameters to see if valid If not, report error Translate abstract request to concrete convert a linear block # to head, track, sector... Check device is busy If yes, request queued for later process Device Driver Operation Check hardware status to see if the request can be handled now May need to turn on the device Or start a motor Control the operation by issuing a sequence of commands to the device registers Device Driver Operation Block itself and wait for interrupt Upon waking up, check for I/O errors Pass data to the layer above it Return status to its caller Device-Independent I/O Software Some I/O software is device specific But some are not! Basic function is to: Perform IO ops that are common to all devices Provide uniform interface to user-level software Device-Independent I/O Software Uniform interfacing for device drivers Buffering Error reporting Allocating and releasing dedicate devices Providing a deice-independent block size Functions of the device-independent I/O software

12 Device-Independent I/O Software Exact boundary between drivers & device independent software is device dependent Uniform Interfacing Make all devices look the same or similar By standardizing driver interface Specify the functions a driver provides Specify kernel function a driver can call Uniform Interfacing Buffering Buffering is indispensable in I/O It speed up the data transfer It synchronize between CPU and devices It prevents overflow Without a standard driver interface With a standard driver interface Buffering Drawback of Buffering Slows down performance Unbuffered Buffer in user space Buffer in kernel Double buffer followed by in the kernel copying to user space

13 Drawback of Buffering Error Reporting Errors far more common in I/O Due to interfacing with outside world Errors inside the computer case are rare Error reporting depends on types of error Networking may involve many copies Error Reporting Programming errors Process ask for something impossible Read from an output device Actual I/O errors Accessing a damaged part of disk Error Reporting For programming errors, just report error back to the caller For actual I/O errors, May take corrective measures May ask the caller what to do May simply fail and return an error code User-Space I/O Software It is often convenient for some part of I/O software to run in the user space Most OS do put part of IO in user space! User-Space I/O Software Ex: Count = write(fd, buffer, nbytes) Library routine write will be linked with the program and contained in the binary program present in memory at run time

14 User-Space I/O Software User-Space I/O Software Other I/O functions in user space include: Format: Scanf and printf Spooling Spooling daemon runs as a user process I/O system Layers and their main functions Disks Come in a variety of types Magnetic disks: hard disk and floppy disks Optical disks: CD-ROM, CD-RW, DVD Magnetic Disks Integral part of a computer system Some contains a microcontroller IDE Disks Some have little electronics and just deliver a simple serial bit of stream Let the device controller do the work! Magnetic Disks Some disks offer parallel processing Doing seek on two ore more drives Overlapped seeks Read/write while seeking on another drive Floppy disk cannot offer parallelism Disk Drives Disks are usually organized into drives A drive may have up to 16 disks With each disk having its own read/write head Read data from one disk at a time

15 Tracks and Cylinders The surface of a disk is divided in tracks A track is one cycle All tracks of a disk drive forms a cylinder A disk drive can have up to 16 disks Each track is further divided into sectors A sector is the basic unit of I/O Disk Drives Sector Sectors Numbered from 0 to some maximum Sectors can either be continuous i.e. logically adjacent = physical adjacent Or interleave i.e. logically adjacent!= physical adjacent Sectors Interleaving factor: Physical distance between logically adjacent sectors on a track Gaps are maintained between sectors This allows continuous read Sectors Non-interleaving Interleaving Disk Read/Write Process First move head to the correct cylinder seek Wait for the sector to pass by the head rotation Actually read/write data transfer

16 Terms Locality of Reference: When record is read from disk, next request is likely to come from near the same place in the file Cluster: Smallest unit of file allocation, usually several sectors Terms Extent: A group of physically contiguous clusters Internal fragmentation: Wasted space within sector if record size does not match sector size; wasted space within cluster if file size is not a multiple of cluster size Seek Time Time for I/O head to reach desired track. Largely determined by distance between I/O head and desired track Track-to-track time: time to move from track to an adjacent track Average Seek time: Average time to reach a track for random access Other Factors Rotational Delay or Latency: Time for data to rotate under I/O head One half of a rotation on average At 7200 rpm, this is 8.3/2 = 4.2ms Transfer time Time for data to move under the I/O head At 7200 rpm: Number of sectors read/number of sectors per track * 8.3ms Disk Spec Example 16.8 GB disk with 10 platters 1.68GB/platter 13,085 tracks/platter 256 sectors/track 512 bytes/sector

17 Disk Spec Example Track-to-track seek time: 2.2 ms Average seek time: 9.5ms 4KB clusters, 32 clusters/track Interleaving factor of RPM Disk Access Cost Example Read a 1MB file divided into 2048 records of 512 bytes (1 sector) each Assume all records are on 8 contiguous tracks First track: /2 + 3 x 11.1 = 48.4 ms Remaining 7 tracks: /2 + 3 x 11.1 = 41.1 ms Total: * 41.1 = 335.7ms Disk Access Cost Example Read a 1MB file divided into 2048 records of 512 bytes (1 sector) each Assume all file clusters are randomly spread across the disk 256 clusters. Cluster read time is (3 x 8)/256 of a rotation for about 1 ms 256( /2 + (3 x 8)/256) is about 3877 ms. or nearly 4 seconds How Much to Read Read time for one track: /2 + 3 x 11.1 = 48.4ms Read time for one sector /2 + (1/256)11.1 = 15.1ms How Much to Read Disk Specification Read time for one byte : /2 = ms Nearly all disk drives read/write one sector at every I/O access Also referred to as a page

18 Physical Geometry Physical Geometry of a Disk Different tracks have different lengths Outer tracks are longer than inner tracks thus tracks may have differing # of sectors But this cause difficult to OS Solution is to provide a virtual geometry A possible virtual geometry for this disk IBM 75GXP Specification Size: 4 6 1, Capacity: 76GB RPM: 7200 Platters: 5 Sectors per track: Data rate: Mbps Virtual Specification Number of tracks: Sectors per track: 512 Average seek time: 9.2ms Track density: 28350/in RAID Redundant Array of Inexpensive Disks A type of disk organization Goal: improve performance and reliability Idea: use multiple disks (drives) as 1 unit Key technique: stripe RAID Depending on how stripe is accomplished RAID can be classified into 6 levels RAID 0: stripe in blocks, no redundancy RAID 1: full redundancy, may or may not stripe RAID 2: stripe in bits, 1 bit dedicated ECC

19 RAID Raid levels 0 through 2 RAID 3: stripe in words, more ECC RAID 4: stripe in blocks with dedicated ECC RAID 5: stripe in blocks with round-robin ECC RADI 2 and 3 require disk synchronization Raid levels 3 through 5 Disk Formatting Disk must be formatted to be useful Format involves writing basic information into the disk: Sector information, boot information Partition tables A disk sector Disk Formatting The preamble contains some pattern that allows the hardware to recognize the start of a sector ECC contains error correction code for data recovery Cylinder Skew To allow continuous read of data across cylinders, the numbering of sectors in neighboring cylinders are gapped To allow continuous read of data in the same track, sector may also be skewed

20 Cylinder Skew Sector Interleaving An illustration of cylinder skew No interleaving Single interleaving Double interleaving Disk Arm Scheduling Time required to read or write a disk block determined by 3 factors Seek time Rotational delay Actual transfer time Seek time dominates Disk Arm Scheduling Therefore scheduling goal is to minimize seek time Hence: Shortest Seek First (SSF) Improved: Elevator Scheduling Disk Arm Scheduling Shortest Seek First scheduling algorithm Disk Arm Scheduling Elevator algorithm for scheduling requests Initial position Pending requests

21 Error Handling Disk defect is inevitable Defect in uniform substrate Defect in fine oxide coating Motion defect increase as time goes by Read/write head moves into the wrong place Environment pollution Dust and speck cause temporary RW errors Error Handling Disk defect cause bad blocks If the defect is small, let the ECC correct Otherwise, let entire sector go bad and deal with bad sector in controller or OS Error Handling 2 approaches to handle bad sectors: Deal with them in controller Disk tested before shipping bad sector marked and substituted with spare Deal with them in operating system OS check for bad sectors and record them Error Handling (a) Found a bad sector in a disk track (b) Find a replace sector (c) Shift all sectors to bypass the bad sector Stable Storage Property of stable storage: Either write correctly Or leave the old data intact Need both stable read and stable write Idea is to use mirrors Many storage systems adapt this approach Stable Storage Analysis of the influence of crashes on stable writes

22 Optical Disks Optical disks are becoming popular 1980, Philips developed CD format CD are said to last for 100 years The Making of CD (with laser) Burn a 0.8 micron diameter holes in a coated glass master disk A mold is made from the master disk With bumps where the laser holes are A polycarbonate disk is made from mold The Making of CD A very thin layer of reflective aluminum is deposited on the polycarbonate Place a protective lacquer on the disk The depression in the polycarbonate substrate are called pits The unburn areas between pits called lands The Making of CD The pits and lands are written in a single continuous spiral starting near the hole working out a distance of 32mm toward edge The spiral makes 22,188 revolutions around the disk If unwound, it would be 5.6km long Structure of a CD or CD-ROM Logical data layout on CD-ROM

23 CD-ROM 1984, Philips & Sony developed the CD- ROM standard for storing computer data 1986, graphics and multimedia is added High Sierra file standard developed It becomes IS 9660 Nick name CD-R CD-Recordable Can be used to recording data once Making of CD-R Starts with polycarbonate blanks But they contains a 0.6mm groove To guide the laser for writing The groove has a sinusoidal excursion of 0.3mm at a frequency of exactly 22.05kHz To provide continuous feedback so that rotation speed can be accurately monitored Making of CD-R CD-Rs look like regular CD-ROMs But they are gold coated instead of aluminum for the reflective layer Two kinds of dyes are used: Cyanine, which is green Pthalocyanine, which is a yellowish orange Making of CD-R Initially, the dye are transparent and lets laser lights pass through and reflect off the gold layers To write, laser is turned into high power (8-16mW), and hits a spot of dye The dye heats up and break chemical bond Making of CD-R This creates a dark spot When read back (at 0.5mW), the photodetector sees a difference between the dark spots and the transparent areas This is interpreted as pits and lands

24 CD-R CD-R Cross section of a CD-R disk and laser not to scale Silver CD-ROM has similar structure without dye layer with pitted aluminum layer instead of gold CD-Rewritable Same as CD-R, except it uses Alloy of silver, indium, antimony, and tellurium for the recording layer Instead of cyanine or ptholcyanine CD-Rewritable CD-RW drive use laser of 3 differing power High power for recording Lower power for read back Middle power for reforming its state To become a land again DVD Digital Video (Versatile) Disk Developed by cooperating industries: Movie, consumer electronics, computer DVD uses same general design as CDs But with the following differences: DVD Smaller pits (0.4 micron vs. 0.8 micron) Tighter spiral 0.74 micron between tracks vs. 1.6 microns for CDs Red laser (at 0.65 micro vs microns)

25 DVD Together, the changes raise the capacity sevenfold to 4.7GB But the switch to red laser means that DVD player will need a second laser or fancy conversion to read existing CDs DVD There are four DVD formats: Single-sided, single-layer (4.7GB) Single-sided, double-layer (8.5GB) Double-sided, single-layer (9.4GB) Double-sided, dual-layer (17GB) DVD A double sided, dual layer DVD disk Clocks Also called Timers Essential for OS to work properly Synchronizing various circuits in computer Regulates the OS interrupts Prevents one process from monopolizing CPU Keeps time of day (real-time) Clock Hardware Two types of clocks are commonly used Power-line clocks Cause interrupts on every voltage cycle At either 50Hz (220V) or 60Hz (110V) Used to dominate, now very rare Crystal Oscillator Clocks Now commonly used in computers Crystal Oscillator Clocks Consists of a crystal oscillator, a counter, and a holding register Using electronics, output signal frequency can reach 1000MHz or even more The signal is fed to counter to count down to zero, and causes a CPU interrupt

26 Crystal Oscillator Clocks Clock Software Clock hardware only generates interrupts at known intervals Everything else involved is done by software Also called the clock driver A programmable clock Tasks of Clock Drivers Maintaining time of day Explain shortly Preventing process from running longer than they are allowed to by recording clock ticks a process has run Call scheduler when quantum exhausts Accounting for CPU usage Tasks of Clock Drivers Handling the ALARM system call by users Providing watchdog timers Do something after a timer expires i.e. floppy disk needs to get to speed before read Profiling, monitoring, and data gathering Providing statistical information about system Time of Day Just requires to incrementing a counter at each clock ticks Need to watch the length of the counter A 32 bit counter will overflow in 2 years with clock rate of 60Hz 3 approaches proposed to solve the problem Time of Day Three ways to maintain the time of day

27 Handling Alarm A process can request OS to give warning when certain time interval Each such process requires a clock Thus multiple clocks may be needed If the # of physical clocks are not enough We simulate multiple clocks in software Handling Alarm If many signals are expected, it is more efficient to chain requests Sorted on time in a linked list Each entry tells how many clock ticks following the previous one to wait before causing a signal Handling Alarm Soft Timers A 2nd clock available for timer interrupts specified by applications no problems if interrupt frequency is low Avoid interrupts by kernel checking for soft timer before it exits to user mode Simulating multiple timers with a single clock Soft Timers How well does soft timers work depends on rate of kernel entries If kernel entry is rare Application deadline could miss Average entry rate is 2 to 18 micro seconds Thus, a soft timer goes off every 12 is doable Character Oriented Terminals A rather frequent used device in old times Can only pass ASCII characters, not pixels RS-232 Terminal Hardware

28 RS-232 Terminal Hardware RS-232 Terminal Hardware Communicate with computer 1 bit at a time Called a serial line bits go out in series, 1 bit at a time RS-232 Terminal Hardware Input Software Windows uses COM1 and COM2 ports, first to serial lines Computer and terminal are completely independent 165 Central buffer pool Dedicated buffer for each terminal 166 Input Software Input Software Character CTRL-H CTRL-U POSIX name ERASE KILL Comment Backspace one character Erase entire line being typed Characters handled specially in canonical mode CTRL-V LNEXT Interpret next character literally CTRL-S STOP Stop output CTRL-Q START Start output DEL INTR Interrupt process (SIGINT) CTRL-\ QUIT Force core dump (SIGQUIT) CTRL-D EOF End of file CTRL-M CR Carriage return (unchangeable) CTRL-J NL Linefeed (unchangeable)

29 The ANSI escape sequences The ANSI escape sequences accepted by terminal driver on output ESC is ASCII character (0x1B) n,m, and s are optional numeric parameters Display Hardware Display Hardware Parallel port Memory-mapped displays driver writes directly into display's video RAM Display Hardware A video RAM image simple monochrome display character mode Corresponding screen the xs are attribute bytes Input Software Keyboard driver delivers a number driver converts to characters uses a ASCII table

30 Input Software Output Software for Windows Exceptions, adaptations needed for other languages many OS provide for loadable keymaps or code pages Output Software for Windows Sample window located at (200,100) on XGA display Skeleton of a Windows Main #include <windows.h> Int WINAPI WinMain(HINSTANCE h, HINSTANCE, hprev, char *szcmd, int icmdshow) { WNDCLASS wndclass; /*class object for this window*/ MSG msg; /* incoming messages are stored here*/ HWND hwnd; /* 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.hlcon = Loadlcon(NULL,IDI_APPLICATION); /*load program icon*/ wndclass.hcursor=loadcursor(null,idc_arrow); /*load mouse cursor*/ Skeleton of a Windows Main Skeleton of a Windows Main } RegisterClass(&wndclass); /*tell Windows about wndclass */ hwnd=createwindow( ); /*allocate storage for the window*/ ShowWindow(hwnd,iCmdShow); /*display the window on screen*/ UpdateWindow(hwnd); /*tell the window to paint itself*/ While(GetMessage(&msg,NULL,0,0)){ /*get message from queue*/ TranslateMessasge(&msg); /*translate the message*/ DispatchMessage(&msg) /*send msg to appropriate procedure*/ } Return(msg.wParam); Long CALLBACK WndProc(HWND hwnd, UINT messasge, UINT wparam, long IParam) { /* 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, messasge, wparam, IParam)); /*default*/

31 Output Software for Windows Output Software for Windows An example rectangle drawn using Rectangle Output Software for Windows Copying bitmaps using BitBlt. before after Output Software for Windows Output Software for Windows X Windows Network Terminals Examples of character outlines at different point sizes 185 Clients and servers X Window System

32 Skeleton of an X Windows application program #include <X11/Xlib.h> #include <X11/Xutil.h> Main(int argc, char *argv[]) { display disp; /*server identifier*/ Window win; /*window identifier*/ GC gc; /*graphic context identifier*/ XEvent event; /*storage for one event*/ int running=1; Skeleton of an X Windows application program 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*/ } Skeleton of an X Windows application program While(running) { XNextEvent(disp, &event); /*get next event*/ switch(event.type) { case Expose: ; break; /*repaint window*/ case ButtonPress: ; break; /*process mouse click*/ case Keypress: ; break; /*process keyboard input */ } } XFreeGC(disp,gc); /*release graphic conext */ XDestroyWindow(disp, win); /*deallocate window s memory space */ XCloseDisplay(disp); /*tear down network connection*/ The SLIM Network Terminal The architecture of the SLIM terminal system The SLIM Network Terminal Messages used in the SLIM protocol from the server to the terminals Power Management A PC usually has a 200W power supply With 85% efficiency If 100 million of PC turn on at once they use 20,000 megawatts of electricity This equals to the output of 20 averagesized nuclear power plants!

33 Power Management For battery-powered computers, i.e. laptops, notebooks, power is also a big issue Reducing power consumption could mean longer battery life Operating system plays a major role here Power Management Two approaches can be taken by the OS: Turn off parts of computer Turned off component do not consume power Restrict application s power usage Saving power by degrading quality Power Management Power consumption of various parts of a laptop computer Power Management The biggest power consuming parts are: Display, disk, and CPU Cutting display power usage by lighting up part of the screen that is active Cutting disk power by spinning it down Cutting CPU power by slowing it down Lighting Part of Screen Cutting CPU Speed The use of zones for backlighting the display 197 (a) Running at full clock speed (b) Cutting voltage by two cuts clock speed by two, cuts power by four

34 Issues in Turning Off Devices Who to turn off? When to turn off? Any state saving in turning off? Will turning on require more power? Need any context switch? How much power is saved? Save Power from Applications Telling the programs to use less energy may mean poorer user experience Examples change from color output to black and white speech recognition reduces vocabulary less resolution or detail in an image Questions? Comparisons Medium Early 1996 Mid 1997 Early 2000 RAM $ Disk Floppy Tape Comparisons RAM is usually volatile RAM is about 1/4 million times faster than disk Golden Rule of File Processing Minimize the number of disk accesses! Arrange information so that you get what you want with few disk accesses Arrange information to minimize future disk accesses

35 Golden Rule of File Processing An organization for data on disk is often called a file structure Disk-based space/time tradeoff: Compress information to save processing time by reducing disk accesses Device Independence Problem: lots of different brands of disks, disk interfaces, And disk controllers each with their own custom control interface Same is true of any I/O device network card, video card, keyboard, mouse, etc Device Independence Device Independence Add a device driver layer to hide this diversity/complexity An abstraction makes things better for things that use the abstraction Rest of operating systems Device drivers Millions of hardware devices Virtual interface Physical interface Threads: Example Abstractions user doesn t have to worry about sharing CPU Addresses spaces: user doesn t have to worry about sharing physical memory or physical memory size TCP: Example Abstractions user doesn t have to worry about the unreliable network Device drivers: frees the user (the rest of the OS) from worrying about differences in devices e.g. the device registers used to control the device

36 Byte Oriented Block Oriented Disks are accessed in terms of blocks (sectors) e.g. 512 bytes But programs deal in bytes Questions How to read less than a block How to write less than a block Disk Geometry Disk is made of a stack of spinning platters The top and bottom surface of each platter has concentric circles of data (called tracks) The set of tracks at the same radial distance is called a cylinder Each track is made of a number of sectors Disk Geometry Accessing a Disk Queueing time (wait for disk to be free): 0-infinity Position disk arm and head (seek and rotate): 0-12 ms Access disk data: size/transfer rate, e.g. disk transfer rate of 49 MB/s on Seagate Barracuda LW) Optimizing Disk Performance Disk is slow! Best option is to eliminate the disk I/O e.g. via file caching If you do have to go to disk try to keep positioning time small Optimizing Disk Performance If you do have to re-position try get lots of data to amortize the positioning overhead

37 Optimizing Disk Performance efficiency = transfer time / (positioning time + transfer time) e.g. on Seagate Barracuda LW, transferring 300 KB takes 6 ms (50% efficiency) Reducing Positioning Time Optimize when writing data to disk Place items that will be accessed together near each other on disk How to know in advance that two items will be accessed together? Reducing Positioning Time Optimize when reading data from disk minimize positioning time at time of access rather than at time of creation Disk Scheduling Re-order a set of disk accesses to decrease the total positioning time can be implemented in the OS or in the disk hardware Disk Scheduling FCFS (first come, first served) SSTF (shortest seek time first) SCAN LOOK C-SCAN FCFS e.g. (start at track 53): 98, 183, 37, 122, 14, 124, 65, 67 total head movement: 640 tracks (average 80 per seek)

38 SSTF e.g. 53->65->67->37->14->98->122->124- >183 total head movement: 236 tracks (average 30 per seek) Any problems with SSTF? SCAN Sweep the disk from one end to the other Then back again Sometimes called Elevator algorithms LOOK A variant of SCAN when sweeping toward the end stop if there are no requests beyond the current point e.g. 53->37->14->65->67->98->122->124->183 total head movement: 208 tracks (average 26 per seek) C-SCAN Always sweep the disk from beginning to end Then seek all the way back to the beginning And repeat Disk Scheduling Disk scheduling only improves positioning time with multiple outstanding requests otherwise service the sole request

Chap. 3. Input/Output

Chap. 3. Input/Output Chap. 3. Input/Output 17 janvier 07 3.1 Principles of I/O hardware 3.2 Principles of I/O software 3.3 Deadlocks [3.4 Overview of IO in Minix 3] [3.5 Block Devices in Minix 3] [3.6 RAM Disks] 3.7 Disks

More information

I/O Hardwares. Some typical device, network, and data base rates

I/O Hardwares. Some typical device, network, and data base rates Input/Output 1 I/O Hardwares Some typical device, network, and data base rates 2 Device Controllers I/O devices have components: mechanical component electronic component The electronic component is the

More information

Input/Output. Chapter 5: I/O Systems. How fast is I/O hardware? Device controllers. Memory-mapped I/O. How is memory-mapped I/O done?

Input/Output. Chapter 5: I/O Systems. How fast is I/O hardware? Device controllers. Memory-mapped I/O. How is memory-mapped I/O done? Input/Output : I/O Systems Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Character-oriented terminals Graphical user interfaces Network terminals Power management

More information

I/O Devices. Chapter 5 Input/Output. Memory-Mapped I/O (2) Memory-Mapped I/O (1) Interrupts Revisited. Direct Memory Access (DMA) 11/26/2013

I/O Devices. Chapter 5 Input/Output. Memory-Mapped I/O (2) Memory-Mapped I/O (1) Interrupts Revisited. Direct Memory Access (DMA) 11/26/2013 MODERN OPERATING SYSTEMS I/O Devices Third Edition ANDREW S. TANENBAUM Chapter 5 Input/Output Figure 5-1. Some typical device, network, and bus data rates. Memory-Mapped I/O (1) Memory-Mapped I/O (2) Figure

More information

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara Operating Systems Christopher Kruegel Department of Computer Science http://www.cs.ucsb.edu/~chris/ Input and Output Input/Output Devices The OS is responsible for managing I/O devices Issue requests Manage

More information

OPERATING SYSTEMS CS136

OPERATING SYSTEMS CS136 OPERATING SYSTEMS CS136 Jialiang LU Jialiang.lu@sjtu.edu.cn Based on Lecture Notes of Tanenbaum, Modern Operating Systems 3 e, 1 Chapter 5 INPUT/OUTPUT 2 Overview o OS controls I/O devices => o Issue commands,

More information

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security Input/Output Today Principles of I/O hardware & software I/O software layers Disks Next Protection & Security Operating Systems and I/O Two key operating system goals Control I/O devices Provide a simple,

More information

Input/Output. Today. Next. ! Principles of I/O hardware & software! I/O software layers! Secondary storage. ! File systems

Input/Output. Today. Next. ! Principles of I/O hardware & software! I/O software layers! Secondary storage. ! File systems Input/Output Today! Principles of I/O hardware & software! I/O software layers! Secondary storage Next! File systems Operating systems and I/O! Two key operating system goals Control I/O devices Provide

More information

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Secondary storage. File systems

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Secondary storage. File systems Input/Output Today Principles of I/O hardware & software I/O software layers Secondary storage Next File systems Operating systems and I/O Two key OS goals Control I/O devices Provide a simple, easy-to-use,

More information

CSE 380 Computer Operating Systems

CSE 380 Computer Operating Systems CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania Fall 2003 Lecture Note on Disk I/O 1 I/O Devices Storage devices Floppy, Magnetic disk, Magnetic tape, CD-ROM, DVD User

More information

Chapter 5 Input/Output. I/O Devices

Chapter 5 Input/Output. I/O Devices Chapter 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

More information

Chapter 5 Input/Output

Chapter 5 Input/Output Chapter 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

More information

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices Introduction Operating Systems Input/Output Devices (Ch12.1-12.3, 12.7; 13.1-13.3, 13.7) One OS function is to control devices significant fraction of code (80-90% of Linux) Want all devices to be simple

More information

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. (done)

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. (done) Introduction Operating Systems Input/Output Devices (Ch 13.3, 13.5; 14.1-14.3) One OS function is to control devices significant fraction of code (80-90% of Linux) Want all devices to be simple to use

More information

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University I/O, Disks, and RAID Yi Shi Fall 2017 Xi an Jiaotong University Goals for Today Disks How does a computer system permanently store data? RAID How to make storage both efficient and reliable? 2 What does

More information

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware CSE 120 July 27, 2006 Day 8 Input/Output Instructor: Neil Rhodes How hardware works Operating Systems Layer What the kernel does API What the programmer does Overview 2 Kinds Block devices: read/write

More information

Semiconductor Memory Types Microprocessor Design & Organisation HCA2102

Semiconductor Memory Types Microprocessor Design & Organisation HCA2102 Semiconductor Memory Types Microprocessor Design & Organisation HCA2102 Internal & External Memory Semiconductor Memory RAM Misnamed as all semiconductor memory is random access Read/Write Volatile Temporary

More information

Chapter 5. Input / Output

Chapter 5. Input / Output Chapter 5 Input / Output 1 The Spectrum of I/O Devices 2 Device Controllers The Device vs. its Controller Some duties of a device controller: Interface between CPU and the Device Start/Stop device activity

More information

19: I/O. Mark Handley. Direct Memory Access (DMA)

19: I/O. Mark Handley. Direct Memory Access (DMA) 19: I/O Mark Handley Direct Memory Access (DMA) 1 Interrupts Revisited Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires. Interrupts

More information

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13 I/O Handling ECE 650 Systems Programming & Engineering Duke University, Spring 2018 Based on Operating Systems Concepts, Silberschatz Chapter 13 Input/Output (I/O) Typical application flow consists of

More information

Computer Organization

Computer Organization Chapter 5 Computer Organization Figure 5-1 Computer hardware :: Review Figure 5-2 CPU :: Review CPU:: Review Registers are fast stand-alone storage locations that hold data temporarily Data Registers Instructional

More information

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel Chapter-6 SUBJECT:- Operating System TOPICS:- I/O Management Created by : - Sanjay Patel Disk Scheduling Algorithm 1) First-In-First-Out (FIFO) 2) Shortest Service Time First (SSTF) 3) SCAN 4) Circular-SCAN

More information

Chapter 11. I/O Management and Disk Scheduling

Chapter 11. I/O Management and Disk Scheduling Operating System Chapter 11. I/O Management and Disk Scheduling Lynn Choi School of Electrical Engineering Categories of I/O Devices I/O devices can be grouped into 3 categories Human readable devices

More information

Operating Systems (CS1022) Input/Output. Yagiz Özbek Evren

Operating Systems (CS1022) Input/Output. Yagiz Özbek Evren Operating Systems (CS1022) Input/Output Yagiz Özbek Evren 1 Content Principles of IO Hardware...3 IO Devices.. Device Controllers.. Memory-Mapped IO... Direct Memory Access... Interrupts. Principles of

More information

CS510 Operating System Foundations. Jonathan Walpole

CS510 Operating System Foundations. Jonathan Walpole CS510 Operating System Foundations Jonathan Walpole Disk Technology & Secondary Storage Management Disk Geometry Disk head, surfaces, tracks, sectors Example Disk Characteristics Disk Surface Geometry

More information

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices Introduction Operating Systems Input/Output Devices (Ch12.1-12.3, 12.7; 13.1-13.3, 13.7) One OS function is to control devices significant fraction of code (80-90% of Linux) Want all devices to be simple

More information

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006 November 21, 2006 The memory hierarchy Red = Level Access time Capacity Features Registers nanoseconds 100s of bytes fixed Cache nanoseconds 1-2 MB fixed RAM nanoseconds MBs to GBs expandable Disk milliseconds

More information

Tape pictures. CSE 30341: Operating Systems Principles

Tape pictures. CSE 30341: Operating Systems Principles Tape pictures 4/11/07 CSE 30341: Operating Systems Principles page 1 Tape Drives The basic operations for a tape drive differ from those of a disk drive. locate positions the tape to a specific logical

More information

Chapter 10: Mass-Storage Systems

Chapter 10: Mass-Storage Systems COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 10: Mass-Storage Systems Zhi Wang Florida State University Content Overview of Mass Storage Structure Disk Structure Disk Scheduling Disk

More information

Chapter 5 - Input / Output

Chapter 5 - Input / Output Chapter 5 - Input / Output Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 5 - Input / Output 1 / 90 1 Motivation 2 Principle of I/O Hardware I/O Devices Device Controllers Memory-Mapped

More information

2. Which of the following resources is not one which can result in deadlocking processes? a. a disk file b. a semaphore c. the central processor (CPU)

2. Which of the following resources is not one which can result in deadlocking processes? a. a disk file b. a semaphore c. the central processor (CPU) CSCI 4500 / 8506 Sample Questions for Quiz 4 Covers Modules 7 and 8 1. Deadlock occurs when each process in a set of processes a. is taking a very long time to complete. b. is waiting for an event (or

More information

Chapter 14: Mass-Storage Systems

Chapter 14: Mass-Storage Systems Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space Management RAID Structure Disk Attachment Stable-Storage Implementation Tertiary Storage Devices Operating System

More information

Lecture 21 Disk Devices and Timers

Lecture 21 Disk Devices and Timers CS 423 Operating Systems Design Lecture 21 Disk Devices and Timers Klara Nahrstedt Fall 2011 Based on slides by YY Zhou and Andrew S. Tanenbaum CS 423 - Fall 2011 Overview Administrative announcements

More information

Chapter 10: Mass-Storage Systems

Chapter 10: Mass-Storage Systems Chapter 10: Mass-Storage Systems Silberschatz, Galvin and Gagne 2013 Chapter 10: Mass-Storage Systems Overview of Mass Storage Structure Disk Structure Disk Attachment Disk Scheduling Disk Management Swap-Space

More information

UNIT 4 Device Management

UNIT 4 Device Management UNIT 4 Device Management (A) Device Function. (B) Device Characteristic. (C) Disk space Management. (D) Allocation and Disk scheduling Methods. [4.1] Device Management Functions The management of I/O devices

More information

Operating Systems, Fall

Operating Systems, Fall Input / Output & Real-time Scheduling Chapter 5.1 5.4, Chapter 7.5 1 I/O Software Device controllers Memory-mapped mapped I/O DMA & interrupts briefly I/O Content I/O software layers and drivers Disks

More information

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition Chapter 10: Mass-Storage Systems Silberschatz, Galvin and Gagne 2013 Chapter 10: Mass-Storage Systems Overview of Mass Storage Structure Disk Structure Disk Attachment Disk Scheduling Disk Management Swap-Space

More information

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition, Chapter 12: Mass-Storage Systems, Silberschatz, Galvin and Gagne 2009 Chapter 12: Mass-Storage Systems Overview of Mass Storage Structure Disk Structure Disk Attachment Disk Scheduling Disk Management

More information

Silberschatz, et al. Topics based on Chapter 13

Silberschatz, et al. Topics based on Chapter 13 Silberschatz, et al. Topics based on Chapter 13 Mass Storage Structure CPSC 410--Richard Furuta 3/23/00 1 Mass Storage Topics Secondary storage structure Disk Structure Disk Scheduling Disk Management

More information

Module 13: Secondary-Storage

Module 13: Secondary-Storage Module 13: Secondary-Storage Disk Structure Disk Scheduling Disk Management Swap-Space Management Disk Reliability Stable-Storage Implementation Tertiary Storage Devices Operating System Issues Performance

More information

CSE380 - Operating Systems. Communicating with Devices

CSE380 - Operating Systems. Communicating with Devices CSE380 - Operating Systems Notes for Lecture 15-11/4/04 Matt Blaze (some examples by Insup Lee) Communicating with Devices Modern architectures support convenient communication with devices memory mapped

More information

I/O Design, I/O Subsystem, I/O-Handler Device Driver, Buffering, Disks, RAID January WT 2008/09

I/O Design, I/O Subsystem, I/O-Handler Device Driver, Buffering, Disks, RAID January WT 2008/09 21 I/O Management (1) I/O Design, I/O Subsystem, I/O-Handler Device Driver, Buffering, Disks, RAID January 26 2009 WT 2008/09 2009 Universität Karlsruhe, System Architecture Group 1 Recommended Reading

More information

CSE 153 Design of Operating Systems Fall 2018

CSE 153 Design of Operating Systems Fall 2018 CSE 153 Design of Operating Systems Fall 2018 Lecture 12: File Systems (1) Disk drives OS Abstractions Applications Process File system Virtual memory Operating System CPU Hardware Disk RAM CSE 153 Lecture

More information

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College CISC 7310X C11: Mass Storage Hui Chen Department of Computer & Information Science CUNY Brooklyn College 4/19/2018 CUNY Brooklyn College 1 Outline Review of memory hierarchy Mass storage devices Reliability

More information

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1 Ref: Chap 12 Secondary Storage and I/O Systems Applied Operating System Concepts 12.1 Part 1 - Secondary Storage Secondary storage typically: is anything that is outside of primary memory does not permit

More information

CS3600 SYSTEMS AND NETWORKS

CS3600 SYSTEMS AND NETWORKS CS3600 SYSTEMS AND NETWORKS NORTHEASTERN UNIVERSITY Lecture 9: Mass Storage Structure Prof. Alan Mislove (amislove@ccs.neu.edu) Moving-head Disk Mechanism 2 Overview of Mass Storage Structure Magnetic

More information

General Items: Reading Materials: Miscellaneous: Lecture 9 / Chapter 7 COSC1300/ITSC 1401/BCIS /19/2004 ? H ? T

General Items: Reading Materials: Miscellaneous: Lecture 9 / Chapter 7 COSC1300/ITSC 1401/BCIS /19/2004 ? H ? T General Items:? H Reading Materials:? T Miscellaneous: F.Farahmand 1 / 11 File: lec8chap7f04.doc Electronic Storage - The medium on which we can keep data, instructions, and information - Examples: Floppy

More information

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 6 External Memory

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 6 External Memory William Stallings Computer Organization and Architecture 8 th Edition Chapter 6 External Memory Types of External Memory Magnetic Disk RAID Removable Optical CD-ROM CD-Recordable (CD-R) CD-R/W DVD Magnetic

More information

Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management

Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management Lecture Overview Mass storage devices Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management Operating Systems - June 28, 2001 Disk Structure Disk drives are

More information

Chapter 13: Mass-Storage Systems. Disk Scheduling. Disk Scheduling (Cont.) Disk Structure FCFS. Moving-Head Disk Mechanism

Chapter 13: Mass-Storage Systems. Disk Scheduling. Disk Scheduling (Cont.) Disk Structure FCFS. Moving-Head Disk Mechanism Chapter 13: Mass-Storage Systems Disk Scheduling Disk Structure Disk Scheduling Disk Management Swap-Space Management RAID Structure Disk Attachment Stable-Storage Implementation Tertiary Storage Devices

More information

Chapter 13: Mass-Storage Systems. Disk Structure

Chapter 13: Mass-Storage Systems. Disk Structure Chapter 13: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space Management RAID Structure Disk Attachment Stable-Storage Implementation Tertiary Storage Devices Operating System

More information

William Stallings Computer Organization and Architecture 6 th Edition. Chapter 6 External Memory

William Stallings Computer Organization and Architecture 6 th Edition. Chapter 6 External Memory William Stallings Computer Organization and Architecture 6 th Edition Chapter 6 External Memory Types of External Memory Magnetic Disk RAID Removable Optical CD-ROM CD-Recordable (CD-R) CD-R/W DVD Magnetic

More information

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum) I/O Fall 2011 Tore Larsen Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum) Big Picture Today we talk about I/O characteristics interconnection devices & controllers (disks

More information

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum) I/O Fall 2010 Tore Larsen Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum) Big Picture Today we talk about I/O characteristics interconnection devices & controllers (disks

More information

COMPUTER SYSTEMS ORGANIZATION

COMPUTER SYSTEMS ORGANIZATION 2 COMPUTER SYSTEMS ORGANIZATION Central processing unit (CPU) Control unit Arithmetic logical unit (ALU) Registers I/O devices Main memory Disk Printer Bus Figure 2-. The organization of a simple computer

More information

Hard Disk Drives (HDDs) Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Hard Disk Drives (HDDs) Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Hard Disk Drives (HDDs) Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Virtualization Virtual CPUs Virtual memory Concurrency Threads Synchronization

More information

Disk Scheduling COMPSCI 386

Disk Scheduling COMPSCI 386 Disk Scheduling COMPSCI 386 Topics Disk Structure (9.1 9.2) Disk Scheduling (9.4) Allocation Methods (11.4) Free Space Management (11.5) Hard Disk Platter diameter ranges from 1.8 to 3.5 inches. Both sides

More information

Introduction to I/O and Disk Management

Introduction to I/O and Disk Management 1 Secondary Storage Management Disks just like memory, only different Introduction to I/O and Disk Management Why have disks? Ø Memory is small. Disks are large. Short term storage for memory contents

More information

Magnetic Disk. Optical. Magnetic Tape. RAID Removable. CD-ROM CD-Recordable (CD-R) CD-R/W DVD

Magnetic Disk. Optical. Magnetic Tape. RAID Removable. CD-ROM CD-Recordable (CD-R) CD-R/W DVD External Memory Magnetic Disk RAID Removable Optical CD-ROM CD-Recordable (CD-R) CD-R/W DVD Magnetic Tape Disk substrate coated with magnetizable material (iron oxide rust) Substrate used to be aluminium

More information

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall I/O Device Controllers I/O Systems CS 256/456 Dept. of Computer Science, University of Rochester 10/20/2010 CSC 2/456 1 I/O devices have both mechanical component & electronic component The electronic

More information

Introduction to I/O and Disk Management

Introduction to I/O and Disk Management Introduction to I/O and Disk Management 1 Secondary Storage Management Disks just like memory, only different Why have disks? Ø Memory is small. Disks are large. Short term storage for memory contents

More information

I/O Management and Disk Scheduling. Chapter 11

I/O Management and Disk Scheduling. Chapter 11 I/O Management and Disk Scheduling Chapter 11 Categories of I/O Devices Human readable used to communicate with the user video display terminals keyboard mouse printer Categories of I/O Devices Machine

More information

Hard Disk Drives (HDDs)

Hard Disk Drives (HDDs) Hard Disk Drives (HDDs) Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu)

More information

Reading and References. Input / Output. Why Input and Output? A typical organization. CSE 410, Spring 2004 Computer Systems

Reading and References. Input / Output. Why Input and Output? A typical organization. CSE 410, Spring 2004 Computer Systems Reading and References Input / Output Reading» Section 8.1-8.5, Computer Organization and Design, Patterson and Hennessy CSE 410, Spring 2004 Computer Systems http://www.cs.washington.edu/education/courses/410/04sp/

More information

I/O Systems and Storage Devices

I/O Systems and Storage Devices CSC 256/456: Operating Systems I/O Systems and Storage Devices John Criswell! University of Rochester 1 I/O Device Controllers I/O devices have both mechanical component & electronic component! The electronic

More information

CS330: Operating System and Lab. (Spring 2006) I/O Systems

CS330: Operating System and Lab. (Spring 2006) I/O Systems CS330: Operating System and Lab. (Spring 2006) I/O Systems Today s Topics Block device vs. Character device Direct I/O vs. Memory-mapped I/O Polling vs. Interrupts Programmed I/O vs. DMA Blocking vs. Non-blocking

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 2018 Lecture 20: File Systems (1) Disk drives OS Abstractions Applications Process File system Virtual memory Operating System CPU Hardware Disk RAM CSE 153 Lecture

More information

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Outline of Today s Lecture. The Big Picture: Where are We Now?

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Outline of Today s Lecture. The Big Picture: Where are We Now? CPS104 Computer Organization and Programming Lecture 18: Input-Output Robert Wagner cps 104.1 RW Fall 2000 Outline of Today s Lecture The system Magnetic Disk Tape es DMA cps 104.2 RW Fall 2000 The Big

More information

V. Mass Storage Systems

V. Mass Storage Systems TDIU25: Operating Systems V. Mass Storage Systems SGG9: chapter 12 o Mass storage: Hard disks, structure, scheduling, RAID Copyright Notice: The lecture notes are mainly based on modifications of the slides

More information

CSE 120. Operating Systems. March 27, 2014 Lecture 17. Mass Storage. Instructor: Neil Rhodes. Wednesday, March 26, 14

CSE 120. Operating Systems. March 27, 2014 Lecture 17. Mass Storage. Instructor: Neil Rhodes. Wednesday, March 26, 14 CSE 120 Operating Systems March 27, 2014 Lecture 17 Mass Storage Instructor: Neil Rhodes Paging and Translation Lookaside Buffer frame dirty? no yes CPU checks TLB PTE in TLB? Free page frame? no yes OS

More information

CSCI-GA Operating Systems I/O. Hubertus Franke

CSCI-GA Operating Systems I/O. Hubertus Franke Operating Systems I/O CSCI-GA.2250-001 Hubertus Franke frankeh@cs.nyu.edu External devices that engage in I/O with computer systems can be grouped into three categories: Human readable suitable for communicating

More information

Computer Science 61C Spring Friedland and Weaver. Input/Output

Computer Science 61C Spring Friedland and Weaver. Input/Output Input/Output 1 A Computer is Useless without I/O I/O handles persistent storage Disks, SSD memory, etc I/O handles user interfaces Keyboard/mouse/display I/O handles network 2 Basic I/O: Devices are Memory

More information

Mass-Storage. ICS332 - Fall 2017 Operating Systems. Henri Casanova

Mass-Storage. ICS332 - Fall 2017 Operating Systems. Henri Casanova Mass-Storage ICS332 - Fall 2017 Operating Systems Henri Casanova (henric@hawaii.edu) Magnetic Disks! Magnetic disks (a.k.a. hard drives ) are (still) the most common secondary storage devices today! They

More information

Outline. Operating Systems: Devices and I/O p. 1/18

Outline. Operating Systems: Devices and I/O p. 1/18 Outline Diversity of I/O devices block and character devices Organization of I/O subsystem of kernel device drivers Common hardware characteristics of device I/O subsystem tasks Operating Systems: Devices

More information

Chapter 12: Mass-Storage

Chapter 12: Mass-Storage Chapter 12: Mass-Storage Systems Chapter 12: Mass-Storage Systems Revised 2010. Tao Yang Overview of Mass Storage Structure Disk Structure Disk Attachment Disk Scheduling Disk Management Swap-Space Management

More information

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Spring 2018

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems I/O Systems & Secondary Storage Professor Qiang Zeng Spring 2018 Previous class Memory subsystem How to allocate physical memory? How to do address translation? How to be quick?

More information

UNIT 2 Data Center Environment

UNIT 2 Data Center Environment UNIT 2 Data Center Environment This chapter provides an understanding of various logical components of hosts such as file systems, volume managers, and operating systems, and their role in the storage

More information

COS 318: Operating Systems. Storage Devices. Vivek Pai Computer Science Department Princeton University

COS 318: Operating Systems. Storage Devices. Vivek Pai Computer Science Department Princeton University COS 318: Operating Systems Storage Devices Vivek Pai Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Today s Topics Magnetic disks Magnetic disk

More information

Advanced Parallel Architecture Lesson 4 bis. Annalisa Massini /2015

Advanced Parallel Architecture Lesson 4 bis. Annalisa Massini /2015 Advanced Parallel Architecture Lesson 4 bis Annalisa Massini - 2014/2015 Internal Memory RAM Many memory types are random access individual words of memory are directly accessed through wired-in addressing

More information

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Computer Organization and Structure. Bing-Yu Chen National Taiwan University Computer Organization and Structure Bing-Yu Chen National Taiwan University Storage and Other I/O Topics I/O Performance Measures Types and Characteristics of I/O Devices Buses Interfacing I/O Devices

More information

Where We Are in This Course Right Now. ECE 152 Introduction to Computer Architecture Input/Output (I/O) Copyright 2012 Daniel J. Sorin Duke University

Where We Are in This Course Right Now. ECE 152 Introduction to Computer Architecture Input/Output (I/O) Copyright 2012 Daniel J. Sorin Duke University Introduction to Computer Architecture Input/Output () Copyright 2012 Daniel J. Sorin Duke University Slides are derived from work by Amir Roth (Penn) Spring 2012 Where We Are in This Course Right Now So

More information

Input-Output (I/O) Input - Output. I/O Devices. I/O Devices. I/O Devices. I/O Devices. operating system must control all I/O devices.

Input-Output (I/O) Input - Output. I/O Devices. I/O Devices. I/O Devices. I/O Devices. operating system must control all I/O devices. Input - Output Input-Output (I/O) operating system must control all I/O devices issue commands to devices catch interrupts handle errors provide interface between devices and rest of system main categories

More information

Chapter 14: Mass-Storage Systems

Chapter 14: Mass-Storage Systems Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space Management RAID Structure Disk Attachment Stable-Storage Implementation Tertiary Storage Devices Operating System

More information

Computer System Architecture

Computer System Architecture CSC 203 1.5 Computer System Architecture Department of Statistics and Computer Science University of Sri Jayewardenepura Secondary Memory 2 Technologies Magnetic storage Floppy, Zip disk, Hard drives,

More information

1.1 Bits and Bit Patterns. Boolean Operations. Figure 2.1 CPU and main memory connected via a bus. CS11102 Introduction to Computer Science

1.1 Bits and Bit Patterns. Boolean Operations. Figure 2.1 CPU and main memory connected via a bus. CS11102 Introduction to Computer Science 1.1 Bits and Bit Patterns CS11102 Introduction to Computer Science Data Storage 1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representation of information as bit patterns Bit: Binary

More information

Chapter 8. A Typical collection of I/O devices. Interrupts. Processor. Cache. Memory I/O bus. I/O controller I/O I/O. Main memory.

Chapter 8. A Typical collection of I/O devices. Interrupts. Processor. Cache. Memory I/O bus. I/O controller I/O I/O. Main memory. Chapter 8 1 A Typical collection of I/O devices Interrupts Cache I/O bus Main memory I/O controller I/O controller I/O controller Disk Disk Graphics output Network 2 1 Interfacing s and Peripherals I/O

More information

TODAY AND TOMORROW. Storage CHAPTER

TODAY AND TOMORROW. Storage CHAPTER 1 TODAY AND TOMORROW 3 Storage CHAPTER Storage Systems Characteristics All storage systems have specific characteristics Storage medium (what data is stored on) Can be removable or nonremovable from the

More information

Overview of Mass Storage Structure

Overview of Mass Storage Structure Overview of Mass Storage Structure Magnetic disks provide bulk of secondary storage Drives rotate at 70 to 250 times per second Ipod disks: 4200 rpm Laptop disks: 4200, 5400 rpm or 7200 rpm Desktop disks:

More information

Chapter 11 I/O Management and Disk Scheduling

Chapter 11 I/O Management and Disk Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall 1 2 Differences

More information

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Fall 2017

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Fall 2017 CIS 5512 - Operating Systems I/O Systems & Secondary Storage Professor Qiang Zeng Fall 2017 Previous class Memory subsystem How to allocate physical memory? How to do address translation? How to be quick?

More information

Chapter 6A. Describing Storage Devices. Describing Storage Devices. Types of Storage Devices. Store data when computer is off Two processes

Chapter 6A. Describing Storage Devices. Describing Storage Devices. Types of Storage Devices. Store data when computer is off Two processes Chapter 6A Types of Storage Devices Describing Storage Devices Store data when computer is off Two processes Writing data Reading data 2 Describing Storage Devices Storage terms Media is the material storing

More information

MASS-STORAGE STRUCTURE

MASS-STORAGE STRUCTURE UNIT IV MASS-STORAGE STRUCTURE Mass-Storage Systems ndescribe the physical structure of secondary and tertiary storage devices and the resulting effects on the uses of the devicesnexplain the performance

More information

Computer System Overview

Computer System Overview Computer System Overview Operating Systems 2005/S2 1 What are the objectives of an Operating System? 2 What are the objectives of an Operating System? convenience & abstraction the OS should facilitate

More information

Session: Hardware Topic: Disks. Daniel Chang. COP 3502 Introduction to Computer Science. Lecture. Copyright August 2004, Daniel Chang

Session: Hardware Topic: Disks. Daniel Chang. COP 3502 Introduction to Computer Science. Lecture. Copyright August 2004, Daniel Chang Lecture Session: Hardware Topic: Disks Daniel Chang Basic Components CPU I/O Devices RAM Operating System Disks Considered I/O devices Used to hold data and programs before they are loaded to memory and

More information

Input/Output Problems. External Devices. Input/Output Module. I/O Steps. I/O Module Function Computer Architecture

Input/Output Problems. External Devices. Input/Output Module. I/O Steps. I/O Module Function Computer Architecture 168 420 Computer Architecture Chapter 6 Input/Output Input/Output Problems Wide variety of peripherals Delivering different amounts of data At different speeds In different formats All slower than CPU

More information

Generic Model of I/O Module Interface to CPU and Memory Interface to one or more peripherals

Generic Model of I/O Module Interface to CPU and Memory Interface to one or more peripherals William Stallings Computer Organization and Architecture 7 th Edition Chapter 7 Input/Output Input/Output Problems Wide variety of peripherals Delivering different amounts of data At different speeds In

More information

Lecture 29. Friday, March 23 CS 470 Operating Systems - Lecture 29 1

Lecture 29. Friday, March 23 CS 470 Operating Systems - Lecture 29 1 Lecture 29 Reminder: Homework 7 is due on Monday at class time for Exam 2 review; no late work accepted. Reminder: Exam 2 is on Wednesday. Exam 2 review sheet is posted. Questions? Friday, March 23 CS

More information

Mass-Storage Structure

Mass-Storage Structure CS 4410 Operating Systems Mass-Storage Structure Summer 2011 Cornell University 1 Today How is data saved in the hard disk? Magnetic disk Disk speed parameters Disk Scheduling RAID Structure 2 Secondary

More information

Readings. Storage Hierarchy III: I/O System. I/O (Disk) Performance. I/O Device Characteristics. often boring, but still quite important

Readings. Storage Hierarchy III: I/O System. I/O (Disk) Performance. I/O Device Characteristics. often boring, but still quite important Storage Hierarchy III: I/O System Readings reg I$ D$ L2 L3 memory disk (swap) often boring, but still quite important ostensibly about general I/O, mainly about disks performance: latency & throughput

More information

1 What is an operating system?

1 What is an operating system? B16 SOFTWARE ENGINEERING: OPERATING SYSTEMS 1 1 What is an operating system? At first sight, an operating system is just a program that supports the use of some hardware. It emulates an ideal machine one

More information