Secondary Memory

 

·       Secondary memory provides a much larger storage space, but at a cost of slower access.

 

·       Implemented as additional data storage devices that are cheap and can store very large amounts of data, but are usually much slower than main memory.

·        

 

Memory Hierarchy

 

·       Traditional architectures store data within a memory hierarchy as shown.

 

·       At the top are the CPU registers. These operate at the CPU speed, but only a few are available.

 

·       Cache is small but very fast memory and comes in sizes of 32 KBytes to a few Megabytes.

 

·       Next level down is the main memory with sizes of 16 MBytes to tens of GBytes. 

 

·       The bottom layers have magnetic disks (hard drives), optical disks (CD-ROMs), and tapes for archival storage.

 

·       Three key parameters change as we move up (or down) the hierarchy: access time, storage capacity, and cost.

 

 

 

Magnetic Disks

 

·       Magnetic disks consist of aluminum platters with a magnetizable coating. A read/write head (disk head) floats over the rotating surface on a cushion of air.

 

·       The head consists of an induction coil that can induce a magnetic field (when writing) causing the magnetic particles to line up to face right or left.

 

·       Conversely the head is also sensitive to such magnetic fields (when reading) and from a standard physics principle, as the magnetic field passes the head an electronic current is generated (positive or negative) in the head reading back the appropriate bit values.

 

·       A disk is divided up into tracks and sectors. Tracks are divided up into fixed-length (read: data size) sectors with gaps between them to separate tracks inside and outside of it.

 

·       Sectors consist of a preamble, data (512 bytes), Error-Correcting Code, and a small inter-sector gap.

 

·       The preamble is necessary for synchronizing the head before read/write operations.

 

·       ECC is either Hamming or Reed-Solomon code (can correct multiple errors)

 

·       Formatted disks are 15% lower in capacity than unformatted disks (why?).

 

·       The heads move across the tracks on a movable arm. A drive usually consists of multiple platters stacked vertically, each with its own head.

 

·       Each head, if left on one track, would carve out a circle. With multiple platters this would look like (in 3D) a cylinder. Thus each set of tracks at a given radius is called a cylinder. Heads are all fixed together so they move as one unit.

 

·       Disk performance depends upon three factors: seek time, rotational latency, and transfer time.

 

·       Seek time represents the time it takes to position the head to the correct sector to be read/written to. Average times (between random tracks) range from 5 – 15ms.

 

·       Rotational latency is the time it takes for the desired sector to appear under the head. Disks rotate with speeds of 3600, 5400, 7200, and 10,800 RPM

 

·       Transfer time depends on the linear density and rotation speed. Transfer rates are 5 to 20 MB/s giving 512 byte sectors 25 to 100 msec to transfer.

 

·       Disks are often quoted with two performance figures: maximum burst rate and maximum sustained rate

 

·       Maximum burst rate is when the head is lined up on the first data bit (which factors influence the performance of burst rate?). This rate can only be sustained for the duration of one sector.

 

·       Maximum sustained rate is the rate to read larger data segments and thus require the heads to be repositioned (remember that there are ECCs, preambles, and inter-sector gaps, thus seek time and rotational latency must be added to the transfer time)

 

·       Each drive has a disk controller whose purpose is to control the drive and its tasks. Tasks include accepting software commands (read, write, format), controlling arm motion, detecting/correcting errors, and converting 8-bit bytes from the disk into serial bit streams (and vice versa)

 

 

 

Floppy Disks

 

·       Small removable medium named floppy due to the early disks being so flexible.

 

·       Format is similar to hard drives but head does not float over disk, instead it actual touches the surface. To reduce wear and tear, heads are removed and spinning stopped when not in use.

 

·       Large delays (½ second to get up to speed) when reading, does not spin as fast.

 

·       Two standard sizes exist, 5.25” (hardly used) and 3.5” each available in Low-Density and High-Density.

 

 

 

IDE Disks

 

·       The OS reads and writes to a disk by putting parameters in the CPU registers and then calling the BIOS (Basic Input Output System).

 

