Professional Documents
Culture Documents
Lecture02 by Asma
Lecture02 by Asma
Lecture02 by Asma
Introduction
Asma Majeed
1
Computer Architecture
Agenda
Computer Programming
To be followed in today’s lecture
Motivation
Introduction to C
Features of C language
2
The Computer
3
Central Processing Unit
Data it processes is obtained, via the system bus, from the main memory
Results from the CPU are then sent back to main memory via the system bus
4
Memory
• Memory of a computer
• Program instructions, data values, and the intermediate results
of calculations
• Information in memory is encoded in fixed size cells called bytes
• Byte can hold a small amount of information, such as a single character
or a numeric value between 0 and 255
5
Central Processing Unit
• CPU has two main components
• The Control Unit
• The fetching of instructions from the main memory and the subsequent
execution of these instructions
• Control of input and output devices and the passing of data to the
Arithmetic/Logical Unit for computation
• The Arithmetic/Logical Unit (ALU)
• Carries out arithmetic operations on integer (whole number) and real (with a
decimal point) operands
• Can also perform simple logical tests for equality and greater than and less than
between operands
6
Memory
• Two main categories of memory
• Main Memory
• Working memory of the CPU, with fast access and limited numbers of bytes being
transferred
• External memory
• For the long term storage of information
• Data from external memory will be transferred to the main
memory before the CPU can operate on it
7
Input/Output Devices
8
The System Bus
• All communication between the individual major components is
via the system bus
• A cable which is capable of carrying signals representing data
from one place to another
• Data from memory to a printer will be sent via the system bus.
• Control signals that are necessary to access memory and to
activate the printer are also sent by the CPU via the system bus
9
Information Representation
• Information inside the computer and on external storage
devices is represented in a form related to the Binary number
system
• Information on external memory is organized into files
• File could hold the text of a document, a computer program, a
set of experimental results etc
10
The Execution Cycle
• When a computer obeys the instructions in a program it is said
to be running or executing the program
• Computer can execute a computer program that is resident in
memory
• Program must occupy a set of consecutive bytes in memory and
must be written in the internal machine language for the
computer
11
What is Programming?
Machine Languages
Assembly Languages
0s and 1s
High Level Languages
Machine dependent Low level language
Architecture Independent
dependent e.g. C, C++, C#, .Net,
Java etc
13
Skills you’ll learn
14
Take this course if you
like solving tricky problems
15
Fields of Computer Science
Few Examples
16
We will be studying a programming language called C.
Introduction to C
18
Why C?
• As a middle level language,
• C combines the features of both high level and low level languages.
• It can be used for low-level programming
• such as scripting for drivers and kernels
• provide low-level access to memory
• It also supports functions of high level programming languages
• such as scripting for software applications etc.
• encourage cross-platform programming
• Relatively simple
• facilitates structured programming
• platform independent (Linux, Mac, Windows. . . )
• widely used
Strengths and Features
low-level a c c e s s to
memory
structured platform
programming independent
Modularity
20
Home Assignment
Read Chapter 1 of the Text book
for further theoretical
knowledge about Programming
(in Particular C)
21