Review: History of Computers CS100: Itroductio to Computer Sciece Maiframes Miicomputers Lecture 2: Data Storage -- Bits, their storage ad mai memory Persoal Computers & Workstatios Review: The Role of Algorithms How are data stored iside computers? Algorithm: Program: Programmig: 1.1 Bits ad Their Storage 1.2 Mai Memory Software: Hardware: Bits ad Bit Patters Bit: Biary Digit (0 or 1) Bit Patters (strigs of 0 ad 1s) are used to represet iformatio. Numbers Text characters Images Soud Ad others Bits ad Boolea Operatios Boolea Operatio: A operatio that maipulates oe or more true/false values Specific operatios AND OR XOR (exclusive or) NOT 1
Bits ad Boolea Operatios Boolea operatios AND Based o compoud statemet of the form P AND Q 1 AND 1 =1, 1 represets the value true, 0 represets false OR P OR Q, The output is true whe at lease oe of them is true XOR (exclusive or) The output is true whe its iputs are differet NOT: the output is the opposite of the iput Figure 1.1 The Boolea operatios AND, OR, ad XOR (exclusive or) Gates Gate: A device that computes a Boolea operatio implemeted as (small) electroic circuits iside today s computes Other techologies to implemet gates Gears, relays, optic devices. Provide the buildig blocks from which computers are costructed Figure 1.2 A pictorial represetatio of AND, OR, XOR, ad NOT gates as well as their iput ad output values Flip-flops Figure 1.3 A simple flip-flop circuit Flip-flop: A circuit built from gates that ca store oe bit. Has a iput lie which sets its stored value to 1 Has a iput lie which sets its stored value to 0 While both iput lies are 0, the most recetly stored value is preserved 2
Figure 1.4 Settig the output of a flip-flop to 1 Figure 1.4 Settig the output of a flip-flop to 1 (cotiued) Figure 1.4 Settig the output of a flip-flop to 1 (cotiued) Figure 1.5 Aother way of costructig a flip-flop What happes if 1 is placed o the lower iput? How does this flip-flop work? Flip-flops The flip-flop is oe meas of storig a bit withi a computer. Ca have the output value of either 1 or 0 Other circuit ca adjust the output value (write) Other circuit ca respod to the stored value (read) Flip-flops show how devices ca be costructed from gates. Exercise: What iput bit patters will cause the followig circuit to produce a output of 1? Iputs Output 3
Mai Memory Mai Memory Cells A collectio of itegrated circuits to store data (such as flip-flops) Needs to have electrical power i order to maitai its iformatio Computer ca maipulate oly data that i mai memory Copy programs ito mai memory from a storage device to execute Copy files ito mai memory to access The amout of mai memory is crucial How may programs ca be executed How much data ca be readily available to a program? Cell: A uit of mai memory (typically 8 bits which is oe byte) Most sigificat bit: the bit at the left (high-order) ed of the coceptual row of bits i a memory cell Least sigificat bit: the bit at the right (loworder) ed of the coceptual row of bits i a memory cell Figure 1.7 The orgaizatio of a byte-size memory cell Mai Memory Addresses Address: A ame that uiuely idetifies oe cell i the computer s mai memory The ames are actually umbers. These umbers are assiged cosecutively startig at zero. Numberig the cells i this maer associates a order with the memory cells. Figure 1.8 Memory cells arraged by address Measurig Memory Capacity Kilobyte: 2 10 bytes = 1024 bytes Example: 3 KB = 3 1024 bytes Sometimes kibi rather tha kilo Megabyte: 2 20 bytes = 1,048,576 bytes Example: 3 MB = 3 1,048,576 bytes Sometimes megi rather tha mega Gigabyte: 2 30 bytes = 1,073,741,824 bytes Example: 3 GB = 3 1,073,741,824 bytes Sometimes gigi rather tha giga 4
Questios: Questios: If the memory cell whose address is 5 cotais the value 8, what is the differece betwee writig the value 5 ito cell umber 6 ad movig the cotets of cell umber 5 ito cell umber 6? Suppose we wat to iterchage the values stored i memory cells 2 ad 3. Does the followig algorithm perform the task correctly? Step1: Move the cotets of cell umber 2 to cell umber 3. Step 2: Move the cotets of cell umber 3 to cell umber 2. Questios: Mai Memory Techologies How may bits would be i the memory of a computer with 4KB memory What is the amout of mai memory iside your computer? RAM (Radom Access Memory) Allow the stored data to be accessed i ay order No physical movemet of the storage medium or a physical readig head Ay piece of data ca be retured uickly ad i a costat time Moder computers use other techologies to improve the performace of mai memory (size, respod time) DRAM (Dyamic RAM) SDRAM (Sychroous DRAM) DDR-SDRAM (Double Data Rate-SDRAM ) (doubled stadard SDRAM efficiecy) Summarizatio Next Lecture: Boolea operatios Gates Flip-flops (store a sigle bit) Mai memory (RAM) Cell, Byte, Address Mass (or secodary) storage & represetig iformatio Readig assigmets: Chapter 1.3, 1.4 5