مقدمة في الحوسبة2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 77

Data Storage

Dr. Sana’a Wafa Al-Sayegh


Engineering Department
University College of Applied Sciences

2022 - 2023
1
Outline

► Introduction
► Bits and their storage
► Boolean operations
► Gates
► Main memory
► Memory organization
► Mass storage

2
Introduction

► We begin our study of computer


science by considering how
information is encoding and stored
inside computers

3
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
4
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

5
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) 6
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.

7
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)

8
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.

9
A pictorial representation of AND, OR, XOR, and NOT
gates as well as their input and output values
Gates

► 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.

11
Gates

12
Exercise
► What input bit patterns will cause
the following circuits to produce an
output of 1?

13
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”

14
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.
15
Memory organization

16
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 the following Figure

17
Measuring memory capacity

► Kilobyte = 1024 byte


► Megabyte = 1024 kilobyte
► Gigabyte = 1024 megabyte
► Terabyte = 1024 Gigabyte
► Petabyte = 1024 Terabyte

18
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,
and flash drivers.

19
Advantages of mass storage

► less volatility
► large storage capacity
► low cost
► the ability to remove the
storage medium from machine
for archival purpose

20
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.

21
Mass Storage Systems
► Magnetic Systems
► Disk
► Tape
► Optical Systems
► CD
► DVD
► Flash Drives

22
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.
► Repositioning the read/write heads,
different concentric tracks can be
accessed.
23
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.

24
A magnetic disk storage system

25
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.
26
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

27
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
28
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. 29
Representing Text
► Each character (letter, punctuation,
etc.) is assigned a unique bit pattern.
ASCII: Uses patterns of 7-bits to
represent most symbols used in
written English text
ISO standard: Uses patterns of
32-bits to represent most symbols
used in languages world wide
Unicode: Uses patterns of 16-bits to
represent the major symbols used in
languages world wide 30
Figure 1.13 The message “Hello.” in ASCII

31
Representing Numeric Values
► Binary notation is a way of
representing numeric values
using only digits 0 and 1.
► Limitations of computer
representations of numeric
values
► Overflow: occurs when a
value is too big to be
represented
32
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
33
Representing Numeric Values

⚫ A number represented as:


Integer Fraction

⚫ Each digit carries a certain


weight based on its position
34
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

35
Binary system
⚫ For example, here is (11001) in binary
2

⚫ (101.11)2

36
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

37
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

38
Figure 1.15 The base ten and binary
systems

39
Figure 1.16 Decoding the binary
representation 100101

40
Exercise

► Convert each of the following binary representation to


its base ten:
► 0101
► 1001
► 1011
► 0110
► 1000
► 10010

41
Figure 1.18 An algorithm for finding
the binary representation of a
positive integer

42
Figure 1.18 Applying the algorithm in Figure 1.15
to obtain the binary representation of thirteen

43
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.

• The equivalent decimal number is N = 512 + 160 + 14 = 686.


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


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)
Decimal to hexadecimal
convert (4768)10 to hex.
= 4768 / 16 = 298 remainder 0
= 298 / 16 = 18 remainder 10 (A)
= 18 / 16 = 1 remainder 2
= 1 / 16 = 0 remainder 1
Answer: 1 2 A 0
Hexadecimal to binary
• (24C)16
• Each hexadecimal digit is converted to 4-bit
patterns
• 2 → 0010, 4 → 0100, and C → 1100
• (306 ) = (00110000 0110)
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
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.
Octal
• (1256)8
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
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
Binary to octal

► 111001112 = 3478
► 11000 010101010 010 0012 = 30252218
Octal to binary

► convert (632)8 to binary

(110011010)2
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.

56
Binary addition

57
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

58
Fraction in binary

59
Decimal fraction to binary

► Covert 0.625 to base 2

0.625 x 2 = 1.25
0.625 = .1
0.25 x 2 = 0.50
0.625 = .10
0.50 x 2 = 1.00
0.625 = .101

60
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

61
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.

62
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.

63
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.

64
Figure 1.14 The sound wave represented
by the sequence 0, 1.5, 2.0, 1.5, 2.0, 3.0,
4.0, 3.0, 0

0-65
Storing integers

► Two’s complement Notation, excess notation are used


for representing integer values in computing equipment.

66
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.
67
Figure 1.21 Two’s complement notation
systems

68
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.

69
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.

70
Example of encoding value

71
Addition in two’s complement

72
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.

73
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.
74
Excess notation

► Another method of representing integers values


► As in two’s complement , each of the values is
represented by a bit patterns of the same length.
► The difference between an excess system and two’s
complement id that the sign bits are reversed.

75
Figure 1.24 An excess eight conversion table

76
Figure 1.25 An excess notation system using bit patterns
of length three

77

You might also like