Download presentation

Presentation is loading. Please wait.

Published byElizabeth Pendell Modified over 2 years ago

1
CSE 1301 Lecture 1 Introduction Figures from Lewis, C# Software Solutions, Addison Wesley Richard Gesick

2
CSE 1301 1A-2/54 Agenda Hardware and Software Analog & Digital Binary and Data Representations Introduction to Computer Architecture

3
CSE 1301 1A-3/54 Computer Processing Hardware –The stuff you can touch Software –Programs and data

4
CSE 1301 1A-4/54

5
CSE 1301 1A-5/54 Modern Computer

6
CSE 1301 1A-6/54 Hardware and Software Hardware –the physical, tangible parts of a computer –keyboard, monitor, disks, wires, chips, etc. Software –programs and data –a program is a series of instructions A computer requires both hardware and software Each is essentially useless without the other

7
CSE 1301 1A-7/54 Basic Computer Concepts Hardware –Central Processing Unit –Memory and Storage Devices Operating Systems Application Software Computer Networks and the Internet

8
CSE 1301 1A-8/54 Hardware A typical computer consists of: –CPU: executes the instructions of the program –Hard disk: stores instructions and data so program can be loaded into memory and executed –Memory unit: stores the program instructions and data while executing –Keyboard and mouse: used for data input –Monitor: used to display output from a program –Other accessories / peripherals

9
CSE 1301 1A-9/54

10
CSE 1301 1A-10/54 CPU and Main Memory Central Processing Unit Main Memory Chip that executes program commands Intel Pentium 4 Sun ultraSPARC III Primary storage area for programs and data that are in active use Synonymous with RAM

11
CSE 1301 1A-11/54 Secondary Memory Devices Central Processing Unit Main Memory Floppy Disk Hard Disk Secondary memory devices provide long-term storage Information is moved between main memory and secondary memory as needed Hard disks Floppy disks ZIP disks Writable CDs Writable DVDs Tapes

12
CSE 1301 1A-12/54 Input / Output Devices Central Processing Unit Main Memory Floppy Disk Hard Disk Monitor Keyboard I/O devices facilitate user interaction Monitor screen Keyboard Mouse Joystick Bar code scanner Touch screen

13
CSE 1301 1A-13/54 The Central Processing Unit A CPU is on a chip called a microprocessor It continuously follows the fetch-decode- execute cycle: fetch Retrieve an instruction from main memory decode Determine what the instruction is execute Carry out the instruction

14
CSE 1301 1A-14/54 The Central Processing Unit The CPU contains: Arithmetic / Logic Unit Registers Control Unit Small storage areas Performs calculations and makes decisions Coordinates processing steps

15
CSE 1301 1A-15/54 Central Processing Unit (CPU) Arithmetic Logic Unit: performs integer arithmetic and logical operations Floating-point Unit: performs floating-point operations Hardware registers: store data and memory addresses Instruction pointer: keeps track of current instruction to execute Examples: Intel Pentium 4, Sun Microsystems SPARC, IBM PowerPC

16
CSE 1301 1A-16/54 Processor Instruction Set Move data from one location to another Perform a calculation Change the sequence of instructions to execute (the flow of control)

17
CSE 1301 1A-17/54 CPU Speed Rated in MHz or GHz In one clock cycle, a CPU –fetches an instruction from memory, –decodes the instruction, or –executes the instruction Pipelining allows overlap of operations to improve performance 2-Ghz CPU can execute 2 billion instructions per second

18
CSE 1301 1A-18/54 Memory or Storage Devices Memory consists of cells that hold one bit. A bit's value can be 0 or 1 A byte is 8 binary digits (bits)

19
CSE 1301 1A-19/54 From Dell:

20
CSE 1301 1A-20/54 Memory has width (word size) Memory has capacity

21
CSE 1301 1A-21/54 Memory Main memory is volatile - stored information is lost if the electric power is removed Secondary memory devices are nonvolatile Main memory and disks are direct access devices - information can be reached directly The terms direct access and random access often are used interchangeably A magnetic tape is a sequential access device since its data is arranged in a linear order - you must get by the intervening data in order to access other information

22
CSE 1301 1A-22/54 Software Categories Operating System –Resource manager/coordinator Shell –Interface between the OS and the user and applications Applications –What the user sees

23
CSE 1301 1A-23/54

24
CSE 1301 1A-24/54 Operating System Software boots when computer is turned on and runs continuously Controls the peripheral devices (disks, keyboard, mouse, etc.) Supports multitasking (multiple programs executing simultaneously) Allocates memory to each program Prevents one program from damaging another program Example: Microsoft Windows, Linux

25
CSE 1301 1A-25/54 Application Software Written to perform specific tasks Runs "on top of" operating system Examples: word processor, spreadsheet, database management system, games, Internet browser, etc.

26
Client/Server What is the OS here? What is the application? Where does data live? How to we coordinate the application among many users? 1-26

27
What is better? 1-27