·       The BIOS issues the machine instructions to load the disk controller registers that initiate transfers.

 

·       Originally the disk controller was a on a separate card, later it was integrated into the drive enclosure with the IDE (Integrated Drive Electronics).

 

·       BIOS used an addressing scheme of the head, cylinder, and sector numbers. Heads and cylinders numbered starting at 0 while sectors started at 1.

 

·       4 bits were used for the head, 6 bits for the sector, and 10 bits for the cylinder. Total of 1032192 sectors with 528MB of data.

 

·       Later drives (large than 528MB) had a different geometry (e.g. 4 heads, 32 sectors, 2000 cylinders).

 

·       Due to backward compatibility, BIOS conventions were frozen. BIOS used 10 bits for cylinders, 8 bits for heads, and 6 bits for sectors (giving 8.4GB limit).

 

 

·       IDE used 16 bits for cylinders, 4 bits for heads, and 8 bits for sectors (giving 136.9GB limit). Thus to exchange data with one another the smallest of each had to be used (thus the limitation of 528MB).

 

 

·       Extended IDE provided a solution to this. Disk controllers pretend that the geometry follows the BIOS convention, but actually re-map the virtual geometry onto the real geometry.

 

·       EIDE supports a second addressing scheme called LBA (Logical Block Addressing) that numbers sectors starting at 0 to 224-1.

 

·       The controller must convert LBA addresses to head, sector, and cylinder addresses

 

·       EIDE also supports up to 4 drives (IDE was limited to 2), has a faster transfer rate, and can control CD-ROM drives (IDE could not).

 

 

SCSI Disks

 

·       Similar to IDE in terms of geometry (tracks, sectors, cylinders) but has a different interface, and much faster transfer rates.

 

·       SCSI is a bus that can accept a SCSI controller and up to 7 devices (SCSI hard drives, CD-ROMs, CD recorders, scanners, tapes, etc.).

 

·       Each device uses an ID (0-7 or 0-15 for wide SCSI) and has two connectors; one for input the other for output.

 

·       Output from one device is fed into the input of another (connect in series); last device must be terminated to prevent reflections at the ends of the bus interfering with data on the bus.

 

·       8-bit SCSI cable has 50 wires, 25 are ground to increase noise immunity, 8 are for data, 1 for parity, 9 for control, 7 are for power and future use. 16-bit and 32-bit SCSI have additional cables.

 

·       Both controllers and peripherals can act as initiators or as targets. Commands are blocks of (max) 16 bytes indicating what the target is to do. Commands and responses occur in phases.

 

·       Control signals are used to indicate the phase and arbitrate bus access when multiple devices try to use the bus at the same time.

 

·       SCSI’s method of arbitration allows for all devices to run at once improving performance in a multi-tasking environment (IDE/EIDE allow only one active device at a time).

 

 

 

RAID

 

·       Using a similar idea to parallel processing, specific disk organizations (using multiple disks) can improve disk access, reliability, or both.

 

·       RAID (Redundant Array of Independent Disks) is a set of disks organized such that disk access and reliability is improved over the conventional SLED (Single Large Expensive Disk) design.

 

·       As far as the Operating System is concerned, RAID should look the same as SLED.

 

·       Typically SCSI is used to configure/control a RAID. Data is distributed over multiple drives allowing parallel access.

 

·       There are 6 main levels in RAID, known as level 0 to level 5 as shown.

 

 

 

level 0

 

·       The “virtual disk” is divided up into strips, which is a collection of k sectors.

 

·       Strip 0 has sectors 0 – (k-1), strip 1 has sectors k - (2k-1), strip 2 = sectors 2k – (3k-1) etc.

 

·       If k=1, a strip = 1 sector. If k=2, a strip = 2 sectors, etc.

 

·       Consecutive strips are written over the drives in a round robin fashion, this is known as striping.

 

·       Advantage of this system is apparent when large amounts of consecutive data are read/written.

 

·       When the OS requests to r/w data over multiple strips, the RAID controller breaks the command into separate commands, one for each disk. If the same disk has multiple requests, they start the next strip after processing the previous strip.

 

