Introduction and Overview: 1.1 Computer Organization
Introduction and Overview: 1.1 Computer Organization
Introduction and Overview: 1.1 Computer Organization
The physical components of a computer together with devices that perform the input and
output are referred to as hardware. A set of computer instruction performed by the
computer is called a computer program. A significant part of this course deals with
problem solving and how to design computer programs. The set of programs written for a
computer is referred to as software.
Generally, Computer hardware is divided into four main functional areas. These are Input
devices, Output devices, Central Processing Unit (CPU) and Memory, see Figure 1.2
below.
CONTROL
UNIT
INPUT
OUTPUT
ALU
MEMORY
2. Output devices:
Shows the result after processing data or information.
- Control Unit
Directs and coordinates the execution of stored program instruction.
4. Memory
There are two kinds of computer memory: primary and secondary. Primary memory
is accessible directly by the processing unit. Random Access Memory (RAM) is an
example of primary memory. As soon as the computer is switched off the contents of
the primary memory is lost. You can store and retrieve data much faster with primary
memory compared to secondary memory. Secondary memory is used to store data
permanently. An example of this type of memory includes floppy disks, magnetic
disk. Primary memory is more expensive than secondary memory. Because of this the
size of primary memory is less than that of secondary memory.
Computer memory is used to store two things: (i) instructions to execute a program
and (ii) data. When the computer is doing any job, the data that have to be processed
are stored in the RAM. This data may come from an input device like keyboard or
from a secondary storage device like a floppy disk.
In computer all information are stored in the form of bits. A bit is a binary digit,
which is either 0 or 1. A unit of 8 bits is known as Byte.
Computer memory is expressed in terms of the number of bytes it can hold. The
number of bytes is expressed as kilobytes, 2 to the 10th power (210), or 1024 bytes.
kilobyte is abbreviated KB, or simply K. Thus, the memory of a 640K computer can
store 640 x 1024, or 655,360 bytes of data. Memory capacity is most often expressed
in terms of a megabyte (1024 x 1024), abbreviated MB. One megabyte is roughly
one million bytes. Some large computers express memory in terms of gigabytes
(abbreviated GB)-billions of bytes.
1.2.1 Program
Computer is a dumb machine and it cannot do any work without instruction from the
user. It performs the instructions at tremendous speed and with accuracy. It is you to
decide what you want to do and in what sequence. So a computer cannot take its own
decision as you can. Therefore, it requires specific logically related instructions that the
developer feeds into a computer to solve a particular problem. These instructions are
termed as program.
We can acquire a program in two ways; packaged software and custom software.
Package software is a readymade set of programs while custom software is a set of
programs that a written according to the user’s requirements.
What language will a programmer use to communicate with the computer? Surely not the
English language, which-like any human language-can be loose and ambiguous and full
of slang, variations, and complexities. A programming language is needed. A
programming language is a set of rules that provides a way of telling the computer what
operations to perform.
A programming language, the key to communicating with the computer, has certain
definite characteristics. It has a limited vocabulary. Each “word" in it has precise
meaning. Even though a programming language has limitations, it can still be used in a
step-by-step fashion to solve complex problems. There is not, however, just one
programming language; there are many.
There are various kinds of programming languages used to create programs. An example
of these languages includes COBOL, BASIC, FORTRAN, C, C++, and Pascal. All
languages have a grammar of their own -known as syntax of the language.
Programs written in any language are represented in a binary form (series of 1s and 0s) so
that the computer can execute them. Thus, all programs written in different programming
languages are translated into the binary code before the computer can execute them.
c) Processing: a description of the processes of the program must follow to get the
output from the input.
When preparing problem solutions for the computer, it is not enough just to know the
rules of a computer language. Problem-solving skills are essential to successful
programming. In solving a problem, developing a program requires five steps.
a) Sequence- in order
b) Selection - Choosing from set (e.g., if…else)
c) Iteration – Repetition
These three operations are sufficient to describe any algorithm.
There are many approaches to planning solution, the common one are flowcharts and
pseudocode. We will discuss these approaches in incoming chapters
Desk-checking: Tracing down the program code to discover any error that might be
there. Similar to proof reading and may uncover several errors.
Translating: A translator is a program that converts the code into a language, which the
computer can understand. A compiler is a translator and has in-built capabilities of
detecting errors and produce a listing of them. These are mostly errors due to the
wrong syntax in the use of the language.
Debugging: Detecting errors (bugs) by running the program. Most of the errors in this
phase are due to the logic of the program