Lecture 1 - PowerPoint PPT Presentation

lecture 1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Lecture 1 PowerPoint Presentation
play fullscreen
1 / 52
Lecture 1
173 Views
Download Presentation
osman
Download Presentation

Lecture 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Lecture 1 Introduction Richard Gesick Figures from Lewis, “C# Software Solutions”, Addison Wesley

  2. Agenda • Hardware and Software • Analog & Digital • Binary and Data Representations • Introduction to Computer Architecture

  3. Computer Processing • Hardware • The stuff you can touch • Software • Programs and data

  4. Modern Computer

  5. 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

  6. Basic Computer Concepts Hardware Central Processing Unit Memory and Storage Devices Operating Systems Application Software Computer Networks and the Internet

  7. 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

  8. CPU and Main Memory Main Memory Chip that executes program commands Intel Pentium 4 Sun ultraSPARC III Central Processing Unit Primary storage area for programs and data that are in active use Synonymous with RAM

  9. Secondary Memory Devices Hard Disk Main Memory Floppy Disk Information is moved between main memory and secondary memory as needed Secondary memory devices provide long-term storage Central Processing Unit Hard disks Floppy disks ZIP disks Writable CDs Writable DVDs Tapes

  10. Input / Output Devices Monitor Keyboard Hard Disk Main Memory Floppy Disk I/O devices facilitate user interaction Central Processing Unit Monitor screen Keyboard Mouse Joystick Bar code scanner Touch screen

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

  12. The Central Processing Unit The CPU contains: Performs calculations and makes decisions Arithmetic / Logic Unit Coordinates processing steps Control Unit Small storage areas Registers

  13. 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

  14. Processor Instruction Set Move data from one location to another Perform a calculation Change the sequence of instructions to execute (the flow of control)

  15. 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

  16. 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)

  17. From Dell:

  18. Memory has width (word size) Memory has capacity

  19. 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

  20. Software Categories • Operating System • Resource manager/coordinator • Shell • Interface between the OS and the user and applications • Applications • What the user sees

  21. 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

  22. Application Software Written to perform specific tasks Runs "on top of" operating system Examples: word processor, spreadsheet, database management system, games, Internet browser, etc.

  23. Client/Server • What is the OS here? • What is the application? • Where does data live? • How to we coordinate the application among many users?

  24. What is better?

  25. Analog information is continuous • Digital information is discrete

  26. Sampling induces losses • Humans can hear 20Hz-20kHz • 44.1 kHz typical sample rate (CD) • Sample rate >= double frequency - Nyquist (1924)

  27. Why do we care? • Computers are dumb • They’re 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

  28. 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

  29. 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 72 105 44 32 72 101 97 116 104 101 114 46 H i , H e a t h e r .

  30. 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

  31. 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

  32. Converting & Bases Binary Oct Dec Hex

  33. Binary Equivalents of Decimal Numbers DecimalBinary Equivalent 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 01118 1000

  34. Powers of 2 DecimalDecimal 20 1 28 256 21 2 29 512 22 4 210 1024 23 8 211 2048 24 16 212 4096 25 32 213 8192 26 64 214 16384 27 128 215 32768 Notice with each additional bit, it doubles the possible number of values.

  35. 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 * 103 + 4 * 102 + 8 * 101 + 5 * 100

  36. Converting from Binary to Decimal 101101 = ?

  37. 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

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

  39. Example: convert 359 to binary Largest power of 2 that is smaller than 359 is 256 (28) 359 - 256 = 103 so 359 = 28*1 + 103 Largest power of 2 that is smaller than 103 is 64 (26) 103 - 64 = 39 so 359 = 28*1 + 26*1 + 39 (continued on next slide)

  40. Example: convert 359 to binary Largest power of 2 that is smaller than 39 is 32 (25) 39 - 32 = 7 so 359 = 28*1 + 26*1 + 25*1 + 7 Largest power of 2 that is smaller than 7 is 4 (22) 7 - 4 = 3 so 359 = 28*1 + 26*1 + 25*1 + 22*1 + 3 (continued on next slide)

  41. Example: convert 359 to binary Largest power of 2 that is smaller than 3 is 2 (21) 3 - 2 = 1 so 359 = 28*1 + 26*1 + 25*1 + 22*1 + 21*1 + 1 Largest power of 2 that is smaller than or equal to 1 is 1 (20) 1 - 1 = 0, so we are finished

  42. Our results Finally, insert missing powers of 2 with coefficient 0. Thus, 359 = 28*1 + 27*0 + 26*1 + 25*1 + 24*0 + 23*0 + 22*1 + 21*1 + 20*1 Removing powers of 2, we get: 1 0 1 1 0 0 1 1 1 Or 1 0110 0111

  43. 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

  44. Hexadecimal - Binary Equivalents Hex Binary 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

  45. 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