·       This level works best with large data requests. The disadvantage of this system is when data is requested one sector at a time, there is no performance advantage.

 

·       Another disadvantage is reliability is lower than SLED. If the mean time to failure is 20, 000 hours and there are 4 disks, a drive will fail (and all data lost) on average every 5000 hours (compared to SLED with a failure on average at 20, 000 hours)

 

 

 

Level 1

 

·       Considered true RAID. Duplicates all the disks.

 

·       In the example shown, there are 4 primary and 4 backup disks. Writing is done to both the primary and backup disks, thus no performance gain over SLED.

 

·       Reading is done from either primary or backup disk, thus read can be twice as good.

 

·       Provides redundancy because if a drive fails, the copy is used instead. Recovery from a failure requires a new drive installed and the backup data copied to it

 

 

Level 2

 

·       Instead of strips of sectors, word or bytes are used. For example, if a byte is broken into 4-bit nibbles and a Hamming code is added to form a 7-bit word (bits 1, 2, 4 are parity bits) and the drives are synchronized (arm and rotational position) then the 7-bit Hamming code word could be written onto the drives, 1 bit per drive.

 

·       Thinking Machines CM-2 used this scheme with a 32-bit data word, 6 parity bits forming 38-bit Hamming words with 1 bit for word parity and spread over 39 drives.

 

·       Throughput is high since in a single sector time, <number of data bits per word> sectors are written. For e.g., with CM-2 32 sectors are written in 1 sector time

 

·       Loss of a single drive is not a problem in the CM-2 case since Hamming code can handle 1 bit loss.

 

·       Requires all drives to be rotationally synchronized and requires a lot of drives.

 

·       There is also a high overhead (e.g. CM-2 has 19% overhead. overhead  = 6 parity drives / 32 data drives * 100%).

 

·       The number of separate I/O requests per second is no better than SLED.

 

 

Level 3

 

·       Simplified level 2 using only a single bit for parity and requires only 1 extra drive.

 

·       For random errors, can only detect not correct errors.

 

·       For a drive crash, missing data can easily be retrieved.

 

·       Has high data rate but number of separate I/O requests per second is no better than SLED.

 

 

Level 4

 

·       Uses strips like levels 0 and 1.

 

·       Uses strip-for-strip parity written onto an extra drive. Strips are XOR’ed together.

 

·       If a strip is k bytes long, the resulting parity strip is also k bytes long.

 

·       Bytes lost due to a drive crash can be recomputed from parity drive.

 

·       Small updates causes poor performance since a single sector change requires all drives to be read to recalculate the parity then the parity must be rewritten.

 

·       Parity drive is used heavily and thus can be a bottleneck.

 

 

 

Level 5

 

·       Eliminates the bottle neck found in level 4 by distributing the parity bits uniformly over all drives round robin fashion.

 

·       If a drive crashes, reconstruction of contents of failed drive is complex

 

 

CD-ROMs (Compact Disk – Read Only Memory)

 

·       CD-ROMs are optical disks with larger capacity than magnetic disks

 

·       A CD is formed from a clear polycarbonate resin and a thin reflective aluminum sheet.

 

·       CDs have depressions called pits; the raised areas are called lands. During playback, a low-power laser diode shines infrared light that strikes the pits and lands.

 

·       The laser actually comes from the bottom, thus the pits stick out. The pits jut out ¼ the wavelength of the laser thus the light reflecting off the pit is ½ a wavelength out of phase which causes the reflecting wave to interfere destructively. The net result is that the pits return less light than the lands.

 

 

·       The combination of a pit/land or land/pit (i.e. the change between a pit and a land) is used to indicate a 1, otherwise a zero is recorded.

 

·       Pits/lands are written in a continuous spiral starting near the center (like the old vinyl records).

 

·       Problem: CD-ROMs must maintain a constant linear velocity. The solution is to constantly reduce the rotation rate of the CD as the head moves from the inside to the outside of the disk.

 

·       CD-ROMs use a 14-bit encoding scheme and have a 588-bit frame, which is grouped into 98 sectors.

 

