Review: History of

CS100: Introduction to q Mainframes Science q Minicomputers

Lecture 2: Storage -- , their q Personal Computers & Workstations storage and main memory

Review: The Role of Algorithms How are data stored inside computers? n Algorithm: n 1.1 Bits and Their Storage n 1.2 Main Memory n Program: n n Programming: n Software: n n Hardware:

Bits and Patterns Bits and Boolean Operations

n Boolean Operation: An operation that n Bit: Binary Digit (0 or 1) manipulates one or more true/false values n Bit Patterns (strings of 0 and 1s) are used to n Specific operations represent information. q AND q Numbers q OR q Text characters q XOR (exclusive or) q Images q NOT q Sound q And others

1 Figure 1.1 The Boolean operations Bits and Boolean Operations AND, OR, and XOR (exclusive or) n Boolean operations

q AND n Based on compound statement of the form P AND Q n 1 AND 1 =1, 1 represents the value true, 0 represents false q OR n P OR Q, n The output is true when at lease one of them is true q XOR (exclusive or) n The output is true when its inputs are different q NOT: the output is the opposite of the input

Figure 1.2 A pictorial representation of Gates AND, OR, XOR, and NOT gates as well as their input and output values n Gate: A device that computes a Boolean operation q implemented as (small) electronic circuits inside today’s computes q Other technologies to implement gates n Gears, relays, optic devices. q Provide the building blocks from which computers are constructed

Flip-flops Figure 1.3 A simple flip-flop circuit

n Flip-flop: A circuit built from gates that can store one bit.

q Has an input line which sets its stored value to 1 q Has an input line which sets its stored value to 0 q While both input lines are 0, the most recently stored value is preserved

2 Figure 1.4 Setting the output of Figure 1.4 Setting the output of a flip-flop to 1 a flip-flop to 1 (continued)

Figure 1.4 Setting the output of Figure 1.5 Another way of a flip-flop to 1 (continued) constructing a flip-flop

What happens if 1 is placed on the lower input? How does this flip-flop work?

Flip-flops Exercise:

What input bit patterns will cause the following circuit to n The flip-flop is one means of storing a bit produce an output of 1? within a computer. q Can have the output value of either 1 or 0 q Other circuit can adjust the output value (write) Inputs q Other circuit can respond to the stored value Output (read) n Flip-flops show how devices can be constructed from gates.

3 Main Memory Main Memory Cells n A collection of integrated circuits to store data (such as flip-flops) n Cell: A unit of main memory (typically 8 bits n Needs to have electrical power in order to maintain its which is one byte) information q Most significant bit: the bit at the left (high-order) n Computer can manipulate only data that in main end of the conceptual row of bits in a memory cell memory q Least significant bit: the bit at the right (low- q Copy programs into main memory from a storage device to execute order) end of the conceptual row of bits in a q Copy files into main memory to access memory cell n The amount of main memory is crucial q How many programs can be executed q How much data can be readily available to a program?

Figure 1.7 The organization of a Main Memory Addresses byte-size memory cell n Address: A “name” that uniquely identifies one cell in the computer’s main memory q The names are actually numbers. q These numbers are assigned consecutively starting at zero. q Numbering the cells in this manner associates an order with the memory cells.

Figure 1.8 Memory cells arranged by Measuring Memory Capacity address n Kilobyte: 210 bytes = 1024 bytes q Example: 3 KB = 3 × 1024 bytes q Sometimes “kibi” rather than “kilo” n Megabyte: 220 bytes = 1,048,576 bytes q Example: 3 MB = 3 × 1,048,576 bytes q Sometimes “megi” rather than “mega” n Gigabyte: 230 bytes = 1,073,741,824 bytes q Example: 3 GB = 3 × 1,073,741,824 bytes q Sometimes “gigi” rather than “giga”

4 Questions: Questions: n If the memory cell whose address is 5 n Suppose we want to interchange the values contains the value 8, what is the difference stored in memory cells 2 and 3. Does the between writing the value 5 into cell number following algorithm perform the task 6 and moving the contents of cell number 5 correctly? into cell number 6?

q Step1: Move the contents of cell number 2 to cell number 3. q Step 2: Move the contents of cell number 3 to cell number 2.

Questions: Main Memory Technologies n How many bits would be in the memory of a n RAM (Random Access Memory) computer with 4KB memory q Allow the stored data to be accessed in any order q No physical movement of the storage medium or a physical reading head q Any piece of data can be returned quickly and in a constant time n What is the amount of main memory inside n Modern computers use other technologies to your computer? improve the performance of main memory (size, respond time) q DRAM (Dynamic RAM) q SDRAM (Synchronous DRAM) q DDR-SDRAM (Double Data Rate-SDRAM ) (doubled standard SDRAM efficiency)

Summarization Next Lecture: n Boolean operations n Mass (or secondary) storage & representing n Gates information n Flip-flops (store a single bit) n Reading assignments: Chapter 1.3, 1.4 n Main memory (RAM)

q Cell, Byte, Address

5