Title: DATA STORAGE
1DATA STORAGE
- Tian-Li Yu
- tianliyu_at_cc.ee.ntu.edu.tw
- Department of Electrical Engineering
- National Taiwan University
2Binary world
- Bit binary digit (0/1)
- Simple, logical, and unambiguous
- Boolean operations gates
3Logical gates
- Logical world vs. real world
- To be or not to be ? always true
4Flip-flop
- Purpose to keep the state of output until the
next excitement. - Has an input line which sets its stored value to
1 - Has an input line which sets its stored value to
0 - While both input lines are 0, the most recently
stored value is preserved
Flip-flop
x
z
y
5A simple flip-flop circuit
6Another flip-flop
7Hexadecimal coding (hex)
8Main memory cells
- Cell A unit of main memory (typically 8 bits
which is one byte)
9Main memory address
10Memory techniques
- Random Access Memory (RAM) Memory in which
individual cells can be easily accessed in any
order - Static Memory (SRAM)
- Dynamic Memory (DRAM) Tiny capacitors
replenished regularly by refresh circuit - Synchronous DRAM (SDRAM)
- Capacity
- Kilobyte 210 bytes 1024 bytes 103
- Megabyte 220 bytes 1,048,576 bytes 106
- Gigabyte 230 bytes 1,073,741,824 bytes 109
11Mass Storage
- Magnetic Systems (Disk, Tape)
- Optical Systems (CD, DVD)
- Flash Drives
- Larger capacity
- Less volatility
- Slower
- On-line or off-line
12Magnetic disk storage system
- Head, track, sector, cylinder
- Access time Seek time Rotation delay/latency
time - Transfer rate (ATA 100/133, SATA 1.5/3.0, etc)
13CD storage
14Physical vs. logical records
Files File systems
15Buffer
- A memory area used for the temporary storage of
data (usually as a step in transferring the
data). - Blocks of data compatible with physical records
can be transferred between buffers and the mass
storage system. - Data in buffer can be referenced in terms of
logical records.
16Representing Text
- ASCII (American standard code for information
interchange by ANSI) 7 bits (or 8 bits with the
1st bit 0) - Unicode 16 bits
- ISO standard (International organization of
standardization) 32 bits
17ASCII example
18Representing Numeric Values
19From binary to decimal
20From decimal to binary
131x231x220x211x20
21Representing images
- Bit map techniques
- Pixel picture element
- Colors RGB, HSV, etc.
- LCD, scanners, digital cameras, etc.
- Vector techniques
- Scalable
- TrueType, PostScript, SVG (scalable vector
graphics), etc. - CAD, printers
22Representing sounds
- Sampling MIDI (synthesis)
23Binary system revisited
- Addition
- Subtraction? Lets define negative number first.
24Twos complement notation
For x positive, x ? x -x ? (2n x)
25Encoding negatives (2s complement)
Another way binary encoding (2n y) for 2s
complement (-y)
26Subtraction in 2s complement
27Excess notation system
Conversion x ? (2n-1 x) mod 2n
Addition xy ? (2n-1(2n-1 x)(2n-1 x)) mod 2n
28Overflow
- Addition of two positive numbers
- 23 5 ? -3 (mod 8)
- Addition of two negative numbers
- (-2) (-3) -5 ? 3 (mod 8)
010 ) 011 ---------- 101
110 ) 101 ---------- 011
29Fraction in binary
30Floating-point notation
- Why? (how to represent 0.0000000000001?)
Usually excess notation
31Decoding floating-point
- 01101011
- (0) (110) (1011)
- .1011 ? 10.11 ? 2 ½ ¼ 2¾
32Truncation errors
33Normalized form
- The most significant bit of mantissa is 1
- 0s floating-point representation is all 0s.
- 01100011 ? (0) (110) (0011) ? .0011 x 22
- ? .1100 x 20 ? (0) (100)(1100) ? 01001100
34Loss of digits
- 4 ¼ ¼ 011110000011100000111000
- 01111000 0111000001110000
- 01111000 4 !!!
- 4 (¼ ¼) 01111000(0011100000111000)
- 01111000 01001000
- 01111000 01110001
- 01111001 4½ !!!
- How to use calculator to do (1099 0.123 1099)?
35Data compression
- Lossy vs. lossless
- Run-length encoding
- Frequency-dependent encoding
- Huffman codes
- Relative encoding / difference encoding
- Dictionary encoding
- Adaptive dictionary encoding
- LZW encoding
36Huffman encoding
- AAABBBAABCAAAABD
- A?00 B?01 C?10 D?11
- 000000010101000001100000000111 (32 bits)
- A ? 0 B?10 C?110 D?111
- 0001010100010110000010111 (25 bits)
37LZW encoding
- xyx xyx xyx xyx
- 1
- 12
- 121
- 1213
- 12134
- 121343434
- x ? xy ? xyx ? xyx xyx xyx xyx
38Images, audios, and videos
- GIF 256 colors, dictionary encoding
- JPEG
- Lossy or lossless
- Discrete cosine transform
- Discard high-frequency information that is
insensitive to human eyes - MP3
- temporal masking
- Frequency masking
- MPEG
- Relative encoding other techniques
39Parity Bits
- Communication
- RAID (Redundant Array of Independent Disks)
Techniques
40Error-correcting codes
Maximized hamming distances between symbols (at
least 3)
41Exercises
- No hand-in
- Ch 1.1 4, 6, 7
- Ch 1.3 6
- Ch 1.5 3, 4
- Ch 1 3, 30, 31, 32, 44, 53, 54, 60