Uploaded by Feras Osama Abu Zayed

CH01-Data-Storage

advertisement
Computer Components
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Introduction to Computer and Internet
Scanner
CPU (Microprocessor)
Main memory (RAM)
Expansion cards
Power supply unit
Optical disc drive
Hard disk drive (HDD)
Motherboard
Speaker
Monitor
System software
Application software
Keyboard
Mouse
External hard disk
Printer
Data Storage
Introduction to Computer and Internet
Outline
•Introduction
•Bits and their storage
•Boolean operations
•Gates
•Main memory
•Memory organization
•Mass storage
Introduction to Computer and Internet
Introduction
•We begin our study of computer science by
considering how information is encoding and
stored inside computers
Introduction to Computer and Internet
Bits And Their Storage
•Inside the computers information is encoded as
patterns of 0s and 1s. These digits are called bits
(binary digits).
•bits are used to represent:
•Numeric values
•Characters
•Images
•Sounds
Introduction to Computer and Internet
Boolean Operations
•bit 0 represent the value false
•bit 1 represent the value true
•Operations that manipulate true/false values are
called Boolean operations.
•basic Boolean operations are:
•AND, OR, and XOR (exclusive or)
•There is also NOT
Introduction to Computer and Internet
Boolean Operations
•AND, OR, and XOR operators take two operands,
but the NOT operator takes a single operand
•AND
•The AND operator performs logical
conjunction on two Boolean expressions.
•If both expressions are equal to true (1), then
the AND return true, otherwise all other cases
should produce an output False (0)
Input1 Input2 output
Truth Table
0
0
0
0
1
0
1
0
0
1
1
1
Introduction to Computer and Internet
Boolean Operations
•OR
•The OR operator performs logical disjunction on
two Boolean expressions.
•OR operator returns true value when at least one
of their Boolean expression is equal to true.
Input1
Truth Table
Input2 output
0
0
0
0
1
1
1
0
1
1
1
1
Introduction to Computer and Internet
Boolean operations
•XOR (exclusive or)
•XOR performs logical exclusion on two expressions.
•XOR produce an output of 1 (true) when one of its
inputs is 1 and the other is 0
•(In short, the XOR operation produces an output of
1 when its input are different)
Truth Table
Input1
Input2
output
0
0
0
0
1
1
1
0
1
1
1
0
Introduction to Computer and Internet
Boolean Operations
•NOT
•The operation NOT is another Boolean operation.
It differs from AND, OR, and XOR because it has
only one input.
•Its output is the opposite of that input.
Truth Table
Input
Output
0
1
1
0
Introduction to Computer and Internet
Gates And Flip-flops
•Gate is a device that produces the output of a
Boolean operation.
•Its often implemented as (small) electronic circuits,
in which the digits 0 and 1 are represented as
voltage levels.
•Gates provides the building blocks from which
computer are constructed.
Introduction to Computer and Internet
Gates
Introduction to Computer and Internet
Exercise
•What input bit patterns will cause the following
circuits to produce an output of 1?
Introduction to Computer and Internet
Main Memory
•For storing data, a computer contains a large
collection of circuits, each capable of storing a
single bit.
•Also known as RAM “Random Access Memory”
Introduction to Computer and Internet
Memory Organization
• A computer main memory is organized in
manageable units called cells.
• Cell: A unit of main memory (typically 8 bits
which is one byte)
• Each cell’s size equal to eight (8) bits.
• higher-order end: the left end of the row of bits
on the memory
• lower-order end: the right end
• most significant bit: the last bit at the high-order
end.
• least significant bit: the bit at the right end.
Introduction to Computer and Internet
Memory Organization
Introduction to Computer and Internet
Memory Organization
•To identify individual cell in a computer’s main
memory, each cell is assigned a unique “name”,
called its address.
•Address: A “name” that uniquely identifies one
cell in the computer’s main memory. As shown in
Figure
Introduction to Computer and Internet
Measuring Memory Capacity
•Kilobyte = 1024 byte
•Megabyte = 1024 kilobyte
•Gigabyte = 1024 megabyte
Introduction to Computer and Internet
Mass Storage
•Due to the volatility and limited size of a
computer’s main memory, most computers have
additional memory devices called mass storage (or
secondary storage) system.
• example: magnetic disks, CDs, DVDs, magnetic
tapes, and flash drivers.
Introduction to Computer and Internet
Advantages Of Mass Storage
•less volatility
•large storage capacity
•low cost
•the ability to remove the storage medium from
machine for archival purpose
Introduction to Computer and Internet
Disadvantages Of Mass Storage
•It require mechanical motion and therefore require
significantly more time to store and retrieve data
than a machine’s main memory, where all activities
are performed electronically
Introduction to Computer and Internet
Mass Storage Systems
•Magnetic Systems
•Disk
•Tape
•Optical Systems
•CD
•DVD
•Flash Drives
Introduction to Computer and Internet
Magnetic Systems
•Example: magnetic disk
•Thin spinning disk with magnetic coating is used to
hold data.
•Read/write heads are placed above and/or below
the disk so that as the disk spins, each head
traverses a circle, called track.
•Be repositioning the read/write heads, different
concentric tracks can be accessed.
Introduction to Computer and Internet
Magnetic Systems
•Each track divided into small arcs called sectors on
which information is recorded as a continuous
string of bits.
•The location of tracks and sectors are marked
magnetically through the format process.
Introduction to Computer and Internet
Figure 1.9 A magnetic disk storage system
Introduction to Computer and Internet
Magnetic Systems
•Magnetic disk performance evaluation depends
on four criteria's:
•Seek time, the time required to move the
read/write head from track to another.
•Rotation delay (latency time), half -average
calculation the time required for the disk to
make complete rotation.
•Access time, the sum of the seek time and
rotation delay.
•Transfer rate, the rate at which data can be
transferred to/from the disk.
Introduction to Computer and Internet
Magnetic Tape
•An older from of mass storage
•Information is recorded on the magnetic coating of
a thin tape that is wound on a reel.
•Taps is mounted in a device called tape drive
(read/write).
•A major disadvantages of it, that moving between
different position on tape can be very timeconsuming
Introduction to Computer and Internet
Figure 1.10 Magnetic tape storage
Introduction to Computer and Internet
Optical System
•Another class of mass storage.
•CD, consists of reflective material covered with a
clear protective coating
•Information is recorded by creating variations in
their reflective surfaces
•Information retrieved by laser beam that monitors
irregularities on the reflective surface
Introduction to Computer and Internet
Digital Versatile Disks (DVD)
•Traditional CDs have capacity in range 600 to
700MB.
•Digital Versatile Disks (DVD), constructed from
multiple, semi-transparent layers that serves as
distinct surface when viewed by a precisely
focused laser.
Introduction to Computer and Internet
Flash Drivers
•In mass storage, data storage and retrieval is slow
compared to the speed of electronic circuitry .
•Flash memory has the potential of solving this
drawback.
•Bits are stored by sending electronic signals
directly to the storage medium
Introduction to Computer and Internet
File Storage
•File: A unit of data stored in mass storage system
•data stored in a mass storage system is
conceptually grouped into large unit called files
•Files stored on a magnetic disk must be
manipulated by sector.
•A block of data conforming to the specific
characteristics of a storage device is called a
physical record.
•A large file stored in a mass storage will consists
of many physical record. “the size of the sector”
Introduction to Computer and Internet
File Storage
•The nature f a file division is determined by the
information represented in the file.
•File containing information regarding a
company's employee would consists of multiple
units. Each consists of information about one
employee.
•These naturally producing “occurring” blocks of
data are called logical records.
•Logical record: the nature divisions within the
data
Introduction to Computer and Internet
Introduction to Computer and Internet
File Storage
•Logical record consists of smaller units called
fields.
• Employee name, address, employee ID, etc.
•Identifying a field by a key field.
•Buffer: A memory area used for the temporary
storage of data (usually as a step in transferring the
data)
Introduction to Computer and Internet
Representing Text
•Each of different symbol on the text (alphabet
letter) is assigned a unique bit patterns
• the text is then representing as a long string of
bits.
•ASCII” American standard code for information
interchange”: Uses patterns of 7-bits to
represent most symbols used in written English
text.
•Today, it is extended to 8-bits.
Introduction to Computer and Internet
Figure 1.13 The message “Hello.” in ASCII
Introduction to Computer and Internet
Representing Text
•Unicode: Uses patterns of 16-bits to represent the
major symbols used in languages world side
•ISO standard: Uses patterns of 32-bits to represent
most symbols used in languages world wide
Introduction to Computer and Internet
Representing Numeric Values
•Binary notation is a way of representing numeric
values using only digits 0 and 1.
Introduction to Computer and Internet
Representing Numeric Values
•A number can be represented differently in
different systems. For example, the two numbers
(2A)16 and (52)8 both refer to the same quantity,
(42)10, but their representations are different.
•Each number system is associated with a base
Introduction to Computer and Internet
Representing Numeric Values
 A number represented as:
