Introduction and Overview: 1.1 Computer Organization

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

1.

INTRODUCTION AND OVERVIEW

1.1 COMPUTER ORGANIZATION

A computer, in short, is an information processor. Data and information can be entered


into the computer as input and then processed to produce output (see Figure 1.1)

Input Computer Output

Figure 1.1: Structure of a Computer

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.

Functional Components of a computer

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

Figure 1.2: Basic structure of a computer

MT 512: Programming Design Page no: 1


1. Input Devices:
Allows getting data into the computer. A simple example of input device is keyboard.

2. Output devices:
Shows the result after processing data or information.

3. Central Processing Unit (CPU)


It is electronic circuit that manipulates data into the required information. That is,
CPU executes the computer instruction. It consists of two parts, Arithmetic Logic
Unit (ALU) and Control Unit (CU).

- Arithmetic Logic Unit


It the “Brain” of the computer system, i.e., performs the most important operation
of the computer system – arithmetic and logic operation on the data.

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

MT 512: Programming Design Page no: 2


1.2 COMPUTER PROGRAMMING

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.

1.2.2 Programming Languages

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.

1.2.3 Program Specifications

Before a program is written, a detail specification must be drawn up showing exactly


what is to be done by the program. This may have already been done for the programmer
or by another more senior programmer or a system analyst. It is very important that a
programmer should not start trying to write a computer program before a clear
specification has been created. Usually, such as a specification is in three main parts:

MT 512: Programming Design Page no: 3


a) Input: a description of the format of the input data.

b) Output: a description of the format of output data.

c) Processing: a description of the processes of the program must follow to get the
output from the input.

1.2.4 Programming Circle

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.

i. Defining the problem


ii. Planning the solution
iii. Coding the Program
iv. Testing the Program
v. Documentation

i. Defining the Problem


Analyzing system requirements, i.e., kind of input, processing, and output required.

ii. Planning the solution


To solve programming problem, one must follow a methodical approach, i.e., design an
ordered set if activities that will convert a given input into the desired an algorithm (An
algorithm is a step-by-step procedure to solve a given problem) for the problem. An
algorithm consists of three main components. These are input, process and output.

Algorithms implemented by a computer are known as computer programs. A program


consists of basically the following operations: -

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

iii. Coding the Program


We need a language to express an algorithm. A computer algorithm requires a computer
language. There are many high-level languages, each with a different compiler, such as
FORTRAN, COBOL, C, C++, Pascal, ADA, ALGOL, BASIC, etc.

iv. Testing the Program

MT 512: Programming Design Page no: 4


Once the program code is written, it is very unlikely that it will be perfect on the first run.
Programming errors are common in the early versions of the program. Most programmers
use the phase: desk-checking, translating and debugging.

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

v. Documenting the Program


Documenting the program is a detailed description of the programming cycle and specific
facts about the program. Documenting is an on-going process needed to supplement
human memory and help organize program planning. Documentation is also critical to
communication with other who might have an interest in your program. Typical
documentation materials include origin and nature of the problem, brief description of the
program, logic tools such as flowcharts and pseudocode, and testing results. Comments
on the program code are also an important part of documentation.

MT 512: Programming Design Page no: 5

You might also like