Friday 24 January 2014

Prelim handouts corlang

What is a Digital Computer?

A digital computer is a fast electronic calculating machine that accepts digitized input information, processes it according to a list of internally stored instructions, and produces the resulting output information.

The list of instructions is called a computer program, and the internal storage is called computer memory.


Types of Computers

Personal Computers. This is the most common computer which has found wide use in homes, schools, and business offices.

Workstations. Although still of desktop dimensions, these machines have a computational power which is significantly higher than that of personal computers. Workstations are often used in engineering applications, especially for interactive design work (CAD/CAM).

Mainframes. A large and powerful computer used for business data processing in medium to large corporations that require much more computing and storage capacity than workstations can handle.

Supercomputers. These are used for large-scale numerical calculations found in applications such as weather forecasting and aircraft design and simulation. In mainframes and supercomputers, the main functional units may comprise a number of separate and often large parts.

Functional Units of a Computer

In its simplest form, a computer consists of five functionally independent main parts: input, memory, arithmetic and logic, output, and control units.

Input Unit

The Input Unit accepts coded information from human operators or from other computers.

Examples:
Keyboard, joystick, mouse, input pen, touch screen, trackball, scanner, bar code readers, microphone, floppy disks, magnetic tapes, compact disks.

The Memory Unit – Primary Storage

Primary Storage or Main Memory (MM). This is where programs are stored during their execution. The MM is a fast memory capable of operating at electronic speeds.

The information in MM is often processed in groups of fixed size called words. The number of bits in a word is the word length of the computer. Typical word lengths range from 16 to 64 bits. The MM is organized so that the contents of one word, containing n bits, can be stored or retrieved in one basic operation.

Since programs must reside in MM during execution, MM is often referred to as the bottleneck in most computer operations.

The Memory Unit – Primary Storage

To provide easy access to any word in MM, a distinct address is associated with each word location. Addresses are numbers that identify successive locations.
... 0124,194,302 4,194,303 Address of 1st Memory Location Memory Location

MM is also known as random-access memory (RAM). RAM is a memory in which any location can be reached in a short, fixed amount of time.

The time required to access one word is the memory access time. For RAMs, this time is fixed, independent of the location of the word being accessed. It typically ranges from 10 to 100 nanoseconds for most modern computers.

Main Memory Divisions

MM is subdivided into the following:

1. Input Storage Area – this area accepts and stores the input data to be processed.

2. Working Storage Space – holds the data being processed as well the intermediary results of such processes.

3. Output Storage Area – maintains the final outputs or processed results of the operations.

4. Program Storage Area – holds the programs or processed instructions given by the user. It stores the entire program that is being executed.

Memory Unit – Secondary Storage

Secondary Storage or Auxiliary Storage. This is used when large amounts of data have to be stored (on a more permanent basis), particularly if some of the data need not be accessed very frequently. This is a storage medium that will hold data and program/sets of instructions even if the computer system is switched off.

Picture, if you can, how many filing cabinet drawers would be required to hold the millions of files of, say the tax records kept by the Bureau of Internal Revenue (BIR). The record storage rooms would have to be enormous. Computers on the other hand permit storage on tape or disk in extremely compressed form. Storage capacity is unquestionably one of the most valuable assets of the computer. Take a simple diskette for example, it can hold the equivalent of 500 printed pages and an optical disk (CD-ROM) can hold approximately the equivalent of 400 books.

Processing Unit

Processing Unit. Also called the Central Processing Unit (CPU) or Central Processor.
It contains a number of high-speed (10 times faster than MM) storage elements called registers that are used for temporary storage of frequently used operands. It is mandatory for data to be stored in a register before it can be processed.

The CPU is composed of the Arithmetic-Logic Unit (ALU) and the Control Unit (CU).

The ALU is where all arithmetic and logic operations and manipulation of numbers take place.

The CU is the nerve center of a computer. It controls the entire activity of the CPU. It controls and coordinates the order and execution of program instructions. It accesses instructions in sequence, interprets them and then directs their implementation.

The ALU is where all arithmetic and logic operations and manipulation of numbers take place.

The CU is the nerve center of a computer. It controls the entire activity of the CPU. It controls and coordinates the order and execution of program instructions. It accesses instructions in sequence, interprets them and then directs their implementation.

Output Unit

It sends processed results to the outside world.

Examples: Display screens, printers, plotters, modems, microfilms, synthesizers, high-tech blackboards, film recorders




Basic Operation of a Computer

The operation of a computer can be summarized as follows:

1. The computer accepts information in the form of programs and data through an input unit and stores it in memory.
2. Information stored in the memory is fetched, under program control, into an arithmetic and logic unit, where it is processed.
3. Processed information leaves the computer through an output unit.
4. All activities inside the machine are directed by the control unit.




Basic Concepts of Computer Architecture

Computer Architecture is the design of computers, including their instruction sets, hardware components, and system organization.

Most computers follow the Von Neumann Architecture, also known as the Stored Program Architecture or the Fetch-Decode-Execute Architecture.

Von Neumann architecture simply means that programs (together with data) are stored in main memory during execution.

Not all computers follow the Von Neumann architecture. Some examples are processor array architecture, multiprocessor architecture, dataflow architecture, and neural network architecture.




