Professional Documents
Culture Documents
Computer Programming I
Hamid Harroud
School of Science and Engineering,
Al Akhawayn University in Ifrane
h.harroud@aui.ma
Spring 2015
Lecture 1
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?
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.
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.
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
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
Lecture 1: Introduction 26
High-Level Languages
Language Applications Areas Origin of Name
FORTRAN Scientific programming Formula Translation
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