0% found this document useful (0 votes)
9 views

Computer Science Lecture Notes 1

A computer is an electronic information processor capable of performing computations without human intervention, offering advantages such as speed, reliability, and the ability to work continuously. Key components include hardware (physical machines), software (programs), and main components like the CPU, RAM, and storage devices. Input and output devices facilitate user interaction, while software development involves problem analysis, design, coding, verification, and maintenance.

Uploaded by

wellington
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Computer Science Lecture Notes 1

A computer is an electronic information processor capable of performing computations without human intervention, offering advantages such as speed, reliability, and the ability to work continuously. Key components include hardware (physical machines), software (programs), and main components like the CPU, RAM, and storage devices. Input and output devices facilitate user interaction, while software development involves problem analysis, design, coding, verification, and maintenance.

Uploaded by

wellington
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Computer Basics

What is a computer?
A computer is an electronic information processor that is able to perform substantial
computation without intervention by human operators.

What are the advantages of computers?


 They can carry out repetitive tasks without fatigue
 They are much less error prone than humans, providing an output of
consistently better quality.
 They are much quicker than humans
 They are reliable than humans, allowing for better planning and control of
output.
 They can work 24 hours a day, in dark, with minimum heating and little
supervision.
 They are immune from human conditions- such as sick leave, maternity
leave, strike, etc.
 They occupy less space than humans; they don’t need seats, desks, canteens,
toilets, etc.
 Over a period of time they cheaper than humans, due to savings in wages
power and accommodation and savings through improved output and
quality.

Hardware and Software

 Hardware - physical machines


 Program - set of instructions to run on those machines
 Software - the collection of such programs

5 Main Components of Computer Hardware

Virtually all computers include the following basic components:


 Main memory (RAM) - fast, volatile storage
 Secondary memory (hard disks, floppy disks, tapes, ...) - slow, non-volatile
storage
 Central processing unit (CPU)
 Input devices (keyboard, mouse)
 Output devices (monitors, printers)

Input/Output devices
Input/output (I/O) devices allow us to communicate with the computer

1. Input Device

Input devices allow us to enter data into the computer.

Examples are:

 Keyboard
 Mouse,
 Pen ,
 Scanner,
 Microphone
 card reader
 switches,
 joystick

2. Output Device

Output devices allow us to get information from the computer

 Screen,
 Printer,
 lights,
 speaker, ... etc.

Keyboards
The most common input device is the keyboard, which looks very similar to a typewriter
keyboard.

Special keys on computer keyboards include:

 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.

Repetitive-stress injuries, such as carpel-tunnel syndrome, can be reduced by using wrist


rests, ergonomically-designed keyboards, and taking breaks. They are a serious problem -
now the most common job-related disability.

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.

Pen Input Devices


These permit you to enter text and select options via a stylus, such as in the Apple
Newton.

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.

To make recognition easier, many systems:

 Only handle block handwriting in fixed boxes.


 Require use of a specially designed alphabet to avoid similar characters, such as 0
and O.
 Are trained on individual handwriting to maximize recognition.

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.

Special purpose terminals include ATM machines.

Sound and Voice


Microphones can be used as an input device to digitize sound.

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.

The primary types of printers today are:

 Dot-matrix printers, which form a character out of a combination of discrete dots.


 Ink-jet printers, which spray ink drops at the paper to form overlapping dots.
 Laser printers, which like xerox machines work by the electrostatic attraction of
toner particles to the page.

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 primary differences between printers is resolution, measured in dots-per-inch; the


speed, measured in pages-per-minutes; and the cost, measured dollars.

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)

Central Processing Unit

The CPU does two things:


 Coordinate all computer operations
 Perform arithmetic and logical operations on data
To execute a program, the CPU reads the instructions in order and does what each one
indicates.
The CPU can:
 Move data from one memory cell to another
 Move data from memory to registers
 Add, subtract, multiply and divide data in registers or memory

 Compare the data in registers or memory and selectively execute code based on
the results of the comparison

6. Main Memory (RAM)

 A silicon-wired card inside the computer box containing huge numbers of


numbered memory locations (bits organized into bytes).
 High speed, low capacity.
 Volatile (memory is lost when power shuts down).
o bit - a binary number; either 0 or 1.
o Stored electronically with 0 meaning off (no power flowing through a
circuit) and 1 meaning on (power flowing).
o Because computer memory is based upon this principle of 2 possible
states, it's useful to work with powers of 2 for computer memory.
o byte - 8 bits, giving 28 (256) possible values - a more useful unit of
measure
o memory address - The location of the first byte of memory used for a
variable. Stored numerically, often in hexidecimal (base 16) format.
7. Secondary Memory - Hard drive, floppy drive, CD-ROM, etc. Low speed, high
capacity. Non- volatile (nothing lost when power is cut.)

Secondary Storage Devices


Secondary storage devices serve the same role as a library does for reading. There is only
room for one book at a time on our reading table (main memory), so we take out what we
need.

The most important secondary storage devices are:

 Floppy disks - cheap, low-speed magnetic media


 Hard disks - high speed magnetic media
 CD-ROMs - high capacity, but are write-once devices.
 Magnetic tapes - highest capacity, used to backup hard disks.

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.

Floppy disks are very fragile things - take care of them!


Formatting
Disks simply store patterns of bits, which can be accessed only by giving the appropriate
address.

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!

Making Software Work

 Operating System - UNIX, Windows, Linux, etc. intermediary between


hardware and software. Coordinates operation of tasks, allocates resources. The
OS is a program itself.
 High-level language - Java, C, C++, Pascal, Basic, etc. Platform-independent
(commands are the same for all kinds of computers)
 Low-level language - Very simple computer instructions given one small step at
a time. True Machine Language is made up of binary numeric codes for these
instructions. We generally deal with its equivalent Assembly Language, which
uses short abbreviations for commands, such as "add" for an addition calculation,
or "sub" for subtraction. Platform-dependent (commands are different for
different kinds of computers)
 Compiler - Converts a high level language to assembly language. Source code to
Object code. A compiler is a program, generally written in a high level language
itself. It inputs an entire source code program (such as C++ or Java) and outputs
that program in machine language. The machine language program can then be
run and understood by the computer. Compilers are platform-dependent. They
produce assembly language that works only on the machine they are running on.
 Interpreter - a program which inputs a source code program (such as Basic or
Lisp) and executes it directly, converting each line of code to machine language
as it goes. This is like compiling and running a program all in one step.
 Java programs are compiled and run in an unsual way - they are both compiled
and interpreted:
Software Development

 Algorithm - a sequence of precise executable steps to solve a problem or


complete a task. May be conveyed using flowchart (e.g. a login procedure) or
Logic Diagrams (e.g. Temperature conversion). Pseudo-code also works.
Planning saves time! Think in terms of what you want, how you can do it, before
you dive in.
 Software Development Life Cycle - Analysis, Design, Implementation, Testing,
Maintenance/Evolution, Obsolescence. Implementation (writing code in Java or
other languages) is only a piece, not necessarily the longest!
 Testing and Debugging - 3 kinds of errors: Syntax/Compile-time, Run-time, and
Logic. Syntax errors often confuse the compiler, so attack the first error, then try
compiling again.

Software development

There are 5 main parts to any software development effort

1. Problem Analysis and Specification - What to do.


2. Design - How to do it.
3. Coding - Just do it.
4. Verification - Does it do what it is supposed to. Does it not do what it isn't
supposed to.
5. Maintenance - Change what it does (usually by repeating 1-4). Bug fixes and
modifications.

This is known as the software life cycle.

You might also like