28
CSE 1301 1A-28/54 Analog information is continuous Digital information is discrete

29
CSE 1301 1A-29/54 Sampling induces losses Humans can hear 20Hz-20kHz 44.1 kHz typical sample rate (CD) Sample rate >= double frequency - Nyquist (1924)

30
CSE 1301 1A-30/54

31
CSE 1301 1A-31/54 Why do we care? Computers are dumb Theyre just dumb at a really fast rate –2.8gHz computer can perform 2.8 billion operations per second Computers only see in binary (0/1) Anything we see as meaningful is strings of 0s and 1s

32
CSE 1301 1A-32/54 Digital Information Computers store all information digitally: –numbers –text –graphics and images –video –audio –program instructions In some way, all information is digitized - broken down into pieces and represented as numbers

33
CSE 1301 1A-33/54 Representing Text Digitally For example, every character is stored as a number, including spaces, digits, and punctuation Corresponding upper and lower case letters are separate characters H i, H e a t h e r. 72 105 44 32 72 101 97 116 104 101 114 46

34
CSE 1301 1A-34/54 Binary Numbers Once information is digitized, it is represented and stored in memory using the binary number system A single binary digit (0 or 1) is called a bit Devices that store and move information are cheaper and more reliable if they have to represent only two states A single bit can represent two possible states, like a light bulb that is either on (1) or off (0) Permutations of bits are used to store values

35
CSE 1301 1A-35/54 Data Representation Binary Numbers –Expressed in base 2 system (two values are 0 and 1) Hexadecimal Numbers –Base-16 system used as shorthand for binary numbers Representing Characters with the Character Set

36
CSE 1301 1A-36/54 Converting & Bases Binary Oct Dec Hex

37
CSE 1301 1A-37/54 Binary Equivalents of Decimal Numbers Decimal Binary Equivalent 0 0000 10001 20010 30011 40100 50101 60110 70111 81000

38
CSE 1301 1A-38/54 Powers of 2 DecimalDecimal 2 0 1 2 8 256 2 1 2 2 9 512 2 2 4 2 10 1024 2 3 8 2 11 2048 2 4 16 2 12 4096 2 5 32 2 13 8192 2 6 64 2 14 16384 2 7 128 2 15 32768 Notice with each additional bit, it doubles the possible number of values.

39
CSE 1301 1A-39/54

40
CSE 1301 1A-40/54 Decimal (base 10) numbers A decimal number can be represented as the sum of powers of 10 (the base) with coefficients in the base 10 alphabet (0 - 9) For example: 2485 = 2000 + 400 + 80 + 5 2485 = 2 * 1000 + 4 * 100 + 8 * 10 + 5 * 1 2485 = 2 * 10 3 + 4 * 10 2 + 8 * 10 1 + 5 * 10 0

41
CSE 1301 1A-41/54 Converting from Binary to Decimal 101101 = ?

42
CSE 1301 1A-42/54 Converting From Decimal to Binary Just as a decimal number can be represented as a sum of powers of 10 (the base) with coefficients in the base 10 alphabet (0 to 9), A decimal number also can be represented as the sum of powers of 2 (the base of the binary system) with coefficients in the base 2 alphabet (0 and 1) So we need an algorithm to do that

43
CSE 1301 1A-43/54 1.Find the largest power of 2 that is smaller than or equal to the decimal number 2.Subtract that number from the decimal number 3.Insert 1 in binary number for position equivalent to that power of 2 4.Repeat 1 - 3, until you reach 0 Converting From Decimal to Binary

44
CSE 1301 1A-44/54 Example: convert 359 to binary 1.Largest power of 2 that is smaller than 359 is 256 (2 8 ) 2.359 - 256 = 103 so 359 = 2 8* 1 + 103 3.Largest power of 2 that is smaller than 103 is 64 (2 6 ) 4.103 - 64 = 39 so 359 = 2 8* 1 + 2 6* 1 + 39 (continued on next slide)

45
CSE 1301 1A-45/54 Example: convert 359 to binary 5.Largest power of 2 that is smaller than 39 is 32 (2 5 ) 6.39 - 32 = 7 so 359 = 2 8* 1 + 2 6* 1 + 2 5* 1 + 7 7.Largest power of 2 that is smaller than 7 is 4 (2 2 ) 8.7 - 4 = 3 so 359 = 2 8* 1 + 2 6* 1 + 2 5* 1 + 2 2* 1 + 3 (continued on next slide)

46
CSE 1301 1A-46/54 Example: convert 359 to binary 9.Largest power of 2 that is smaller than 3 is 2 (2 1 ) 10.3 - 2 = 1 so 359 = 2 8* 1 + 2 6* 1 + 2 5* 1 + 2 2* 1 + 2 1* 1 + 1 11.Largest power of 2 that is smaller than or equal to 1 is 1 (2 0 ) 12.1 - 1 = 0, so we are finished