·       Sectors begin with a 16-byte preamble, 12 used to let the player find the start of a sector. 3 bytes contain the sector number.

 

·       Seeking a sector is done by calculating approximately where the head has to go, move the head there, and then hunt for the preamble.

 

·       Single speed CD-ROM drives operate at 75 sectors/sec (data rate of 153,600 bytes/sec). Double speed are twice that, etc.

 

·       To operate a CD-ROM disk on different computers there are 3 file systems: Level 1 –3.

·       Level 1 uses 8 character DOS file name styles (+3 for extension), files must be contiguous. Level 1 can be read by all computers.

 

·       Level 2 allows 32 character file names.

 

·       Level 3 allows noncontiguous files.

 

 

 

CD-Recordables

 

·       CD-R is gold colored instead of silver. Instead of an aluminum layer for reflection, real gold is used and a dye of cyanine or pthalocyanide.

 

·       Instead of physical dents for pits, pits are represented with a dark spot. Normally the dye is transparent, however when the CD-R laser is turned to high-power, it heats up a spot on the dye creating the dark spot.

 

·       The difference between a light and dark spot indicates a 1, similar to the CD-ROMs.

 

·       CD-R uses a different format, allowing CD-Rs to be recorded incrementally a few sectors at a time. Groups of sectors written together form a track.

 

 

·       CD-ROMs use a single VTOC (Volume Table of Contents) that indicates where files are located.

 

·       CD-R cannot use this scheme (since not all files may be recorded yet), thus each track has it’s own VTOC (a new track gets a new VTOC listing all the old and new files). Deleted files are just not listed (however the file still exists). The OS must search for the most recent VTOC.

 

·       To prevent theft of copyrighted data, various schemes can be employed: recording all file lengths as multi-gigabyte, using incorrect ECC (Error Correction Codes) in some sectors causing the copying CD to try and “fix” it, and using nonstandard gaps between tracks.

 

 

 

CD-Rewritables

 

·       CD-RW uses an alloy of silver, indium, antimony, and tellurium instead of the cyanide dye for recording.

 

·       This layer has two states: crystalline, and amorphous, each reflecting differently.

 

·       CD-RW drives have lasers that have three powers.

 

·       High power laser melts the alloy converting it from a reflective crystalline state to the low reflective amorphous state.

 

·       Medium power the alloy melts and it reforms into the crystalline state.

 

·       Low power is used for reading.

 

 

DVD (Digital Versatile Disk)

 

 

·       Since optical disks are so economical, small, high quality and reliable, three industries (movie, consumer electronics, and computer companies) have come together to try and develop an optical disk for all to use.

 

·       DVDs are similar to CDs but use smaller pits, tighter spiral, and a red laser (which can read a 1 in a smaller area) thus DVD can hold much more data (4.7 GB) and operate faster at 1.4 MB/sec.

 

 

·       4 formats have been devised: single-sided, single-layer; single-sided, double-layer; double-sided, single-layer, double-sided, double-layered

 

·       Dual layers use a bottom layer of reflective material (like the CD) and a middle layer of semi-reflective material. Depending on where the laser is focused will determine which layer it bounces off.

 

·       Double-sided uses two DVDs stuck back to back.

 

 

 

Input/Output

 

 

Buses

 

·       Most computers have a structure as shown, with a large board called a “motherboard”.

 

·       Motherboards house the CPU, DIMM slots, and one or more buses with sockets that accept I/O boards.

 

·       A bus is simply a collection of wires (etched into the motherboard) used to transfer data from one place to another.

 

·       I/O devices consist of two parts: a controller and the device. Controller cards are plugged into a free slot on the motherboard, the device connected to the controller with a cable.

 

·       Controllers control the I/O device and deal with bus access for the device. For example: if a program needs data from a disk, it gives the command to the disk controller which then operates the drive to collect the data requested.

 

·       Data from the disk arrives to the controller in a stream; the controller breaks up the stream into units and sends the information across the bus to memory.

 

