Download Lecture 1 - Salim Arfaoui

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Abstraction (computer science) wikipedia , lookup

Supercomputer wikipedia , lookup

Computer cluster wikipedia , lookup

Supercomputer architecture wikipedia , lookup

Parallel computing wikipedia , lookup

Transcript
Introduction to Computers and Computing
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Chapter Topics
–
–
–
–
–
Computer Systems: Hardware and Software
Programming Languages
The Complete Programming Process
Bits and Bytes
Object-Oriented Programming
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
• Computer hardware components are the
physical pieces of the computer.
• The major hardware components of a computer:
–
–
–
–
The central processing unit (CPU)
Main memory
Secondary storage devices
Input and Output devices
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
Central Processing Unit
CPU
Instruction (input)
Arithmetic
Logic
Unit
Control
Unit
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Result (output)
Computer Systems: Hardware
Central Processing Unit
– The CPU performs the fetch, decode, execute cycle
in order to process program information.
The CPU’s control unit fetches, from main memory,
the next instruction in the sequence of program instructions.
Fetch
Execute
The instruction is encoded in the form of a number.
The control unit decodes the instruction and
generates an electronic signal.
Decode
The signal is routed to the appropriate component
of the computer (such as the ALU, a disk drive, or
some other device). The signal causes the
component to perform an operation.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
Main Memory
• known as random-access memory (RAM)
• RAM contains:
– currently running programs
– data used by those programs
• RAM is volatile, which means that when the computer
is turned off, the contents of RAM are erased.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
Main Memory
• RAM is divided into units called bytes.
• A byte consists of eight bits. Each bit holds a binary
value 0 or 1.
• Each byte in memory is assigned a unique number
known as an address.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
Main Memory
Main memory can be visualized as a column or row of cells.
0x000
0x001 1 0 1 0 1 0 1 0
0x002
0x003
0x004
0x005
0x006
0x007
A section of memory is called a byte.
A byte is made up of 8 bits.
A section of two or four bytes is
often called a word.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Binary (base-2) vs. Decimal (base-10)
• Base-2 to Base-10 conversion
– 11102 = 1×23 + 1×22 + 1×21 + 0×20 = 1410
• Base-10 to Base-2 conversion
Base-2 table
210 29 28 27 26 25 24 23 22 21
1024 512 256 128 64 32 16 8 4 2
e.g. given a decimal number 156
1024 512 256 128 64 32 16 8 4 2
1 0 0 1 1 1 0
15610 = 100111002
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
20
1
1
0
Computer Systems: Hardware
Secondary Storage Devices
• Secondary storage devices are capable of
storing information for longer periods of time
(non-volatile).
• Common Secondary Storage devices:
• Hard drive
• CD ROM
• Floppy drive
• DVD drive
• CD RW drive
• Compact Flash card
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
Input Devices
• Input is any data the computer collects from the
outside world.
• That data comes from devices known as input devices.
• Common input devices:
– Keyboard
– Mouse
– Scanner
– Digital camera
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Hardware
Output Devices
• Output is any data the computer sends to the outside
world.
• That data is displayed on devices known as output devices.
• Common output devices:
– Monitors
– Printers
• Some devices such as disk drives perform input and output
and are called I/O devices.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Software
• Software refers to the programs that run on a
computer.
• There are two classifications of software:
– Operating Systems
– Application Software
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Software
Operating Systems
• An operating system (OS) has two functions:
– Control/Manage the system resources
• CPU scheduling
• Memory allocation
– Provide the user with a means of interaction with
the computer
• Operating systems can be either single tasking or
multi-tasking.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Software
Operating Systems
• A single tasking operating system is capable of
running only one program at a time.
– DOS
• A multitasking operating system is capable of running
multiple programs at once.
– Windows
– Unix
– Mac OS X
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Software
Operating Systems
• Operating systems can also be categorized as
single user or multi-user.
– A single user operating system allows only one user
to operate the computer at a time.
– Multi-user systems allow several users to run
programs and operate the computer at once.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Software
Single User Systems
Examples:
•DOS
•Windows
•95/98/ME
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Software
Multi-User Systems
Examples:
•Unix, Linux
•BSD
•Modern Windows Versions
•NT/2000/XP/Vista/7/8
•OS/X
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computer Systems: Software
Application Software
• Application software provides a more specialized type
of environment for the user to work in.
• Common application software:
–
–
–
–
–
Spreadsheets
Word processors
Accounting software
Tax software
Games
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Programming Languages
• A programming language is a special language used to
write computer programs.
• A program is a set of instructions with rigorous syntax
a computer follows in order to perform a task.
• An algorithm is a set of well defined steps to complete
a task.
– English-like pseudo code
– For example, to compute gross pay
• Get payroll data
• Calculate gross pay
• Display gross pay
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Programming Languages: 1GL
• A computer needs the algorithm to be written in machine
language (also called first generation programming language).
– Machine language is written using binary numbers.
• Each CPU has its own machine language.
– Motorola 68000 series processors
– Intel x86 series processors
– ARM processors, etc.
• Example of a machine language instruction:
1011010000000101
• Machine code is tedious and unfriendly to human.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Programming Languages: 2GL
• Programmers developed assembly language (also called
second generation programming language or low level
language).
• Example:
MOV id3, R2
MUL #60.0, R2
MOV id2, R1
ADD R2, R1
MOV R1, id1
• Assembler made things easier but was also processor
dependent.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Programming Languages: 3GL
• High level programming languages followed
that were not processor dependent.
• Some common programming languages:
Java
C
Visual Basic
BASIC
C++
Python
COBOL
C#
Ruby
Pascal
PHP
JavaScript
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Programming Languages
• 4GL and 5GL
– Closer to natural languages
– The language environment provides visual
programming tools that allow non-programmers to
create software applications
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Programming Languages
Common Language Elements
• There are some concepts that are common to all
programming languages.
• Common concepts:
– Keywords
– Operators
– Punctuation
– Programmer-defined identifiers
– Strict syntactic rules
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.