Transcript Lecture 1

CSC 1401 S1
Computer Programming I
Hamid Harroud
School of Science and Engineering, Akhawayn University
[email protected]
http://www.aui.ma/~H.Harroud/CSC1401
Spring 2009
1
Lecture 1
Overview of Computers and
Programming
Lecture 1: Introduction
Objectives




Overview of the development of computers.
Computer system components.
Software categories and languages.
Process of writing, compiling, and executing
high-level language programs.
Lecture 1: Introduction
3
What Is Computing Science?

Is the study of the theoretical foundations of
information and computation and their
implementation and application in computer
systems.
Lecture 1: Introduction
4
Fields of computing science












Algorithms and data structures
Programming languages and compilers
Concurrent, parallel, and distributed systems
Software engineering
System architecture
Theory of computation
Communications
Databases
Artificial intelligence
Visual rendering (or Computer graphics)
Human-Computer Interaction
Scientific computing
Lecture 1: Introduction
5
What Is a Computer?

A machine that can be programmed to
receive data, store it and process it into
information.


Data: raw facts representing people and events
Information: data that is organized,
meaningful, and useful
Lecture 1: Introduction
6
Fundamental Characteristics



Speed
Reliability
Storage Capability
Lecture 1: Introduction
7
Computer System Components

Hardware


Software


Equipment associated with the system
Instructions that tell the hardware what to do
People


Computer programmer: writes software
User: purchases and uses software

Often called end-user
Lecture 1: Introduction
8
Computer Components

Memory:




Main Memory
Secondary Storage
CPU
I/O devices
Lecture 1: Introduction
9
Central Processing Unit (CPU)

The CPU has two roles:



Coordinating all computer operations
Performing arithmetic and logical operations in data
The processor above can execute a simple
instruction such as an integer addition in one sixbillionth of a second.
Lecture 1: Introduction
10
The Machine Cycle

The time required to retrieve, execute, and
store an operation
Lecture 1: Introduction
11
Memory




Memory cells
Address
Contents
Main Memory



Random Access Memory
Read-Only access Memory
Secondary Memory

CD, DVD, etc.
Lecture 1: Introduction
12
Memory Units

1 Memory Cell = 1 or more Bytes
1 Byte = 8 Bits (Binary Digit)
A Bit is either a 0 or a 1

Units for measuring the memory capacity:






KB: Kilo Byte = 210 = 1024  1000 Byte
MB: Mega Byte = 220  1 million Byte
GB: Gega Byte = 230  1 billion Byte
TB: Tera Byte = 240  1 trillion Byte
Lecture 1: Introduction
13
Data Representation

Computers understand two things: on and off

Data represented in binary form


Binary (base 2) number system
Contains only two digits, 0 and 1

Corresponds to two states, on and off
Lecture 1: Introduction
14
Coding Schemes

Provide a common way of representing a character
of data


Needed so computers can exchange data
Coding Scheme



ASCII (American Standard Code for Information
Interchange).
 128 characters (256 characters in Extended ASCII)
th character)
 A is encoded as 01000001 (66
 3 is encoded as 00110011.
EBCDIC (used by IBM)-256 characters
Unicode - 65536 characters. Two bytes are needed to
store a character.
Lecture 1: Introduction
15
ASCII Table
ASCII Table
Computer Software:
Operation System (OS)

Command-Line Interface



UNIX
MS-DOS
Graphical User Interface


Macintosh OS
Windows
Lecture 1: Introduction
18
Operating System

A set of programs that lies
between applications software and
the hardware


Manages computer’s resources
(CPU, peripheral devices)
Establishes a user interface


Determines how user interacts with
operating system
Provides and executes services for
applications software
Lecture 1: Introduction
19
Kernel

Manages the operating system

Loaded from hard drive into memory when
computer is booted


Booting refers to starting the computer
Loads other operating system programs from
disk storage as needed
Lecture 1: Introduction
20
The Language of a Computer

Since inside the computer digital signals are
processed, the language of a computer is a
sequence of 0’s and 1’s.

The computer language is called the Machine
Language.

A sequence of 0s and 1s is also referred as a
Binary Number Code.
Lecture 1: Introduction
21
The Evolution of Programming Languages

Early computers were programmed in machine language.
 Example: Suppose we want to represent the equation
Wages = Rate X Hours
 to calculate the weekly wages in machine language.
100100
100110
100010
0000 010001
0000 010010
0000 010011
100100 stands for LOAD
100110 stands for MULTIPLY
100010 stands for STORE
Lecture 1: Introduction
22
Assembly languages



Assembly languages: an instruction in assembly
language is an easy-to-remember form called a
mnemonic.
Using the assembly language instructions, the equation
to calculate the weekly wages can be written as
follows:
LOAD
rate
MULT
hour
STOR
wages
Assembler: An assembler is a program that translates
a program written in assembly language into an
equivalent program in machine language.
Lecture 1: Introduction
23
High-Level Languages:
In order to calculate the weekly wages, the equation

wages = rate X hours
in C, can be written as follows:
wages = rate * hours;

Compiler: is a program that translates a
program written in a high level language to an
equivalent machine language.
Lecture 1: Introduction
24
High-Level Languages
Language
Applications Areas
Origin of Name
FORTRAN
Scientific programming
Formula Translation
COBOL
Business data processing
Common Business-Oriented
Language
LISP
Artificial Intelligence
List processing
C
Systems programming
After B
Prolog
Artificial Intelligence
Logic programming
Ada
Real-time distributed systems
Ada Augusta Byron
Smalltalk
GUI, object-oriented programming
Objects “talk” to one another.
C++
Supports objects and object-oriented
programming
Incremental modification of C
Java
Support Web programming
Originally named “Oak”
Lecture 1: Introduction
25
Computer Languages

Machine Language



Assembly Language



Collection of binary numbers
Not standardized
Represented by Mnemonic codes
Not standardized
High-Level Language

Independent of the CPU
Lecture 1: Introduction
26
High-Level Language Program
Lecture 1: Introduction
27
Flow of Information During
Program Execution
Lecture 1: Introduction
28