Integer
Fraction
 Each digit carries a certain weight based on its
position
Introduction to Computer and Internet
Binary system
•In the binary system, there are only two symbols
or possible digit values, 0 and 1. This base-2
system can be used to represent any quantity that
can be represented in decimal or other number
system
Introduction to Computer and Internet
Binary system
•For example, here is (11001)2 in binary
•(101.11)2
Introduction to Computer and Internet
Decimal
•The decimal system is composed of 10 numerals or
symbols. These 10 symbols are 0, 1, 2, 3, 4, 5, 6, 7,
8, and 9; using these symbols as digits of a
number, we can express any quantity.
•The decimal system, also called the base-10
system
Introduction to Computer and Internet
Decimal system
 (224)10
 Note that the digit 2 in position 1 has the value 20,
but the same digit in position 2 has the value 200
Introduction to Computer and Internet
Figure 1.15 The base ten and binary systems
Introduction to Computer and Internet
Figure 1.16 Decoding the binary representation 100101
Introduction to Computer and Internet
Exercise
•Convert each of the following binary
representation to its base ten:
•0101
•1001
•1011
•0110
•1000
•10010
Introduction to Computer and Internet
Figure 1.17 An algorithm for finding the binary representation
of a positive integer
Introduction to Computer and Internet
Figure 1.18 Applying the algorithm in Figure 1.15 to obtain the
binary representation of thirteen
Introduction to Computer and Internet
Binary addition
•To add two integers represented in binary
notation, we follow the same procedure in the
traditional base ten except that all sums are
computed using the following addition fact.
Introduction to Computer and Internet
Binary addition
111010
+ 11011
1
1
111010
+ 11011
01
Introduction to Computer and Internet
Binary addition
1
111010
+ 11011
0101
1
111010
+ 11011
010101
Introduction to Computer and Internet
Binary addition
111010
+ 11011
1010101
Introduction to Computer and Internet
Fraction in binary
•The digit to the right of radix point represent the
fractional part.
•The positions are assigned fractional quantities
•The first position is assigned the quantity ½
(which is 2-1), and so on
Introduction to Computer and Internet
Fraction in binary
Introduction to Computer and Internet
Decimal fraction to binary
•Covert 0.625 to base 2
625 x 2 = 1.25
.625 = .1
25 x 2 = 0.50
.625 = .10
.50 x 2 = 1.00
.625 = .101
Introduction to Computer and Internet
Representing images
•One mean of representing an image it to interpret
the image as a collection of dots, each is called
pixel.
•Pixel is a picture element.
•Each pixel is encoded.
•Image is represented as a collection encoded
pixels.
•Such collection is called bit map
Introduction to Computer and Internet
Black and white image
•Each pixel can be represented by a single bit.
•For more elaborate black and white picture, each
pixel can be represented by a collection of bits.
Introduction to Computer and Internet
Color Image
•RGB encoding
•Each pixel is represented as three color:
Red, Green and Blue.
•One byte is normally used to represent the
intensity of each color.
•Three byte of storage are required to represent a
single pixel.
Introduction to Computer and Internet
Representing Sounds
•The most generic method of encoding audio
information is to sample the amplitude of the
sound wave at regular intervals and record the
series of values obtained.
•Sound waves rises in amplitude, falls, rises at a
higher level, and then drop back to 0.
•The voice at one end of the communication is
encoded as numeric values representing the
amplitude of the voice.
•The numeric values can be then transmitted over
the communication line to the receiving end.
Introduction to Computer and Internet
Storing Integers
•Two’s complement Notation, excess notation are
used for representing integer values in computing
equipment.
Introduction to Computer and Internet
Two’s Complement Notation
•The most popular system within today’s computer.
•system in which negative numbers are represented
by the two's complement of the absolute value
•Used a fixed number of bits to represent each of
the values in the system.
•In today’s equipment, it is common to represent by
a pattern of 32 bits which allows a wide range of
numbers to be represented.
Introduction to Computer and Internet
Figure 1.21 Two’s complement notation systems
Introduction to Computer and Internet
Two’s Complement Notation
•The leftmost bit of a bit pattern represent the sign
of the value.
•“1” represent the negative sign.
•“0” represent the positive sign
•The complement of a pattern is the pattern
obtained by changing all the 0s to1s and all the 1s
to 0s.
Introduction to Computer and Internet
Coding The Value Using Two’s Complement
•Representing negative value
•Copy the original pattern from the right to left
until a 1 has been copied, then complement the
remaining bits until the final bit pattern.
Introduction to Computer and Internet
Example Of Encoding Value
Introduction to Computer and Internet
Addition In Two’s Complement
Introduction to Computer and Internet
Addition In Two’s Complement
•To add values represented in two’s complement,
we apply the same way that we used for binary.
•The answer must be in the same length, this
means that any extra bit generated at the left of
the answer by a final carry must be truncated.
Introduction to Computer and Internet
The Problem Of Overflow
•When using the two’s complement with pattern
with four bits, the largest positive integer that can
be represented is 7 and the most negative integer
is -8.
•We can’t obtain the correct answer to the problem
5+4.
•This is called overflow problem
•Overflow is the problem that occurs when a
computation produces a value that falls outside
the range of values that can be represented.
Introduction to Computer and Internet
Introduction to Computer and Internet
Hexadecimal (Hex)
• Hex is a numbering system that uses Base 16. The
numbers 0-910 are represented normally, but the
numbers 1010 through 1510 are represented by
the letters A through F
• 1 hex digit is equivalent to 4 bits
• Numbers are 0,1,2…..8,9, A, B, C, D, E, F.
• The following shows that the number (2AE)16 in
hexadecimal is equivalent to 686 in decimal.
Introduction to Computer and Internet
Hexadecimal (Hex)
• The equivalent decimal number is N = 512 + 160 +
14 = 686.
Introduction to Computer and Internet
Hexadecimal (Hex)
•Using hexadecimal, a very large binary string of 1s
and 0s can be represented with just a few
hexadecimal numbers by breaking the binary
number into groups of four and then using the
hexadecimal equivalent; for example,
1101100101001111 can be written as 1101 1001
0100 1111
Introduction to Computer and Internet
Hexadecimal To Decimal
• The following shows how to convert the
hexadecimal number (1A)16 to decimal
= 1 × 161 + A × 160
=16 + 10 ×1
=16+10 = 26
convert (F4C)16 to decimal
= (F x 162) + (4 x 161) + (C x 160)
= (15 x 256) + (4 x 16) + (12 x 1)
Introduction to Computer and Internet
Decimal to hexadecimal
convert (4768)10 to hex.
= 4768 / 16 = 298
= 298 / 16 = 18
= 18 / 16 = 1
= 1 / 16 = 0
remainder 0
remainder 10 (A)
remainder 2
remainder 1
Answer: 1 2 A 0
Introduction to Computer and Internet
Hexadecimal To Binary
• (24C)16
• Each hexadecimal digit is converted to 4-bit
patterns
• 2 → 0010, 4 → 0100, and C → 1100
• (306 ) = (00110000 0110)
Introduction to Computer and Internet
Binary To Hexadecimal
Convert (010011100010)2 to hexadecimal ?
We first arrange the binary number in 4-bit
patterns:
0100 1110 0010
4
E 2
Convert (0010110001101011)2 to hexadecimal?
0010 1100 0110 1011
2
C
6
B
Introduction to Computer and Internet
Octal
•The Octal numbering system is similar to the
Hexadecimal numbering system.
•This big difference is that the maximum value for
Octal is 7 since it is Base 8
•1 octal digit is equivalent to 3 bits.
Introduction to Computer and Internet
Octal
• (1256)8
Introduction to Computer and Internet
Octal To Decimal
•convert (632)8 to decimal
= (6 x 82) + (3 x 81) + (2 x 80)
= (6 x 64) + (3 x 8) + (2 x 1)
= 384 + 24 + 2
= (410)10
Introduction to Computer and Internet
Decimal to Octal
•convert (177)10 to octal
177 / 8 = 22 remainder is 1
22 / 8 = 2 remainder is 6
2/8=0
remainder is 2
Answer = 2 6 1
Introduction to Computer and Internet
Binary To Octal
•111001112 = 3478
•11000 010101010 010 0012 = 30252218
Introduction to Computer and Internet
Octal To Binary
•convert (632)8 to binary
(110011010)2
Introduction to Computer and Internet
Download