Understanding Data Storage Basics
Understanding Data Storage Basics
Chapter 1
DATA STORAGE
BOOLEAN OPERATIONS
1) AND OPERATION
• The AND operation is used to combine two statements (P&Q) using conjunction
AND.
Ex: Kermit is a frog AND Miss Piggy is an actress.
• The AND operation returns TRUE if and only if all its operands are True.
General form: P AND Q
Symbol: ^
P& Q are inputs.
Conditions:
Truth Table:
P Q P^Q
0 0 0
0 1 0
1 0 0
1 1 1
2) OR OPERATION
• The OR operation takes two logical inputs and produces an o/p of 1 if at least one of
the i/ps is 1.
• The o/p is 0 only when both i/ps are 0.
General form: P OR Q
Symbol: v
P & Q are inputs.
Condition:
Truth Table:
P Q P^Q
0 0 0
0 1 1
1 0 1
1 1 1
3) XOR OPERATION
• XOR operation gives the o/p 1 if exactly one of its inputs is true (1) & the other is
false (0).
• It outputs 0 if both the i/ps are same i.e 0/1.
Symbol: +
Truth Table:
P Q P XOR Q
0 0 0
0 1 1
1 0 1
1 1 0
4) NOT OPERATION
• NOT operation gives the o/p ie opposite of that i/p.
• If the i/p is true the o/p will be false.
• If the i/p is false the o/p will be true.
• This operation only has one input.
Truth Table:
P Q
0 1
1 0
Gate: A device which produces the o/p of the Boolean operation when we give i/p
values of Boolean operation is called as a Gate.
• Inside computers the gates are implemented as small electronic circuits where the
digits 0 & 1 are represented as voltage levels.
• Here the i/ps are entered on one side & the o/p will be excited on the other side.
1) AND GATE
i/ps o/p
i/ps o/p 00 0
01 0
10 0
11 1
2) OR GATE
3) XOR GATE
4) NOT GATE
i/ps o/p
– i/ps o/p
0 1
1 0
FLIP FLOPS
• Flip Flop is a fundamental unit of computer memory.
• Flip flops act as building blocks for constructing complex circuits.
• Flip flop is a bistable multivibrator which means it has a stable states (0/1).
• It is a sequential logic circuit that can store 1 bit of information (0/1).
• The o/p of flipflop depends on the current i/p & the previous state because it has
memory.
• Multiple flip flops together form the memory & information storage system in
computers.
• I/ps can set or reset the stored value & o/ps are used by other circuits.
• VLSI technology (Very Large Scale Integration) enables millions of flip flops &
circuits on a single chip.
• This chip can even contain an entire computer system.
i/ps o/p
00 0/1
01 0
10 1
11 1
• When we change the upper i/p to 1 & lower i/p to 0. This causes the o/p of the OR
gate to 1 regardless of other i/p to this gate.
• In turn both the i/ps to AND Gate will now be 1. Since the other i/p to this gate is
already 1.
Hexadecimal Notation
• Inside a computer, data is handled as patterns of bits (0’s & 1’s).
• The long sequences of bits are called s a Bit stream.
• Bit streams are difficult for humans to read, write & understand.
• To make it easy, we use hexadecimal notation (hex) as shorthand.
• The hexadecimal represents 4 bits with the symbols (0-9 and A-F).
• Note: Every 4 digit= 1 hex digit
Bits Hexadecimal
Representation
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F
Ex:
1) 1011= B
2) 0101= 5
3) 10110101= B5
4) 1010010011001000= A4C8
MAIN MEMORY
Memory:
• Memory is the storage space in a computer where data, instructions & results are
stored either temporarily or permanently.
• It acts as the link between CPU & Storage devices.
• It allows the computer to perform tasks efficiently by providing fast access to
information.
1) Primary Memory
2) Secondary Memory
2) Ex: RAM, ROM, Cache, Registers. 2) Ex: SSD, CD, Pendrive etc.
3) RAM- volatile (loses data when power 3) Non volatile, data is retained even
is off) ROM- non volatile after power off.
Main Memory:
Main memory is the working memory of a computer. It stores data & instructions that the
CPU is currently using.
Memory Organisation
• A computer’s main memory is organised in manageable units called “Cells”.
• The typical size of the cell is 8 bits.
• A string of 8 bits is called a Byte.
• Also, the typical memory cells capacity is 1 byte.
• 1 Byte= 8 Bits
• In the memory the left end of the row is called the high- order end.
• The right end is called the low- order end.
• The left most bit is called as the higher order bit or the most significant bit.
• The right most bit is called as the low order bit or the least significant bit.
How we identify cells:
• To identify the individual cells in a computers main memory, every cell will be
assigned by a unique name called as its “Address”.
EX:
11101101
Cell n
-
-
-
- Address
10011001
Cell 3
11100011
Cell 2
10001101
Cell 1
10110101 Cell 0
Cells
• Main memory cells & bits inside them are ordered in a sequence like 1 long row of
bits.
• This will allow storage of larger bits pattern by using multiple consecutive cells
[ Ex, 16 bits stored in 2 cells]
• The memory includes circuits for storing & retrieving data.
RAM
1024 bytes = 1 KB
4096 = 4 * 1096
MASS STORAGE
• Due to volatility & limited size of the main memory, most of the computers have
additional memory devices called mass storage.
• Mass storage is also called as Secondary Storage.
• It includes devices like magnetic disks, CDs, DVDs, magnetic tapes, flash drives etc.
• The advantages of mass storage include less volatility, large storage capacity, low
cost etc.
• The main disadvantage of magnetic & optical mass storage system is, they typically
require mechanical motion, so they require more time to store & retrieve data than a
machines main memory.
1) Magnetic Systems
• Transfer rate is higher in outer zones because more data passes under the head per
rotation.
• Disks rotate at high speeds & read/ write heads float above the surface without
touching.
• A head crash occurs if the dust gets between head & disk so the disks are sealed to
prevent contamination.
• Access times are in milliseconds (ms).
• Magnetic Tapes: it stores data on reels of plastic tape with magnetic coating, have
very long seek times, but are cheap & useful for backups.
• Floppy Disks: these are portable single platters with magnetic coating, offers low
density & speed but they are popular before flash drives.
2) Optical Systems:
• Example for optical systems is CD (Compact Disk).
• Optical storage uses laser technology to read/ write data.
• Ex: Compact Disk (CD): These are 12 cm in diameter & consist of reflective
surface with a protective coating.
• Data is stored as irregularities in reflectivity & read by a laser.
• The CD data is stored on a single spiral track from inside to outside.
• The track is divided into sectors, each storing 2 KB of data.
• The data is stored at uniform linear density, so more sectors exist in the outer loops
than inner loops.
• To maintain constant data rate, CD audio players vary rotation speed, but most
computer CDs use constant speed causing variations in transfer rate.
• CDs perform best for continuous data (music) where magnetic disks are better for
random access.
3) Flash Drives:
• Magnetic & Optical storage require mechanical motion (spinning disks, moving
heads, laser beams) which makes them slower than electronic circuitry.
• Flash memory stores data electronically by trapping electrons in silicon dioxide
chambers which makes it fast, portable & non-volatile.
• Flash Memory retains data for many years without power.
• Data can be read in small-byte sized units but erasing happens in large blocks.
• Repeated erasing damages Silicon Dioxide chambers; limits flash memory’s use as
general main memory.
• Suitable for applications where data rewriting is less frequent, like digital cameras,
smart phones, laptops etc.
• They are resistant to shocks and thus widely used in portable devices.
HELLO
• The ISO family produced extended 8-bit standards to cover major language groups.
0000
0001
0010
0011
0100
0101
0110
0111
1000
1) Two’s complement notation => for storing positive and negative whole
numbers.
2) Floating-point notation => for storing numbers with fractions/decimals.
3) Representing images
• An image can be represented as a collection of dots (pixels).
• The collection of pixels forms a bit map.
• Display Devices (Monitors, Printers) operate on pixel concept.
• Bit maps are easy to display but hard to resize.
• Black and White Images:
Each pixel can be represented by 1 Bit (Black or White); Used in fax machines.
• Gray Scale Images:
Each pixel usually uses 8 bits => can represent multiple shades of gray.
• Colour Images:
1) RGB
- Each pixel = 3 components (Red, Green, Blue)
- Each component uses 1 byte => 3 bytes per pixel.
• Example: 0, 1.5, 2, 1.5 shows how the sound goes up and down.
• Music needs much better quality. So, 44100 samples per second are taken.
• Each sample is stored in 16 bits or 32 bits.
• This means 1 second of music takes more than million bits of storage.
MIDI (Musical Instrument Digital Interface)
• Divide the decimal number by 2 & write down the remainder (0 or 1).
• As long as the quotient obtained is not zero, continue to divide the newest quotient by 2
& record the remainder.
• Now that a quotient of 0 has been obtained, the binary representation of the original
value consists of the remainders listed from right to left in the order they were recorded.
Ex: 1) 13 2 13 2) 37 2 37
2 6 -1 2 18 -1
2 3 -0 2 9 -0
1 –1 2 4 -1
2 2 -0
13 = 1101 1 -0
37 = 100101
Binary Addition
Rules for binary addition
1) 0 + 0 = 0
2) 0 + 1 = 1
3) 1 + 0 = 1
4) 1 + 1 = 0 (carry 1) = 1 0
5) If three 1’s are added (1 + 1 + 1)
• 1 + 1 + 1 = 1 (carry 1) = 1 1
Ex: 1) 111010 + 11011 = 1010101 3) 111 + 1010 = 10001
1 1 1 1 1
111010 0111
+ 11011 + 1010
1010101 10001
1 1 1
1011
+ 1101
11000
[11 + 13 = 24]
Fractions in Binary
Binary Fraction:
Ex: 1) 101.101
1 1
10.011
+ 100.110
111.001
Storing Integers
1) Two’s complement notation (most common system for representing positive & negative
integers)
2) Excess (Bias) Notation
+5 = 0 1 0 1 +3 = 0 0 1 1 +6 = 0 1 1 0
Add 1 + 1 + 1 + 1
1011 1101 1010
1) 3 + 2 = 0 0 1 1
+0010
0 1 0 1 => 5
Adding 2 negative numbers
2) -3 + -2 = 1 1 0 1
+ 1110
1 0 1 1 => -5
• Overflow happens when the result of a calculation is too large (or too
small) to fit in the available number of bits.
• In 2’s complement, the range of numbers is fixed
For n bits: from -2(n-1) to 2(n-1)-1
• Example for 4 bit system range is -8 to +7
• If we try 5+4=9, 9 can’t be represented in 4bits. The result appears as
1001, which is 7 (wrong), it is called a overflow error.
2) Excess notation
Steps:
1) Choose a bit length (Ex 4bits)
2) List all binary patterns in order (0000 to 1111)
3) Find the mid point (i.e. mid point is the first pattern starting with 1)
4) Assign that pattern to 0.
5) Numbers above it represent positive integers (+1, +2, +3………..)
6) Numbers below it represent negative integers (-1, -2, -3……………)
Storing Fractions
Floating point notation:
• Integers are easy to store because they don’t have fractions.
• Fractions like 2.75, 3/8 etc need both the binary digits and the position of the radix point.
• Floating point notation solves this by using a format similar to scientific notation.
• Let us take an ex of 1 byte storage (8bits).
• First designate the MSB (high order bit) of the byte as sign bit.
• Zero in the sign bit means non-negative. One in the sign bit means negative.
• Next we divide the remaining 7bits of byte into 2 groups
➢ Exponent field
➢ Mantissa field
• Then assign the 3 bits following sign bit as exponent field and remaining 4 bits as the
mantissa field.
Ex: 1) 01101011
.1011
➢ Extract the contents of exponent field (110) think that it is an integer stored using 3bit
excess method.
110 = 2 (in 3bit excess method)
So we should move the radix point to right by 2 bits.
10.11
10.11 = 23/4
Here sign bit is 0, so it is a non negative number & the value stored is
01101011 = 23/4
Ex: 2) 00111100
Sign bit = 0
Exponent = 011
Mantissa = 1100
.1100
011 = -1 (3bit excess method)
.01100
.01100 = 3/8
Here sign bit is 0. So it is a non negative number & the value stored is
00111100 = 3/8
➢ To store the values using floating point notation we reverse the above process.
Ex: 1) 1 1/8
➢ Binary notation 1.001
➢ Copy the bit pattern into mantissa field from left to right.
____1001
➢ Here we must move the 1 bit to right from radix to obtain
1.001
➢ The exponent should be +ve so place 101 (in excess 4 notation) in exponent field.
➢ Finally fill the sign-bit by 0 because value stored is non negative.
The value is
01011001