Computer Science Lecture Notes 1
Computer Science Lecture Notes 1
What is a computer?
A computer is an electronic information processor that is able to perform substantial
computation without intervention by human operators.
Input/Output devices
Input/output (I/O) devices allow us to communicate with the computer
1. Input Device
Examples are:
Keyboard
Mouse,
Pen ,
Scanner,
Microphone
card reader
switches,
joystick
2. Output Device
Screen,
Printer,
lights,
speaker, ... etc.
Keyboards
The most common input device is the keyboard, which looks very similar to a typewriter
keyboard.
Escape, control, alt - Like the more familiar shift key, these put the keyboard into
different modes, to provide additional key combinations. Typically used for
program commands. Escape is a good thing to hit when you are confused.
Enter or Return - The return key signifies the end of the input line or paragraph.
Numerical keypad - Supposedly useful when you are entering just numbers.
Cursor keys - Enable you to move up, down, left, right.
Function keys - Extra keys which may be supported by the application for
application-specific functions. Often can be programming or assigned by the user.
Insert, Delete, Home - Extra keys which may be supported by the application for
standard tasks.
Status lights typically record if the keyboard is locked in shift or numeric modes.
How can one enter Chinese or Japanese, which have thousands of letters, on an English
keyboard? A combination of escape keys and menus is usually used.
How can one convert a keyboard from QWERTY to Dvorak layout? This can be done via
software, not hardware changes - a program takes each typed character and translates it to
the desired one before passing it on.
The Mouse
This pointing device has become essential with graphical user interfaces. There are two
types of mice:
Optical mice which look for movement on the grid-like mouse pad. These are more
precise but less flexible.
Mechanical mice which detect motion via the rubber `mouse ball' underneath. This is
what you will most likely use.
Control of mouse speed, acceleration, and update rate is via software. Typically you can
customize these through the operating system. These do not effect how fast you can
physically move the mouse, but how physical movements correspond to screen changes.
Mice can be slow to use because one must move their hand from the keyboard.
Trackballs or thumbwheels can minimize this problem.
Handwritting recognition is a hard problem for people, even more so than for machines.
Much of our ability to read handwritting comes from context, and so requires
understanding.
Many applications do not require recognition, such as jotting notes, menus, pointing and
other gestures.
Other pointing devices include trackballs and joysticks, particularly for portable
computers. Also light pens and touch screens for special-purpose applications.
Scanners
Image or page scanners enable one to input a picture into the computer.
Each picture is converted into pixels, colored dot picture elements. These can take a lot of
space.
Optical character recognition (OCR) converts the pixel-images to text that can be
handled by normal applications. Recognition accuracy depends upon the software, the
image quality, and the types of fonts used in the document.
Magnetic ink character recognition is used by banks with checks. A special font is used
to make it more accurate to read, as well as special ink. Various types of `computer
crimes' involve altering magnetic ink numbers.
Terminals
A terminal is a keyboard and screen device for connecting to a computer.
As microcomputer prices keep dropping, terminals have been getting smarter and
smarter, so they can be used for some of the processing as well. Terminals are commonly
called smart and dumb to define how much processing they are cable of.
When you are using a modem to connect your computer to the Internet, your computer is
functioning as a terminal.
Computers can be used to enhance and process sounds, to clarify noisy transmissions or
add special effects for recordings.
Voice input systems are still under development. The problem gets harder when you seek
large-vocabulary, speaker-independent, connected speech recognition systems.
The best current applications are special purpose vocabularies, like radiology.
Voice input will never completely replace the keyboard. Think about two people sharing
an office!
3. Output Device –
Screen,
Printer, etc.
Printers
The most common output devices are the monitor and printer.
Printers generate `hard copy'. With modern WYSIWYG software, you should need to
print fewer drafts of intermediate work than in years past.
Becoming less important are printers which, like typewriters, are incapable of changing
fonts in software. All three of the above are capable of printing arbitrary graphics and
alphabets, given the right software.
The difference in device speeds is both a function of printing technology and the rate at
which you can get images into the device. Laser printers work best with a fair amount of
on-board memory, to store up pages to be printed.
Although improvements in printer resolution are continuing, eventually the human eye
will not detect the difference. Current printers are 300-600 dots per inch, while photos are
approximately 1000 dots per inch.
Display Devices
A monitor is the most common computer display device. Electronic display screens are
either CRTs or LCDs:
Cathode-ray tubes (CRTs) are the screen device behind televisions. Electron guns
aim at light emitting phosphors on the inner surface of the screen.
Liquid crystal displays (LCDs) are the screen device behind digital watches. The
work by passing electricity through a chemical which changes light transmission
on being charged.
Both LCDs and CRTs compose images of dots, or picture elements or pixels. Resolution
on both are substantially lower than on good printers, only 100 dots-per-inch or so.
LCDs are used primarily for portable computers, since they are cool and light. They are
still too expensive to replace CRTs, but maybe will some day.
When I was a student, there were printing terminals (so called teletypes) but happily
these seem to have disappeared.
4.
5. Central Processing Unit (CPU)
Compare the data in registers or memory and selectively execute code based on
the results of the comparison
Floppy disks
Floppy disks used to be floppy - now they are encased in a hard shell, but inside the
magnetic material is still flexible.
Magnets have north and south poles. All magnetic media work by controling the
orientation of the magnetic field. North/south = 0/1.
Standard 3.5 inch diskettes hold 1.4 megabytes each, although even higher densities are
possible.
Achieving higher densities requires both more sophisticated floppy disk drives with
better magnetic heads, and also better quality ("double density") diskettes with the
magnetic bits closer together.
We seek to access what is on the disk by their file names. To do this, there must be a
place on the disk which for each file name records where on the disk it is.
Setting up an initial file directory, and other disk organization information must be done
by software. This process of organizing the raw bits is called formatting.
Making sense of the data on the disk requires the "disk controller software" to understand
the specific disk format used. This is one reason why IBM PCs cannot easily read Apple
diskettes and visa versa.
Hard Disks
Hard disks are much faster than floppy disks because they revolve around so much faster,
say 3600-7200 revolutions per minute, vs. about 360 rpm.
Because hard disks are not removed and transported the way floppies are, there do not
have to be a standard size. Each company tried for the biggest capacity they can get
instead of having to satisfy a standard.
Hard disks for PCs have capacities up to about 4 megabytes, but even larger sizes exist
on mainframes and supercomputers.
The disk head flies amazingly close over the surface of the disk, while the floppy disk
head scrape the disk.
The time to get data from a spinning disk is a combination of seek time (how long does it
take the head to get to the right track), latency time (how long does it take for the data to
rotate under the head), and read time (how fast can we grab data as it rotates under us).
CD-ROMS
CD-ROMs are an optical, not magnetic media, with a capacity of 650MBs.
Bits are written on the disk using a laser, which etches a mark which does not reflect light
for a 1.
CD-ROMs are write once, read many times, sometimes called WORM media. How
useful would a WOM be?
CD-ROMs are read by shining a laser on the disk, and seeing if the light is reflected or
not.
CD-ROM drives are sold according to speed. Thus a drive is four times faster than the
original slow media.
Magnetic Tapes
The highest capacity media are magnetic tapes, which usually used to backup or archive
data.
Backup is a critical problem, especially for home and small business computers, because
people usually keep the backups current. Then the disk crash comes.
Tapes are sequential access media, unlike disks, which is one reason they are so slow. To
get a file at the end of the tape, you must scan through the entire tape!
Software development