Sunteți pe pagina 1din 51

Chapter 1

Introduction to computers

Objectives of this Chapter:


To Understand/ To know/
What Is Computer? Computers Component categories of computer data storage in computer What is CPU? Kinds of memories kinds of Computer Software Kinds of Machine Language What happens when you write a program? What is the use of compiler?

What is a Computer?
Computer is an electronic machine that can receive, store or process data according to a set of instructions (computer program) and output information.
input Process output

data

information

What is a computer?
A machine electronic components (hardware) receives controlled instructions (software) stored within its memory.

What is a computer?
Consist of basic components:
input devices output devices system unit storage devices communication devices

Components of a Computer System

Categories of computers
Categories
Personal computers (desktops) Mobile computers / devices Embedded computers Servers Mainframes Supercomputers

Size
Be placed on a table

Portable and fits by hand-carrying


Small and embedded into devices Small cupboard Half a room to a room full A room full of equipments

Categories of computers

Embedded computers Mainframes Source: Google Images

Categories of computers

Supercomputers Source: Google Images

Data representation
Digital form Two states: on and off Digit 0 = off Digit 1 = on Digit 0 and 1 is known as Bit (short for binary digit). 8 bits = a byte 1/0

Binary coding scheme


Represents 256 different individual characters Two most popular coding schemes:
American Standard Code for Information Interchange (ASCII) Extended Binary Coded Decimal Interchange Code (EBCDIC)

Binary coding scheme


Symbol A B 1 2 # & ASCII 0100 0001 0100 0010 0011 0001 0011 0010 0010 0011 0010 0110 EBCDIC 1100 0001 1100 0010 1111 0001 1111 0010 0111 1011 0101 0000

What happens?

j
ASCII to Binary conversion 01101010

1 or 0

2
128

2
64

2
32

2
16

4 2
8

2
4

2
2 1

Total=256

Example
0
7

1
6

0
5

0
4

0
3

0
2

0
1

1
0

2
0

2
64

2
0

2
0

2
0

2
0

2
0

2
1

Total: 64+1= 65

Refer to Table of ASCII Characters the character is

Input / Output Devices


Input is data or instructions that user or other sources gives command to the computer on how they should operate Output is the useful outcome after the computer has completed its operation

Sample input

Sample output

System Unit

Source: Google Images

System Unit
Contains all the electrical components that the computer uses to process data. Processor (central processing unit, CPU) interprets and manages most of the computers operation.

Source: Google Images

Computer Hardware Central Processing Unit (CPU)


2 roles of CPU
coordinating all computer operations (control unit), and performing arithmetic and logical operations on data (arithmetic and logic unit).

During the process, current instruction and data are stored temporarily inside the CPUs special high-speed memory locations called registers.

Processor
Two parts:
control unit: directs and coordinate most operations in the computer arithmetic logic unit (ALU): performs arithmetic and comparison.

Memory
A temporary storage unit 3 things it stores:
Operating system and other system software of the computer and its devices Application programs with tasks Data being processed by programs and its results.

Source: Google Images

Memory
2 kinds of memory - volatile (temporary) and nonvolatile (permanent) Volatile memory loses its contents when power is turned off Non-volatile memory does not lose its content

Memory
Computer memory can be divided into two categories
main memory secondary memory

There are 2 types of main Provides semi-permanent memory data storage capability RAM temporary storage and volatile (contents is gone when the computer is switch off) ROM stores information permanently and NOT volatile

Memory
Transfer of data from storage to memory

Memory
Each bytes resides temporarily in memory has an address. This address is a unique number that identifies the location of the memory.

Source: Google Images

Computer Hardware Memory

Memory an ordered sequence of storage locations or memory cells, each of which has a unique memory address Memory cell an individual storage location in memory Assigning a new data to a memory cell will destroy its previous content 1 byte == 8 bits

Storage
Stores data, instructions and information to be used in the future Eg. music, movies, assignment, pictures Save data, instructions or information from memory to storage medium, that process is known as writing. To recall data from a medium to memory, it is known as reading.

Storage

Source: Google Images

Computer Software
Instruction that instructs the computer what to do and how to execute There are Three (3) categories of computer software
System Software Application Software Computer Languages

Software
System software - control and maintain the operations of the computer and its devices. Divided into 2:
operating system utility programs

Source: Google Images

Computer Software Operating System


System Software = Operating System (OS) software that controls interaction of user and computer hardware and that manages allocation of computer resources. i. e.
Communicating with the computer user
Collecting input from input devices. Conveying program output to output devices

Booting a computer loading the OS from disk into memory

Managing allocation of memory, of processor time and of other resources for various tasks Accessing data from secondary storage Writing data to secondary storage

Computer Software Application Software


Application software used for a specific task such as word processing, accounting, or database management. i.e
Microsoft Word Microsoft Excel Microsoft Access Web browser, Opera, Mozilla etc.

Computer Software Computer Languages


Three (3) types of computer languages
Machine language
Binary number codes (0 and 1) understood by a specific CPU

Assembly language
Mnemonic codes that correspond to machine language instructions

High-level language
Machine-independent programming language that combines algebraic expressions and English symbols

Compiler is used to translate a high-level language program into machine language

Computer Software Machine Language vs. Assembly Memory Addresses Machine Language Assembly Language Language
Instructions Instructions

00000000

00000000

CLA

00000001
00000010 00000011 00000100

00010101
00010110 00110101 01110111

ADD A
ADD B STA A HLT

High-Level Languages
Language Application Area

FORTRAN
COBOL LISP C Prolog Ada Smalltalk C++ Java

Scientific Programming
Business Data Processing Artificial Intelligence Systems programming Artificial Intelligence Real-time distributed systems Graphical user interface; Object oriented (OO) programming Supports OO programming OO & Support web programming

Writing programs
Programmers - write programs to instruct the computer what to do Various languages C++, Visual Basic, Java, C#, Phyton, PHP, HTML, Pascal

Writing programs
What happens when you write a program?

Entering, Translating and Running a HighLevel Programming Language

Entering, Translating and Running a HighLevel Programming Language


Save the file Do some testing by entering the data. Check for logic error. If there is error do some correction

Do correction - usually for syntax error

Do editing

If not satisfy with the result do some editing

Example:
Write program(source file)..

Save file..

Compile.

2. If there is error then fix your program

2. Fix the error, save file and compile again

Successfully compile
Fixed

2. If the compilation succeed then time to execute program

2. Test the executable file by entering input

REVISION
Computer programs are___________of computer component while a disk drive is a ____________. List 2 function of CPU List 2 input devices, 2 output devices and 2 secondary storage. ____________ translate _____________ language program into _________________ What is relationship between memory cell, bytes and bits?

S-ar putea să vă placă și