·       To improve performance, some controllers can read/write data to/from a device to/from memory without the use of the CPU. This is known as Direct Memory Access (DMA).

 

·       When the transfer is complete, the controller forces an interrupt. Interrupts force the CPU to suspend the current program and run a very short procedure, called an interrupt handler, to inform the OS that the transfer has been completed.

 

·       When the procedure is finished, the CPU continues executing the current program.

 

·       CPUs use the bus for instructions/data from memory. If the CPU and I/O controller want the bus at the same time a special chip (bus arbiter) decides who goes next.

 

·       I/O devices are given preference since many I/O devices cannot be stopped (e.g. data from a modem).

 

·       Devices wanting to use the bus request, and are granted the bus over the CPU (cycle stealing), slowing down the computer.

 

·       Original PC bus is called ISA (Industry Standard Architecture) bus that is slow. EISA (Extended ISA) is a faster backward compatible bus.

 

·       PCI (Peripheral Component Interconnect) bus is a newer, faster bus available for faster devices

 

 

 

Terminals

 

·       Keyboard and monitor (required by all computers to be present) form the terminal.

 

 

Keyboards

 

·       Keys have a small dome that buckles when pressed closing a circuit.

 

·       When keys are pressed an interrupt is generated and the keyboard interrupt handler (OS service routine) is executed.

 

·       When a key is released another interrupt is generated, allowing SHIFT keys to be recognized as pressed or not, keys held down, etc.

 

 

CRT Monitors

 

·       A monitor contains a CRT (Cathode Ray Tube) which has a gun that shoots an electronic beam against a phosphorescent screen near the front of the tube

 

·       Color monitors use three electron guns for red, green and blue. The ray gun sweeps horizontally, moves back (horizontal retrace) to start again. This is called a raster scan.

 

·       Plates surround the gun and by applying a voltage to the plates the gun is deflected.

 

·       Images are repainted between 30 and 60 times a second.

 

 

·       To produce a pattern of dots on the screen, a grid is placed between the gun and the screen. A positive voltage is applied to attract the electrons and they pass through to hit the screen, which glows briefly. A negative voltage is applied to repel the electrons causing a dark spot.

 

 

Flat Panel Displays

 

·       Flat panels found in laptop (notepad) computers use LCD (Liquid Crystal Displays).

 

·       Basically the screen has two polarized glass plates (one vertical one horizontal) with the liquid crystal between them. Transparent electrodes are attached to the plates and a light is present behind the screen…

 

·       The crystals next to the vertically polarized plate line up vertically, the crystals next to the horizontal plate line up horizontally, the crystals in between line up partially to both forming a twisting structure.

 

·       When light is shone thru the vertically polarized plate, the light twists thru the crystal structure to line the light correctly to pass through the horizontally polarized plate.

 

·       When a voltage is applied, the structure can be altered (untwisted) so that the light no longer passes through.

 

 

Character-mapped Terminals

 

·       Three types of terminals: character-map terminals, bit-map terminals, and RS-232-C terminals.

 

·       Output can use either character-map or bit-map. The screen is thought of as 25 x 80 characters (DOS used to do this).

 

·       In character-mapped video characters are copied by the CPU to the video memory.

 

·       Each character has an attribute byte associated with it that describes how the character is to be displayed (color, intensity, blinking, etc.).

 

·       Video boards repeatedly fetch characters from video RAM and generate the high-frequency analog signal (used to control the screen’s beam).

 

 

 

 

 

Bit-mapped Terminals

 

·       Uses an array of picture elements (pixels). A pixel is either on or off (1 bit).

 

·       Video RAM is like a big array of pixels (640 x 480 to 1280x960). Color uses 8, 16, or 24 bits instead of 1 bit per pixel (true color requires 8 bits per color of red, green and blue giving 24 bits or 3 bytes).

 

·       Allows for very flexible displays (graphics, windows). Requires a lot of memory (800x600 display with true color requires 800x600x24bits x 1byte/8bits = 1.4MB).

 

