Lecture04 MemoryBinarySystem
Lecture04 MemoryBinarySystem
Lecture04 MemoryBinarySystem
1
Lectures for Chapter 1 and C Basics
Computer Abstractions and Technology
• Lecture 01: Chapter 1
– 1.1 – 1.4: Introduction, great ideas, Moore’s law, abstraction,
computer components, and program execution
2
Main Memory (DRAM) of a Computer
CPU or Processor
Control Unit
ALU
Input
Main Memory I/OOutput
Processor CPU is also called a chip.
IR PC
MBR MAR
Data Bus
Control Bus
Address Bus
3
Everything is Data Stored in Files
• Source code, executable, object are all files
– Files: Hello.c, sum_full.c, sum
– Folder: ., .., /home/yanyh, etc
• Compiler, OS kernel, etc are all stored as files
– gcc, vmlinuz-4.4.0-104-generic
• Information about files/folders and data are also files
– Metadata
6
Memory Cells Used In A Computer
7
Memory Cells Used In A Computer (cont.)
• Example: row of 3 switches
8
Representing Numbers Using a Row of Switches
Example:
9
The Binary Number System
• The binary number system uses 2 digits to encode a number:
• 0 = represents no value
• 1 = represents a unit value
• That means that you can only use the digits 0 and 1 to write a binary
number
•0
– Example: some binary numbers •1
• 10
• 11
• 1010
• and so on.
10
The Binary Number System
0
1
000 100
001 101
010 110
100 111
11
The Binary Number System
12
The Binary Number System
Example:
13
Memory and Binary Number in a Computer
14
Memory and Binary Number in a Computer (cont.)
15
Combining Adjacent Memory Cells
• The computer can combine adjacent bytes (memory cells) and use
it as a larger memory cell
Schematically:
18
Combining Adjacent Memory Cells (cont.)
19
Combining Adjacent Memory Cells (cont.)
20
Data Store in Memory
21
Variables are Memory Locations