47
CSE 1301 1A-47/54 Our results Finally, insert missing powers of 2 with coefficient 0. Thus, 359 = 2 8* 1 + 2 7* 0 + 2 6* 1 + 2 5* 1 + 2 4* 0 + 2 3* 0 + 2 2* 1 + 2 1 *1 + 2 0 *1 Removing powers of 2, we get: 1 0 1 1 0 0 1 1 1 Or 1 0110 0111

48
CSE 1301 1A-48/54 Hexadecimal Numbers Base-16 number system Uses digits 0 - 9 and letters A - F One hexadecimal digit can express values from 0 to 15 –For example: C represents 12 Thus, one hexadecimal digit can represent 4 bits

49
CSE 1301 1A-49/54 Hexadecimal - Binary Equivalents Hex Binary 0 0000 8 1000 1 0001 9 1001 2 0010 A 1010 3 0011 B 1011 4 0100 C 1100 5 0101 D 1101 6 0110 E 1110 7 0111 F 1111

50
CSE 1301 1A-50/54 Examples Binary number: 0001 1010 1111 1001 Hex equivalent: 1 A F 9 Binary number: 1011 0011 1011 1110 Hex equivalent: B 3 B E

51
CSE 1301 1A-51/54 Practice with Number Systems 100 2 = ? 16 3716 16 = ? 2 110100111 2 = ? 10 3A1B 16 = ? 2

52
CSE 1301 1A-52/54 Practice with Number Systems 100 2 = 4 16 3716 16 = 0011 0111 0001 1100 2 110100111 2 = 423 10 3A1B 16 = 0011 1010 0001 1011 2

53
CSE 1301 1A-53/54 The Unicode Character Set Each character stored as 16-bits Maximum number of characters that can be represented: 65,536 (2 16 ) (w_char ) ASCII character set (used by many programming languages) stores each character as 7 bits (maximum number of characters is 128). For compatibility, first 128 characters of Unicode set represent the ASCII characters

54
CSE 1301 1A-54/54 ASCII American Standard Code for Information Interchange Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex ------------------------------------------------------------------------------------- (nul) 0 0000 0x00 | (sp) 32 0040 0x20 | @ 64 0100 0x40 | ` 96 0140 0x60 (soh) 1 0001 0x01 | ! 33 0041 0x21 | A 65 0101 0x41 | a 97 0141 0x61 (stx) 2 0002 0x02 | " 34 0042 0x22 | B 66 0102 0x42 | b 98 0142 0x62 (etx) 3 0003 0x03 | # 35 0043 0x23 | C 67 0103 0x43 | c 99 0143 0x63 (eot) 4 0004 0x04 | $ 36 0044 0x24 | D 68 0104 0x44 | d 100 0144 0x64 (enq) 5 0005 0x05 | % 37 0045 0x25 | E 69 0105 0x45 | e 101 0145 0x65 (ack) 6 0006 0x06 | & 38 0046 0x26 | F 70 0106 0x46 | f 102 0146 0x66 (bel) 7 0007 0x07 | ' 39 0047 0x27 | G 71 0107 0x47 | g 103 0147 0x67 (bs) 8 0010 0x08 | ( 40 0050 0x28 | H 72 0110 0x48 | h 104 0150 0x68 (ht) 9 0011 0x09 | ) 41 0051 0x29 | I 73 0111 0x49 | i 105 0151 0x69 (nl) 10 0012 0x0a | * 42 0052 0x2a | J 74 0112 0x4a | j 106 0152 0x6a (vt) 11 0013 0x0b | + 43 0053 0x2b | K 75 0113 0x4b | k 107 0153 0x6b (np) 12 0014 0x0c |, 44 0054 0x2c | L 76 0114 0x4c | l 108 0154 0x6c (cr) 13 0015 0x0d | - 45 0055 0x2d | M 77 0115 0x4d | m 109 0155 0x6d (so) 14 0016 0x0e |. 46 0056 0x2e | N 78 0116 0x4e | n 110 0156 0x6e (si) 15 0017 0x0f | / 47 0057 0x2f | O 79 0117 0x4f | o 111 0157 0x6f (dle) 16 0020 0x10 | 0 48 0060 0x30 | P 80 0120 0x50 | p 112 0160 0x70 (dc1) 17 0021 0x11 | 1 49 0061 0x31 | Q 81 0121 0x51 | q 113 0161 0x71 (dc2) 18 0022 0x12 | 2 50 0062 0x32 | R 82 0122 0x52 | r 114 0162 0x72 (dc3) 19 0023 0x13 | 3 51 0063 0x33 | S 83 0123 0x53 | s 115 0163 0x73 (dc4) 20 0024 0x14 | 4 52 0064 0x34 | T 84 0124 0x54 | t 116 0164 0x74 (nak) 21 0025 0x15 | 5 53 0065 0x35 | U 85 0125 0x55 | u 117 0165 0x75 From: http://web.cs.mun.ca/~michael/c/ascii-table.html

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google