·       To reduce memory use, sometimes an 8-bit number is used to indicate the desired color on a color palette. A color palette is a table of colors used on the screen, each entry is 24 bits in size (true color).

 

·       Performance is also a problem with bit-mapped terminals since large amounts of data is transferred over the main bus

 

 

RS-232-C Terminals

 

·       Standard interface for terminals. Computer and terminals communicate via the UART (Universal Asynchronous Receiver Transmitter) chip.

 

·       To display a character, the character is fetched and presented to UART, which shifts it out to the RS-232-C cable bit by bit.

 

·       Terminal UART receives the bits and reassembles them into the character to display.

 

 

 

Mice

 

·       A small box that when moved, moves a pointer on the screen.

 

·       The mouse has 1-3 buttons allowing items to be selected, menus displayed etc.

 

·       The mouse uses a small ball that moves two wheels (one vertically, the other horizontally) which drives a variable resister. This changes the resistance and thus the distance the mouse was moved can be determined.

 

·       Another type of mouse uses LED (Light Emitting Diode) and a photodetector. When moved over a special pad (lined with a tight grid) the detector sees a change in light at each grid line and can count the number of lines passed.

 

 

Printers

 

·       Simplest, cheapest, slowest printer is the (dot) matrix printer. These are pretty much obsolete now.

 

·       The print head contains 7-24 electromagnetically activated needles.

 

·       The head is moved across the page, the needles striking a ribbon placed between the page and head.

 

·       Quality is improved by using more needles and overlapping the dots (by passing the head over the same line multiple times).

 

·       Ink jet printers are fairly cheap, slow, and quiet with better quality print. The head holds an ink cartridge and is moved across the page while ink is sprayed from tiny nozzles in the head.

 

·       An ink drop goes in each nozzle, is heated until it boils and explodes shooting out through the nozzle onto the page.

 

·       The nozzle is cooled, drawing a new drop of ink into it. Inkjets have 300 dpi (dots per inch) to 720dpi.

 

·       Laser printers are complex, expensive, high quality, and much faster than inkjet printers.

 

·       Using a drum charged to 1000 volts and coated with a photosensitive material, the drum is turned in small increments. A laser is scanned across the drum (using a octagonal mirror).

 

·       The laser is pulsed on and off, where the laser hits, the drum loses its electrical charge. After a line is painted, the drum turns, the line passes by the toner that is attracted to the black powder.

 

·       As the drum turns, the drum presses against a paper and heated rollers that fuse the toner to the page. When a page is complete, the drum is discharged and scraped clean

·       Lasers have 600dpi or better.

 

·       For gray images a method called halftoning is used. Images are broken down into halftone cells of 6x6 pixels.

 

·       By darkening only some of the pixels, a graying (to the eye) affect occurs (dpi is however reduced).

 

 

 

Color Printers

 

 

·       CRT uses RGB coloring, which involves adding each of the additive primary colors (red, green, blue).

 

·       Reflected images (images that do not have their own light source but simply absorb certain colors) are subtracted from the subtractive primary colors (cyan – absorbs red, yellow – absorbs blue, magenta – absorbs green).

 

·       By mixing the three subtractive primary colors, all color can be produced.

 

·       Hard to get exact colors thus black is hard produce. A black color is used for this purpose. This creates a system known as CYMK (K = black).

 

·       Various methods are used to adjust printers to display color; all involving the CYMK color system.

 

 

 

Character Codes

 

·       Computers use a set of characters, each one is assigned a number e.g. a=1, b=2, etc.

 

·       Mapping of characters to numbers is called a character code. Two widely used standards exist: ASCII and UNICODE.

 

·       ASCII (American Standard Code for Information Interchange) uses 7 bits for each character and 1 bit for parity.

 

·       ASCII characters include control characters for transmission of data (via network or modem), and all the standard American English symbols.

 

·       UNICODE is a newer system designed to allow expression in other languages, which require different characters not present in ASCII.

 

·       UNICODE uses 16 bit symbols, the first 128 are identical to ASCII, the rest are still being defined.

 

·       UNICODE is supported by some computer languages (Java) and OS’s (Windows NT).