Download presentation
Presentation is loading. Please wait.
Published byPierce Oliver Modified over 9 years ago
1
28-February-2007CMP 131 Introduction to Computers and Programming1 CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lecture 2
2
28-February-2007CMP 131 Introduction to Computers and Programming2 Outline of Topics Review briefly last class More details about hardware Software/Hardware interface –Data and program representation –Machine arithmetic
3
28-February-2007CMP 131 Introduction to Computers and Programming3 Last Class Course Description Logistics Assessments (Grading) Homework –First assignment will come out Monday
4
28-February-2007CMP 131 Introduction to Computers and Programming4 Last Class (2) Computers: What’s in them? –Hardware –Software Hardware devices Computers through time Hardware trends Hardware/software trends
5
28-February-2007CMP 131 Introduction to Computers and Programming5 Why Take This Course? Be more familiar with PCs Have a basic understanding of programming and the programming process Develop critical thinking & problem solving capabilities Learn other programming languages faster & easier
6
28-February-2007CMP 131 Introduction to Computers and Programming6 Why Pascal? One of the first structured programming languages It influenced the design of its successors –Modula 2, Oberon (by N.Wirth) –Modula2+, Modula3 (DEC, Olivetti) –Java –Not C or C++
7
28-February-2007CMP 131 Introduction to Computers and Programming7 Today’s Lecture Review of computers and hardware –Some more information More about software Programming languages –Low and high-level languages –Viewing programming through different languages Introduction to the Pascal IDE environment
8
28-February-2007CMP 131 Introduction to Computers and Programming8 Computer Systems Computers –Devices for performing computations at high speeds with great accuracy –A machine that can be programmed to manipulate symbols. Can perform complex & repetitive procedures quickly, precisely and reliably. Can quickly store and retrieve large amounts of data. Program –A set of instructions for a computer to follow, written in specific programming language
9
28-February-2007CMP 131 Introduction to Computers and Programming9 Computer Systems Hardware (HW) –Actual physical machines (equipment) that make up the computer Software (SW) –A collection of programs used by a computer –A set of instructions provided by the programmer that the computer follows. –Program instructions have to be stored in main memory before they can be executed.
10
28-February-2007CMP 131 Introduction to Computers and Programming10 Computer Systems Computer Categories: –Microcomputers (Personal computers / PCs) Used by a single person –Workstations: Largest microcomputers –Minicomputers: Can be used by many people simultaneously by using several terminals connected to the same CPU –Main frame computers: Faster & larger than minicomputers –Super computers: Most powerful mainframe computers Of which category is you computer at home??
11
28-February-2007CMP 131 Introduction to Computers and Programming11 Hardware (HW): Organization Computer HW usually consists of: –CPU –Main memory (RAM & ROM) –I/O Devices –Secondary Memory CPU & main memory are the heart of the computer Usually the CPU, main memory and secondary memory are housed in a single cabinet CPU Main Memory I/O Devices Secondary Memory
12
28-February-2007CMP 131 Introduction to Computers and Programming12 Hardware (HW): Central Processing Unit (CPU) Executes programs Performs calculations –Arithmetic Add, subtract, divide, multiply, … etc. –Logical Compare, test for true/false Controls & coordinates the other parts of the computer.
13
28-February-2007CMP 131 Introduction to Computers and Programming13 Hardware (HW): Memory Main (Primary) Memory: –Ordered sequence and specific number of memory locations (Bytes, words) that have unique addresses indicating their relative positions –Fast, expensive, short term memory –Holds intermediate results and serves as “scratch paper” –Needed to carry out program instructions –Types: RAM: Random Access Memory (vs. Sequential Access Memory) Volatile (i.e. contents disappear when the computer is switched off) Writable (except where forbidden by the software) ROM: Read Only Memory Non-volatile Also usually random access
14
28-February-2007CMP 131 Introduction to Computers and Programming14 Hardware (HW): Memory Secondary (auxiliary) memory –Used for keeping a permanent records of information –Holds programs and data between jobs –Keeps data or program files for later use –Slower, cheaper, long-term memory –Common forms Diskettes, magnetic tapes, hard disk, CD-ROM’s, DVD –Some types are removable
15
28-February-2007CMP 131 Introduction to Computers and Programming15 Hardware (HW) I/O (Input/Output) devices –Allow the user to communicate with the computer. –A single computer could be connected to more than one input or output device. –Examples: Input: Keyboard, mouse, scanner, voice Output: Screen, printer, voice
16
28-February-2007CMP 131 Introduction to Computers and Programming16 Hardware/Software Architectures Mainframe Era –1940’s-70’s: mainframe computer, minicomputers –Environments: Batch environments, batch processing –Files are basis for I/O: fixed formats, minimal device I/O –Error recovery –Lack of timing constraints Interactive environments –Terminal and file I/O: –Interactive error handling –Faster performance
17
28-February-2007CMP 131 Introduction to Computers and Programming17 Personal Computers Era –1978: the Apple II ran BASIC Educational use –1981: IBM released the first PC –1984: Macintosh –Window environments: OO models are ideal (Smalltalk) Must interact with many I/O devices (file I/O is less important) –Embedded systems Error handling Real-time response Distributed systems with concurrently running tasks
18
28-February-2007CMP 131 Introduction to Computers and Programming18 Networking Era: –LANs (Local Area Networks): client-server model Airline reservations, banking –Internet 70’s: ARPANET: telnet, FTP, SMTP protocols late 80’s: HTML and HTTP added –Issues and Effects: Static web pages with URLs for access URL = Uniform Resource Locator Dynamic web pages for e-commerce (Perl, JAVA, etc.) Security Performance (multiple clients) –Offloading work to client
19
28-February-2007CMP 131 Introduction to Computers and Programming19 Hardware/Software Concepts Computers manipulate instructions and data –Represented in similar ways –Used in different ways –Representation is binary (digital hardware is binary) Numbers vs. symbols –Computers represent everything as numbers –But numbers can represent symbols –Can perform “symbolic” computation Beginning of Artificial Intelligence
20
28-February-2007CMP 131 Introduction to Computers and Programming20 HW/SW Concepts: Data What is it? Numbers, characters, images, or other method of recording Can be assessed by a human or (especially) input into a computer, stored and processed there, or transmitted on some digital channel. Nearly always represent data in binary. Has no meaning on its own. When interpreted by data processing system it takes on meaning and becomes information. Storage –Setting of individual bits to specific values, destroying its previous contents Retrieval –Copying the contents of a particular memory cell to another storage area. –Original data remains unchanged
21
28-February-2007CMP 131 Introduction to Computers and Programming21 HW/SW Concepts: Representation Digit / Bit –Smallest unit of information/storage, sufficient to hold one bit –Can take one of two values (true/false, 1/0, or yes/no) –Corresponds to an input/output being on or off Byte –Smallest addressable unit of storage –Usually 8 bits –Typically holds one character –Can represent 256 different values
22
28-February-2007CMP 131 Introduction to Computers and Programming22 HW/SW Concepts: Representation Word –Fundamental unit of storage in a computer –Word size is one of its chief distinguishing characteristics of a computer –Typical size in modern computers: 32 bits (4 bytes) or 64 bits (8 bytes) –An instruction is usually one or more words long –A word can be used to hold a whole number of characters
23
28-February-2007CMP 131 Introduction to Computers and Programming23 Decimal Number System A base 10 system Each digit position can hold 10 values (0-9) Ex. 1234 = 4*1 + 3 * 10 + 2*100 + 1*1000 = 4*10 0 + 3 * 10 1 + 2*10 2 + 1*10 3
24
28-February-2007CMP 131 Introduction to Computers and Programming24 Binary Number System A base 2 system Each digit position can hold 2 values (0-1) Ex. 1011 Decimal conversion –Equals: 1*2 0 + 1*2 1 + 0*2 2 + 1*2 3 –Equals: 1 + 2 + 0 + 8 = 11 Maximum number of values in 4 bits: 16 –0 to 15 Maximum number of values in 8 bits: 256 –0 to 255 [or -128 to 127] –This is how much you can store in a byte
25
28-February-2007CMP 131 Introduction to Computers and Programming25 Binary Numbers 00000 00011 00102 00113 01004 01015 01106 01117 10008 10019 101010 101111 110012 110113 111014 111115
26
28-February-2007CMP 131 Introduction to Computers and Programming26 Binary Addition 1010 + 0101 = --------- 1111 1010 + 0011 = --------- 1101 1010 + 0111 = --------- 0001 10 + 5 = ------ 15 10 + 3 = ------ 13 10 + 7 = ------ 17 => 1 OVERFLOW!!!
27
28-February-2007CMP 131 Introduction to Computers and Programming27 Other Number Systems Hexadecimal: base 16 –Each digit can hold 16 values (0-9,A-F) –Ex: A02F –Decimal conversion? –Note: 1 hex digit = 4 binary digits Octal: base 8 –Each digit can hold 8 values (0 to 7) –Ex: 127 –Decimal conversion?
28
28-February-2007CMP 131 Introduction to Computers and Programming28 Logical Operations AND: –1 AND 1 = 1 –Everything else = 0 OR –0 AND 0 = 0 –Everything else = 1 XOR (Exclusive OR) –0 AND 1 = 1 –0 AND 0 = 0, 1 AND 1 = 0
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.