You are on page 1of 30

CSC 1401

Computer Programming I
Hamid Harroud
School of Science and Engineering,
Al Akhawayn University in Ifrane
h.harroud@aui.ma

Spring 2015
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 Computer 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 computer 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.
• A computer’s four major functions:
– Gathers data (users input data)
– Processes data into information
– Outputs data or information
– Stores data and information

Lecture 1: Introduction 6
Data vs. Information
• Data: Representation of a fact, figure, or idea
• Information: Organized, meaningful data

7
Computer System Components

• Hardware
– Equipment associated with the system
• Software
– 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 Hardware
• Memory:
– Main Memory
– Secondary Storage
• CPU
• I/O devices

Lecture 1: Introduction 9
Computer Hardware:
The Motherboard
• CPU
• RAM
• Expansion
cards and
slots
• Built-in
components

10
Central Processing Unit (CPU)
• Referred to as the “brains” of the computer
• Controls all functions of the computer
• Processes all commands and instructions
• Can perform billions of tasks per second

11
CPU Performance Measures
• Speed
– Megahertz (MHz)
– Gigahertz (GHz)
• Cores
– Single
– Dual
– Quad

12
The Machine Cycle
 The time required to retrieve, execute, and store an
operation

Lecture 1: Introduction 13
Memory
• Main Memory
– Random Access Memory
– Read-Only access Memory
• Memory cells
– Address
– Content
• Secondary Memory
– CD, DVD, etc.

Lecture 1: Introduction 14
RAM vs. ROM
• Random access • Read-only memory
memory (RAM): (ROM):
– Stores instructions – Stores start-up
and data instructions
– Temporary – Permanent storage
(volatile) storage
– Consists of several
memory cards or
modules

15
Computer Software
• Software: Programs that enable
hardware to perform different tasks
– Application software
– System software

16
System Software vs.
Application Software
System Software Application Software
• Coordinates • Programs used to
instructions complete tasks
between software • Includes
and hardware – Productivity software
• Includes – Specialty software
– Operating system – Entertainment
– Utility programs software
– Educational and
reference software
– Personal software 17
System Software: The OS
• Controls computer functions (hardware,
processor, memory, peripheral devices)
• Provides means for software to work with
CPU
• Responsible for management, scheduling,
and interaction of tasks
• Provides user interface

18
Operating System Categories
• Traditionally included four categories:
– Single-user, single-task
• Example: MS-DOS
– Single-user, multitask
• Example: Apple’s Mac OS
– Multiuser
• Example: Microsoft Windows
– Real-time (RTOS)
• Example: found in measurement instruments

19
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 20
Bits and Bytes:
The Language of Computers
• Bit
– Binary digit
– 0 or 1
• Byte
– 8 bits
• Each letter, number, and
character is a string of eight
0s and 1s

21
How Much Is a Byte?
Name Abbreviation Number of Bytes Relative Size
Byte B 1 byte Can hold one character of data.
Kilobyte KB 1,024 bytes (210 bytes) Can hold 1,024 characters or about
half of a double-spaced typewritten
page.
Megabyte MB 1,048,576 bytes (220 bytes) Can hold approximately 768 pages of
typed text.
Gigabyte GB 1,073,741,824 bytes (230 bytes) Approximately 786,432 pages of text;
500 sheets of paper is approximately
2 inches, so this represents a stack
of paper 262 feet high.

Terabyte TB 1,099,511,627,776 bytes (240 bytes) This represents a stack of typewritten


pages almost 51 miles high.

Petabyte PB 1,125,899,906,842,62 bytes (2 50 The stack of pages is now 52,000


bytes) miles high, or approximately one-
fourth the distance from the Earth to
the moon.
Exabyte EB 1,152,921,504,606,846,976 bytes The stack of pages is now 52 million
(260 bytes) miles high, or just about twice the
distance between the Earth and
Venus.
Zettabyte ZB 1,180,591,620,717,411,303,424 The stack of pages is now 52 billion
bytes (270 bytes) miles high, some 20 times the
distance between the Earth and
Pluto.

22
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)
• A is encoded as 01000001 (66th character)
• 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 23
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 0000 010001
100110 0000 010010
100010 0000 010011

100100 stands for LOAD


100110 stands for MULTIPLY
100010 stands for STORE

Lecture 1: Introduction 24
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 25
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 26
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 Incremental modification of C


programming
Java Support Web programming Originally named “Oak”

Lecture 1: Introduction 27
Popularity of
Programming Languages
• C/C++ and Java are
among the most
popular programming
languages.

28
High-Level Language Program

Lecture 1: Introduction 29
Flow of Information During Program
Execution

Lecture 1: Introduction 30

You might also like