Types of Programming Language

The different types of programming languages are as follows:

1. Machine Language
2. Assembly Language
3. High-level Language
4. 4GL Language

Machine Language
The natural or primitive language that the computer actually understands. This programming language consists of 0’s and 1’s which makes programming very difficult.

Sample machine language program to add 5 and 3 (using the Intel microprocessor instruction set):

10111000
00000101
00000000
10111011
00000011
00000000
00010001
11011000

Assembly Language

A programming language that uses “abbreviations” or mnemonics in place of binary patterns in order to make the task of programming easier. Mnemonics are designed to be easy to remember and are a significant improvement over binary digits.

An assembly language program has to be converted to machine language before a computer can execute it. An assembler is a special program that translates assembly language mnemonics into machine language.

Sample assembly language program to add 5 and 3 (using the Intel microprocessor instruction set):

MOV AX, 05
MOV BX, 03
ADC AX, BX

High-Level Language

A programming language that uses English-like commands or instructions. High-level languages are the easiest to use and contains many complicated or advanced instructions. Also known as the third generation language (3GLs). Most 3GLs support structured programming.

A high-level language has to be converted to machine language before a computer can execute it. A compiler is a special program that translates high-level language instructions into machine language.

Examples of High-level Languages:

1. FORTRAN (FORmula TRANslation)
2. COBOL (COmmon Business-Oriented Language)
3. BASIC (Beginner’s All-purpose Symbolic Instruction Code)
4. Pascal
Sample BASIC program to add 5 and 3:
LET A = 5
LET B = 3
LET C = A + B

Fourth Generation Language

A fourth-generation programming language (or 4GL) is a programming language designed with a specific purpose in mind such as the development of commercial business software. The process of software development had been much improved with modern block structured third-generation programming languages but it was still frustrating, slow, and error prone to program computers. This led to the first "programming crisis", in which the amount of work that might be assigned to programmers greatly exceeded the amount of programmer time available to do it. Meanwhile, a lot of experience was gathered in certain areas, and it became clear that certain applications could be generalized by adding limited programming languages to them.

The term 4GL, according to James Martin, was first used in his 1982 book, Applications Development Without Programmers. This refers to non-procedural high-level specification languages. Nevertheless, the great majority of users of 4GLs would describe themselves as programmers and most 4GLs allowed for (or required) system logic to be written in a proprietary macro language or in a 3GL.

All 4GLs are designed to reduce:
Programming effort.
The time it takes to develop software.
The cost of software development.

They are not always successful in this task and sometimes result in inelegant and unmaintainable code. However, given the right problem the use of an appropriate 4GL can be spectacularly successful.
Some successful 4th-generation languages are:
Database query languages
o SQL
o Oracle SQL*Plus
o Progress 4GL

Report Generators:
o Oracle Reports
o LINC
o GEMBase
o BuildProfessional
o Informix-4GL
o Metafont
o RPG-II
o S
o IDL-PV/WAVE
o Gauss
o Mathematica




Advantages of High-level Languages

Advantages of using high-level languages over low-level languages:

1. Easy to Learn. Low-level languages are more cryptic than high-level language.

2. Predefined Functions. Most high-level languages provide many pre-defined functions and subroutines, thereby simplifying programming tasks.

3. Portability. Low-level languages are specific towards a certain processor. The instruction set of the Intel processors (IBM PC’s and compatibles) is very much different from the instruction set of the Motorola processors (Apple Macintosh).




Advantages of Low-level Languages

Advantages of using low-level languages over high-level languages:

1. Compact Code. Programs are executed in their machine language format. Programs written in a high-level language should still be compiled and translated to machine language. Most compilers are not optimized to generate compact code.

2. Speed. This is directly related to compact code. The shorter the code, the shorter the execution time of the program.

3. Flexible. Low-level language does not constrain the programmer to follow a certain programming convention (i.e. modularity) or a rigid coding constraint (i.e. the called routine should be placed before the calling routine).

Application programs are now more and more complex and test the high-level language to its limit. High-level programmers now use assembly language-based subroutines to augment the capabilities of high-level languages.




GENERALIZATION:

o A digital computer is a fast electronic calculating machine that accepts digitized input information.
o Personal computers are the most common computer.
o Workstations are machines that have a computational power which is significantly higher than that of personal computers.
o Mainframes are large and powerful computers used for business data processing.
o Supercomputers are used for large-scale numerical calculations found in applications such as weather forecasting and aircraft design and simulation.
o Primary storage or Main Memory (MM) is where programs are stored during their execution.
o The CPU is composed of the Arithmetic-Logic Unit (ALU) and the Control Unit (CU).
o Computer architecture is the design of computers, including their instruction sets, hardware components, and system organization.

REFERENCES:
o Tanenbaum, Andrew S., (2005), Structured computer organization, Prentice Hall
o Hamacher, V. C., (2002), Computer organization (5th ed.), McGraw Hill
o Stallings, William, (2009), Computer organization and architecture : designing for performance (8th ed.), Prentice-Hall International
o Carpinelli, John D., (2001), Computer systems organization & architecture, Addison-Wesley
o Berger, Arnold S., (2005), Hardware and computer organization : the software perspective, Amsterdam : Elsevier/Newnes



2 comments: