7-1 communicating with the computer how do programs get in to memory in the first place?...
TRANSCRIPT
7-1
Communicating with the Computer
• How do programs get in to memory in the first place?
• Input/Output (I/O): – Refers to the process of getting information into and out of the
computer.
computercpu
memory
input device(s)
output device(s)
peripheral devices
7-2
I / O
• Peripheral device: a piece of hardware that is outside the main computer.
– “Clearly” peripheral devices are necessary to use our computer in any meaningful way . . .
• Input units: – Computer hardware devices that receive input and bring that
input into the computer– What are some input devices?
• Output units: – Computer hardware that caries information out of the
computer (i.e., produce output)– What are some output devices?
7-3
Input Devices
• Input devices:– Keyboard
– Mouse
– Scanner
– Digital camera
– Video camera/capture device
– Temperature sensor
– Pressure sensor
– How does a keyboard really work?• You press a key (which is really a switch)
• The ASCII code of the key you’ve pressed is sent into the computer
• (Voltage is set on the wires according to the key you’ve pressed)
7-4
Input Devices
• How does a mouse work (physically) ?• (the buttons are just switches)
• A little ball sits inside the mouse
• The ball rolls against three rollers, two of the rollers act as “rotary switches” so they know when they’ve been moved
• When the mouse moves, the ball rolls and the rotary switches are moved as well
– One rotor is aligned to measure left and right movement
– The other is aligned to measure up and down movement
• The changes in X and Y coordinate updates are sent to the computer as binary numbers
– A program needs to be running on the computer that knows what to do with mouse updates
7-5
Output Devices
– Output devices:• Monitor / Video card
• Printer
• Sound card
• Network card
• Robotic arm
7-6
Display Technologies
• Hi-resolution displays come in two types:– Each takes an input signal and creates a visible image
• Cathode ray tube (CRT) - Streams of electrons make phosphors glow on a large vacuum tube.
– Monitor
• Liquid crystal display (LCD) - A flat panel display that uses crystals to let varying amounts of different colored light to pass through it.
– Developed primarily for portable computers.
– Panel
• How does a monitor really work –i.e., how does the image get there?
7-7
Video Display
– How does a monitor really work –how does the image get there?• The video card or graphics card sends video signals to the monitor
• The video card has it’s own memory and CPU
– The Graphics Processing Unit (GPU) receives instructions (from the CPU) to draw an image (bitmap) to the display
– The image data (bitmap) will be copied from primary memory to video memory (VRAM)
– The video signal is sent periodically ensuring that the monitor is displaying the video image described in the VRAM contents
• this is complicated, but the video card takes care of everything for us
• Let’s consider a much simpler output device --
– Daisy wheel printers
» “letter quality” printer
7-8
“Other” Devices• There are other devices that we have yet to mention that don’t fit
nicely into either “input devices” or “output devices”– Floppy drives,
– Hard disks
– CD-ROM drives
– DVD-ROM drives
– CD-RW/DVD-RW drives
• They are input devices to our computer, but can also be output devices. – There’s something else weird about them, consider the type of the input they process
– We consider “traditional” input devices those that deal with original data.
– And define a classification for devices that handle previously stored data.
7-9
Data Sources
• Computer data can be:– Original data: Data being introduced to a computing system for the
first time.
• The input device directly samples physical things in the world (printed text, pictures, sound, and other common types of information) and converts them to binary for the computer
• Think: non-binary inputs that need to be converted
• Examples: ?
– Digitizing: The process of taking an image, audio recording or any other analog data and converting it to a binary format for the computer.
• Allows our computer (and programs) to represent and manipulate “analog data”
7-10
Data Sources
• Computer data can be :– Previously stored data or information: Data that has already been
processed by a computer and is being stored for later use.
• The input devices directly reads binary data (the data has already been converted to binary).
• The binary form of the data is useful only to a computer
– Using a CDR as a drink coaster doesn’t count as using binary data
• Think: Already converted to binary
• Examples:
– music CDs?
– It would be useful to have “previously stored data”-devices that can both read and write binary data
7-11
Storage Devices
• Storage Devices – “Secondary Memory”– used by a computer to
• Write binary information (store)• Read binary information as needed (retrieve)
– compared to primary memory, it’s slower but less expensive• slower means it takes more time to get a bit from the device
– “Secondary” with respect to the Von Neumann model • Technically a kind of memory
– Can be used to manipulate bits• But calling it memory is really incorrect
– By Von Neumann’s definition, it is secondary – not required– Take bits from memory and output them to a device
» Move papers from desk to cabinet– Take bits from a device and put them in memory
» Or move from filing cabinet to desk
7-12
Storage Devices
• Literally, storage devices are input and output devices– Remember, the CPU can only take instructions from primary memory
• If we have a program to run on a storage device compared to directly in memory
– These devices are slower to access, so it may take longer to “find” or “get” our bits
– Then, we’ll need to copy the instructions into memory before we can run them
• If we want to put results on a storage device we’ll need to copy them from memory
– So, if primary memory were cheap enough, would we still need storage devices?
• Yes! Remember, memory contents are lost when power is removed from the computer. This is not the case with storage devices.
• How is a storage device able to “keep” it’s bits where as RAM can not?
7-13
How do we really store data?
• Storage Technologies for Binary Information:– Electronic
– Magnetic
– Optical
7-14
Device Storage
• Electronic Circuits– Most expensive of the three forms for storing binary information.
– A flip-flop circuit has either one electronic status or the other. It is said to flip-flop from one to the other.
– Electronic circuits come in two forms:
• Permanent
• Non-permanent
7-15
Device Storage
• Magnetic Technology– Very inexpensive form of storage
– A special surface can hold magnetic information (+/-)
• Tiny spots on the surface are magnetized to represent 1s and 0s
• It has a magnetic sensing “head” moves over the surface
• Can perform non-destructive reading
• Can destructively write to a surface (over-writing existing 1s and 0s)
– Examples:
» Floppy Drives
» Hard Drives
» Zip Drive
» Tape Drives
7-16
How the disk drive really works …
0111001011100( not to scale :-P )
• The disk is covered in magnetic 1s and 0s
– The disk spins
– The head moves back and forth, reading or writing 1s and 0s from/to the different areas on the disk.
• Like a record player, the head only needs to go in a straight line across the disk, and the disc will spin under it
• Seek time: time it takes to find the desired bit on the physical device.
– complicated, but the hard disk takes care of all of this for us
• Floppy drives, Hard drives . . .– How would a tape drive work?
7-17
Device Storage
• Optical– “Slower” than magnetic media, price is on par– Uses lasers to “read” the binary information from a surface.– Millions of tiny holes are “burned” into the surface of the disc.
• The surface of re-writable optical media is a chemical that changes and reforms when hit with the “low-power” laser head
• The laser “burns” the chemical hence “burning” a CD• The holes are interpreted as 1s. The absence of holes are
interpreted as 0s.
» So, this looks just like before, but instead of a magnetic head, we have a laser head to read the gapping as 0s & 1s
» This is the mechanism for CDs, DVDs, CDRs, Laserdiscs, etc
7-18
Optical Storage Devices
• Optical Disks: CD-ROM, DVD, etc– CD-ROM (Compact Disc - Read Only Memory)
• By its definition, CD-ROM is Read Only.– types of CDs:
» CD-R (Compact Disc - Recordable)» CD-RW (Compact Disc - Rewritable)
– DVD, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-R9/DL• DVD really didn't stand for anything when it was introduced, yet
there are two often used names– Digital Video Disc and Digital Versatile Disc– Neither is “official”
• Writing to an Optical device must be done “in one sitting” as opposed to magnetic media which is easy to change “on the fly”
7-19
Characterizing Capacity
• Capacity - The amount of information that can be stored on the medium.
Unit Description Approximate Size
1 bit 1 binary digit1 nibble 4 bits1 byte 8 bits 1 character (ASCII)1 kilobyte 1,024 bytes 1/2 page, double spaced1 megabyte 1,048,576 bytes 500,000 pages
1 million bytes1 gigabyte 1,073,741,824 bytes 5 million pages
1 billion bytes1 terabyte 1 trillion bytes 5 billion pages
7-20
Capacity continued
• How much storage capacity is needed for…– One keystroke on a keyboard. 1 Byte (8 bits)– One page single-spaced document. 4.0 KB– One second of uncompressed (WAV) sound.176 KB– One hour of uncompressed WAV sound 619MB– One hour of MPEG2 video ~2.3GB
• How much data can be stored on…– One inch of 1/2 in. wide magnetic tape. 4 K– One 3 1/2” floppy disk, high density. 1.4 MB– One Compact Disc. 700 MB– One DVD-R. ~4.3 GB– One Dual-Layer DVD. ~9 GB
7-21
Characterizing Devices
• Type of Access• Sequential - Obtained by proceeding through the storage medium
from the beginning until the designated area is reached (as in magnetic tape).
• Random Access – “Direct” access (as in floppy and hard disks).
• Type of Access directly influences speed– Seek times are longer for sequential access devices – Sequential devices are slower than random access devices
7-22
Characterizing Devices
• Speed (Access time) - How fast information (bits) can be taken from or stored to the device.
– Electronic circuits: Fastest to access.
• 40 billionths of a second.
– Floppy disks: Very slow in comparison.
• Takes up to 1/2 second to reach full speed before access is even possible.
• Why? Have to spin the disk and get the head into the right place. Then the reading of magnetic charge is converted into a 1 or 0
• Why do we tolerate slow devices?– Cost
– Portability?