CPS120: Introduction to Computer Science Compiling Your First Program.
CPS120: Introduction to Computer Science
description
Transcript of CPS120: Introduction to Computer Science
CPS120: Introduction to Computer Science
Introduction to Computers
Introduction to Computers
Objectives – Understand the history of computers – Understand the components that make up a
desktop PC – Understand the basics of computer architecture – Understand the role of an operating system– Understand the role of assemblers, interpreters,
& compilers
5
A mental model that removes complex details
This is a key concept.
Abstraction
Representing Data
Data can be numeric, alphabetic, or alphanumeric
Computer only uses “on” & “off” within its circuits
Representing Data: Bits
Computer only uses “on” & “off” within its circuits
Binary number system – “On”, 1, high state of electricity – “Off”, 0, low state of electricity – Bits (0’s and 1’s)
Representing Data: Bytes
Byte = 8 bits (23) 256 possible combinations of 8 bits Decimal system is cumbersome & awkward
for pc’s – Can convert from decimal to binary & vice
versa • ASCII (American standard code for information
interchange)
128 characters in the 7-bit set
3
Hardware: The physical elements of a computing system (printer, circuit boards, wires, keyboard…)
Software: The programs that provide the instructions for a computer to execute
Computing Systems
4
Communication
Application
Operating System
Programming
Hardware
Data
Layers of a Computing System
Early History of Computers
Abacus Pascal’s gear-driven counting machine (mid
17th Century)– His father was a tax collector
Babbage designed a programmable computer (1834)
Joseph Jacquard designed a loom that used the the punched card to store instructions (late 18th Century)
7
Ada Augusta, Countess of LovelaceFirst Programmer, the loop (mid 19th Century)
Alan Turing (1936)Turing Machine, Artificial Intelligence Testing
Harvard Mark I, ENIAC, UNIVAC IEarly computers launch new era in mathematics, physics, engineering and economics
Early History of Computing
"Modern" Developments Hollerith built machine for US census bureau
& founded IBM (late 19th Century) 1946, ENIAC used vacuum tubes (Univ of
Penn) - very hot, needed AC, military paid for this research
Transistors used in 1950’s, didn’t burn out like vacuum tubes
Integrated circuits (chips) used in 1960’s Microprocessor used in 1970’s Supercomputers, mainframes, minicomputers,
workstations, desktop computers
8
Vacuum TubesLarge, not very reliable, generated a lot of heat
Magnetic Drum Memory device that rotated under a read/write head
Card Readers Magnetic Tape DrivesDevelopment of these sequential auxiliary storage devices
First Generation Hardware (1951-1959)
9
TransistorReplaced vacuum tube, fast, small, durable, cheap
Magnetic CoresReplaced magnetic drums, information available instantly
Magnetic DisksReplaced magnetic tape, data can be accessed directly
Second Generation Hardware (1959-1965)
10
Integrated CircuitsReplaced circuit boards, smaller, cheaper, faster, more reliable.
TransistorsNow used for memory construction
Terminal An input/output device with a keyboard and screen
Third Generation Hardware (1965-1971)
11
Large-scale IntegrationGreat advances in chip technology
PCs, the Commercial Market, WorkstationsPersonal Computers were developed as new companies like Apple and Atari came into being. Workstations emerged.
Fourth Generation Hardware (1971-?)
12
•Parallel Computing•Computers rely on interconnected central processing units that increase processing speed.
•Networking•With the Ethernet small computers could be connected and share resources. A file server connected PCs in the late 1980s.
•ARPANET and LANs Internet•A network of interconnected networks
Parallel Computing and Networking
13
Machine LanguageComputer programs were written in binary (1s and 0s)
Assembly Languages and translatorsPrograms were written in artificial programming languages and were then translated into machine language
Programmer ChangesProgrammers divide into application programmers and systems programmers
First Generation Software (1951-1959)
Representing Instructions:
Low Level Languages– Each computer uses its own machine
language – Assembly is a low-level language close to
machine language • Assembly languages are different on each
computer
• An assembler converts a program into machine language
Machine Languages
different for each computer processor
0100
001101 100000 001101 110001
00101 10001 10000
01110
111001
. . .
Assembly Languages different for each computer processor
main proc paymov ax, dsegmov ax, 0b00hadd ax, dxmov a1, b1mul b1, axmov b1, 04h
14
High Level LanguagesUse English-like statements and made programming easier: Fortran, COBOL, Lisp (artifical intelligence).
High-LevelLanguages
Assembly LanguageMachine
Language
Second Generation Software (1959-1965)
16
Application Package
Systems Software
High-Level Languages
Assembly Language
Machine Language
Third Generation Software (1965-1971)
15
Third Generation Software (1965-1971) Systems Software
– utility programs, – language translators, – and the operating system, which decides which
programs – to run and when.
Separation between Users and Hardware Computer programmers now created programs to
be used by people who did not know how to program
17
Structured ProgrammingBASIC refined, Pascal, C, C++
New Application Software for UsersSpreadsheets, word processors, database management systems
Fourth Generation Software (1971-1989)
18
MicrosoftThe Windows operating system, and other Microsoft application programs dominate the market
Object-Oriented DesignBased on a hierarchy of data objects (i.e. Java)
World Wide WebAllows easy global communication through the Internet
New UsersToday’s user needs no computer knowledge
Fifth Generation Software (1990- present)
20
Programmer / User
Applications Programmer(uses tools)
User with No Computer Background
Systems Programmer(builds tools)
Domain-Specific Programs
Computing as a Tool
21
Computing as a Discipline
Four Necessary Skills1. Algorithmic Thinking
2. Representation
3. Programming
4. Design
System Components
Hardware – I/O devices (input/output)
• keyboard, mouse, monitor, etc.
– CPU– Primary Storage– Secondary Storage
Software
Computer Architecture
Microprocessor (examples Pentium, Pentium II, PowerPC, etc.) – includes Bus Interface Unit, Arithmetic & Logic Unit
(ALU), Control Unit, registers – motherboard is simply the main circuit board that
contains most of these parts – the CPU (central processing unit) is considered to be
most of these parts taken as a whole Bus
– connects the microprocessor to the RAM & ROM – addresses for data and instructions are important
Storage Devices Primary storage
– RAM (Random Access Memory, or just “memory” for short)
• active data that is being stored, lost if power is cut off so save often
– ROM (Read-Only Memory) • commands that are permanently stored on chips • PC’s use BIOS, Macs use the Toolbox
Secondary storage – Hard disk, floppy disks – Slower method of storage & retrieval but “safer”
Software: Systems Software
Operating systems– Controls the hardware components (disks,
CPU, printers, etc.) – Windows XP, Windows NT/2000, Windows 9-
X, MS-DOS, OS/2, MacOS, Unix, Linux, BeOS
Software: Application Software
Office products– Word processors– Spread sheets– Presentation software– Email
Business applications– General ledger– Financials
• Accounts payable• Accounts receivable
– HRMS– Fixed assets/inventory
Programming Software
Text Editor– Used by the programmer while coding the
program in a programming language• Like a word processor - creates a text file containing
the program's instructions or "source code" – Examples are “nled” and “vi” editors in Unix systems
– Other editors are NotePad and WordPad which are text-based
Programming Software
Interpreters – Translates source code into machine code line by line
Compiler – Translates source code into an object file, than uses
linker to create an executable file • A source module (source code) becomes an "object" module
(compiled module)
• Then it is linked with system modules to become a "load" module (linked module)
It is usually more efficient to use a compiler