0% found this document useful (0 votes)
10 views

Chapter 3 Computer Memory and Processors

Uploaded by

shoba
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Chapter 3 Computer Memory and Processors

Uploaded by

shoba
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 45

Computer

Fundamentals and
Programming in C
2nd Edition
Reema Thareja

1
© Oxford University Press 2016. All rights reserved.
CHAPTER 3
OMPUTER MEMORY AND PROCESSORS

© Oxford University Press 2016. All rights reserved.


INTRODUCTION

• Computer memory is an internal storage area used to store data and programs

• It can be divided into two groups: primary memory and secondary memory.

•While the main memory holds instructions and data when a program is executing, the
auxiliary or the secondary memory holds data and programs not currently in use and
provides long-term storage.

•The primary memory is volatile, so the data can be retained in it, only when the power is
on. Moreover, it is very expensive and therefore limited in capacity.

© Oxford University Press 2016. All rights reserved.


INTRODUCTION (Contd.)

• On the contrary, the secondary memory stores data or instructions


permanently, even when the power is turned off. It is cheap and can store
large volumes of data. Moreover, data stored in auxiliary memory is highly
portable, as the users can easily move it from one computer to the other.

• The only drawback of secondary memory is that data can be accessed from it
at a very slow speed as and when compared with the data access speed of
primary memory.

© Oxford University Press 2016. All rights reserved.


SEQUENTIAL AND RANDOM ACCESS

Memory devices can be accessed either randomly or sequentially. The method of


access has a great impact on application efficiency in terms of disk usage.

© Oxford University Press 2016. All rights reserved.


MEMORY HIERARCHY
In contemporary usage, memory usually refers to random-access memory,
CPU Registers
typically DRAM (Dynamic-RAM) but memory can also refer to other forms of
Level 1 Cache data storage.
In computer’s terminology, the term storage refers to storage devices that are
Level 2 Cache
not directly accessible by the CPU (secondary or tertiary storage).
Level 3 Cache
Examples of secondary storage include hard disk drives, optical disc drives,
Primary and other devices that are slower than RAM but are used to store data
Memory
permanently.
Hard Disk
These days, computers use different types of memory which can be organized
Optical Disk in a hierarchy around the CPU, as a trade-off between performance and cost.
The memory at a higher level in the storage hierarchy has less capacity to
Magnetic
Tape store data, is more expensive and is fastest to access.

© Oxford University Press 2016. All rights reserved.


PROCESSOR REGISTERS
Processor registers are located inside the processor and are therefore directly accessed by the CPU. Each
register stores a word of data (which is either 32 or 64 bits). CPU instructions instruct the arithmetic and
logic unit to perform various calculations or other operations on this data. Registers are the fastest of all
forms of computer data storage.

CACHE MEMORY
Cache memory is an intermediate form of storage between ultra-fast registers and the RAM. The CPU uses
cache memory to store instructions and data that are repeatedly required to execute programs thereby
improving the overall system speed and increase the performance of the computer.
Cache memory is basically a portion of memory made of high-speed static RAM (SRAM) instead of the
slower and cheaper dynamic RAM (DRAM) which is used for main memory.

© Oxford University Press 2016. All rights reserved.


TYPES OF RAMS
SRAM (Static RAM) and DRAM (Dynamic RAM): This is a type of RAM that holds data without an
external refresh as long as it is powered. This is in striking contrast with the DRAM which must
be refreshed multiple times in a second to hold its data contents.
SRAM is made of D flip flops in which the memory cells flip-flop between 0 and 1 without the
use of capacitors. Therefore, there is need for an external refresh process to be carried out.
SRAM occupies more space and is expensive as compared to DRAM. While each transistor on a
DRAM chip can store one bit of information, the SRAM chip, on the other hand requires four to
six transistors to store a bit.
However, SRAM is faster and more reliable than DRAM. SRAM is often used as cache memory.
Static RAM chips are also used in cars, household appliances and handheld electronic devices.

© Oxford University Press 2016. All rights reserved.


READ ONLY MEMORY (ROM)
ROM refers to computer memory chips containing permanent or semi-permanent
data. Unlike RAM, ROM is non-volatile.
Most computers contain a small amount of ROM that stores critical programs such as
BIOS which is used to boot the computer when it is turned on.

Rewritable ROM chips include PROMs, EPROMs and EEPROMs.


Programmable read-only memory (PROM) can be written to or programmed using a
special device called a PROM programmer. The PROM programmer uses high voltages
to permanently destroy or create internal links within the chip. The working of a
PROM is similar to that of CD-ROM recorder which enables the users to "burn"
programs onto blanks once.

© Oxford University Press 2016. All rights reserved.


READ ONLY MEMORY (ROM) contd.

Erasable programmable read-only memory (EPROM) can be erased and re-


programmed by exposing the chip to strong ultraviolet light for 10 minutes or longer
and then rewritten with a process that again needs higher than usual voltage applied.
The EPROM is much more useful than PROM and can be compared with a reusable
CD-RW.

Electrically erasable programmable read-only memory (EEPROM) is based on a


similar semiconductor structure to EPROM, but allows its entire or selected contents
to be electrically erased, then rewritten electrically, so that they need not be removed
from the computer (or camera, MP3 player, etc.). The process of writing an EEPROM
is also known as flashing.

© Oxford University Press 2016. All rights reserved.


READ ONLY MEMORY (ROM) contd.

The flash memory is also a type of EEPROM in which the contents can be erased under
software control. This is the most flexible type of ROM, and is widely used to store
BIOS programs. It is primarily used in memory cards, USB flash drives, MP3 players,
PDAs (personal digital assistants), laptop computers, digital audio players, digital
cameras, and mobile phones. The EEPROM blurs the difference between what "read-
only" really means. However, the EEPROM is rewritten only once a year or so,
compared to real read-write memory (RAM) where rewriting is done often many times
per second.

© Oxford University Press 2016. All rights reserved.


MAGNETIC TAPE

Magnetic tape is a thin strip of plastic coated with magnetic recording material. These storage
devices are used as sequential access secondary storage device.

Storage capacity of magnetic tape = data recording density * length of the tape

Data is recorded in the form of tiny non-magnetized and magnetized spots, where the presence
of a spot represents 1 and its absence represents 0. This means that data is stored in the form
of zeroes and ones.

© Oxford University Press 2016. All rights reserved.


Advantages of Magnetic Tape:
Compact in size, light in weight and can store large amounts of data.
Easily portable
Economical
Consume less power
Can be used for long term data storage and retrieval

Disadvantages of Magnetic Tape:


Data stored on the tape can be accessed only sequentially
Data on a tape is accessed at a very slow speed
A special hw is required to read the data stored on tapes
Susceptible to degradation due to heat, humidity, dust, mishandling, electromagnetic
surfaces and ordinary wear

© Oxford University Press 2016. All rights reserved.


FLOPPY DISK
Floppy disks are data storage devices that consist of a thin magnetic storage medium encased in
a square plastic shell lined with fabric.
The mechanism of a floppy disk has two motors. One motor in the drive rotates the diskette at a
regulated speed, the second motor moves the magnetic RW head,
along the surface of the disk. To read/write data on the disk media, there must be a physical
contact between the read–write head and the disk media.

© Oxford University Press 2016. All rights reserved.


Reading/Writing data on the disk
To write data on the floppy disk, current is passed through a coil in the head. The magnetic
field of the coil magnetizes spots on the disk as it rotates. The change in magnetization
encodes the digital data.
Similarly, to read data from the floppy disk, a small amount of current is induced in the head
coil to detect the magnetization on the disk. The floppy drive controller separates the data
from the stream of pulses coming from the floppy drive, decodes the data, tests for errors,
and sends the data on to the host computer system.

© Oxford University Press 2016. All rights reserved.


HARD DISK
A hard disk is a set of disks stacked together like phonograph
records, that has data recorded electromagnetically in concentric
circles also known as tracks.
A single hard disk includes several platters (or disks) that are
covered with a magnetic recording medium.

Each platter requires two read/write heads, one for each side.
Data is actually stored on the surface of a platter in sectors and tracks. While tracks are
concentric circles, sectors on the other hand are pie-shaped wedges on a track.

© Oxford University Press 2016. All rights reserved.


HARD DISK (Contd.)

A track is divided into a number of segments (also called sectors) that can store a fixed
number of bytes- for example, 256 or 512.
The performance of a hard disk depends on its access time where access time is the time
required to read or write on the disk. Access time is actually a combination of three
components:
• Seek time
• Rotational delay
• Transfer time

© Oxford University Press 2016. All rights reserved.


HARD DISK contd.

Seek time: The time taken to position the R/W head over the appropriate cylinder
(usually around 8 msec on average). Seek time varies depending on the position of the
access arm when the R/W command is received. Seek time will be maximum when the
access arm is positioned over the innermost track while the data that has to be
accessed is stored on the outermost track. Similarly, seek time will be zero if the
access arm is already positioned over the desired track. On an average, the seek time
varies from 10-100 milli-seconds.

Rotational delay: The time taken to bring the target sector to rotate under the R/W
head. Assuming that the hard disk has 7,200 rotations per minute, or 120 rotations
per second, a single rotation is done in approximately 8 msec. The average rotational
delay is around 4 msec.
© Oxford University Press 2016. All rights reserved.
HARD DISK (contd.)

Transfer time: The time to transfer data or the time taken to read/write to a disk is called
transfer rate.

Thus, the overall time required to access data = seek time + rotational delay + transfer
time.

To access data from the hard disk, a disk address has to be specified. The disk address
consist of Sector number, Track number and Surface number (when data is recorded on
both the sides of the disk)
Storage capacity of a disk with multiple recording surfaces can be calculated as:
Storage capacity = no. of recording surfaces * no. of tracks per surface * no. of sectors per track * no. of
bytes per sector

© Oxford University Press 2016. All rights reserved.


HARD DISK (contd.)

Advantages:
• Enable random access of data
• Can be often used as a shared device in a multi-user environment
• Preferred both for online and offline storage of data
• Can store large amounts of data
• The cost of data storage is very low.

Disadvantages:
• Must be stored in a dust free environment
• Magnetic disks are larger in size and heavy in weight

© Oxford University Press 2016. All rights reserved.


EXTERNAL HARD DISKS
An external hard disk is a drive that is located outside the computer case in its own
enclosure. It is used in addition to internal hard drives to store data. It has become quite
popular because of its portability and high-storage capacity.
It is connected to the computer system with a high-speed
interface cable, usually with plug-and-play interfaces
such as USB or FireWire, and may also contain a fan for
cooling.
The external hard drive can also be
connected to the computer wirelessly

External hard disks with a storage capacity of 2 TB are very common these days (1 TB = 1000
GB).

© Oxford University Press 2016. All rights reserved.


OPTICAL DRIVES

Optical storage refers to storing data on an optically readable medium by making marks in a
pattern that can be read using a beam of laser light precisely focused on a spinning disc.

An optical storage media consists of a flat, round, portable metal disc, which is usually 0.75
inches in diameter and less than one-twentieth of an inch thick.
The disc is coated with a thin metal or plastic or other material that is highly reflective.

© Oxford University Press 2016. All rights reserved.


The optical disk stores information in the form of pits and lands. The pits are the tiny
reflective bumps created with laser beam and lands are flat areas separating the pits. While
a land reflects the laser light and is read as binary digit 1, a pit on the other hand absorbs the
light and is read as binary digit 0.
Like magnetic disk, the optical disk also has tracks which are divided into sectors but shape
of these sectors is different than that of magnetic disk.

© Oxford University Press 2016. All rights reserved.


Compact Disc Read-Only-Memory (CD-ROM)
It is a type of optical disc that uses laser technology to read and write data on the disc.
The information stored on CDROM becomes permanent and cannot be altered. This
means that the stored information can only be read for processing.

Digital Video Disk or Digital Versatile Disc (DVD-ROM)


It is an extremely high capacity optical disc with storage capacity from 4.7 GB to 17 GB.
DVDs are widely used to store large databases, movies, music, complex software etc.
Most of the DVD-ROMs are double sided discs as they can store data on both the sides of
the disc.

© Oxford University Press 2016. All rights reserved.


DVDROMs have a multi-layer storage technique and smaller sized pits and tracks.
When data is recorded on a DVD, the laser starts on the inside of the disk and
moves outward. The laser beam has a smaller wavelength and can be focused on
two different layers on the disk.

Compact Disc Rewritable (CD-RW) is an erasable optical disk. The user can write
and over-write data on the CD-RW disc multiple times.

© Oxford University Press 2016. All rights reserved.


BLU-RAY DISKS
Blu-ray disk (BD) is a new optical disk developed by the Blu-ray Disc Association (BDA), which includes
leading companies such as Apple, Dell, Hitachi, HP, JVC, LG, Mitsubishi, Panasonic, Pioneer, Philips,
Samsung, Sharp, Sony, TDK, and Thomson.

Although a Blu-ray disk has the same size as that of a CD or a DVD, it can store much more data than a DVD.
A single-sided Blu-ray disk can store 25 GB of data and a dual-layer disk can store 50 GB of data.

Blu-ray disk uses a blue-violet laser, hence the name Blu-ray.

The advantage of using a blue laser with a shorter wavelength of 405 nm than the red
laser (650 nm) is that it allows it to focus the laser spot with even greater precision. This means that data
can be
packed more tightly and therefore stored in less space.
A Blu-ray disk player is backwards compatible with CDs and DVDs and can therefore play a CD or a DVD
despite the differences between the types of laser used. However, the Blu-ray disks will not play on CD and
DVD
players, because those players lack the blue-violet laser required to read the disks.

© Oxford University Press 2016. All rights reserved.


USB FLASH DRIVES
USB flash drives are removable, rewritable, and physically much smaller drives weighing
even less than 30 g.
A flash drive consists of a small printed circuit board carrying the circuit elements and a
USB connector, insulated electrically and protected inside a plastic, metal, or rubberized
case which can be carried in a pocket or on a key chain.

Advantages
• Data stored on flash drives is impervious to scratches and dust
• Mechanically very robust
• Easily portable
• Have higher data capacity than any other removable media.
• Compared to hard drives, flash drives use little power
• Flash drives are small and light-weight devices
• Flash drives can be used without installing device drivers.

© Oxford University Press 2016. All rights reserved.


FLASH DRIVES contd.

Disadvantages
•Can sustain only a limited number of write and erase cycles before the drive fails.
•Most flash drives do not have a write-protect mechanism
•Flash drives are very small devices that can easily be misplaced, left behind, or otherwise lost.
•The cost per unit of storage in a flash drive is higher than that of hard disks
•Uses of flash drives
• Personal data transport
• System administration
• Booting operating systems
• Music storage and marketing
• Brand and product promotion
• Backup

© Oxford University Press 2016. All rights reserved.


MEMORY CARDS
A small device that can store a wide range of files. They are easily portable from one place to
another
It implements flash memory to add/delete files multiple times.
Most of these cards have constantly powered nonvolatile memory
Memory cards have no moving parts therefore they are unlikely to suffer from mechanical
difficulties.
Since newer memory cards are smaller, require less power, have higher storage capacity, are
completely silent, less prone to mechanical failures, allow immediate access to data and are
portable among a greater number of devices, they are being widely used in the production of an
increasing number of small, lightweight and low-power devices.
Although memory cards are far better than hard disks, they still could not replace them because
a memory card is quite expensive.

© Oxford University Press 2016. All rights reserved.


Mass Storage Devices
• Mass storage refers to storing enormous amounts of data in a
persistent manner
• Mass storage devices can store up to several trillion bytes of data
• Have high data storage capacity, are easily portable, and have low
power consumption
• Commonly used devices are:

 Disk Array
 Automated Tape Library
 CD-ROM Jukebox

© Oxford University Press 2016. All rights reserved.


Disk Array
• Commonly known as a redundant array of independent disks
(RAID)
• Group of one or more physically independent and high-capacity
hard disk drives
• Used in place of larger, single disk drive systems
• Improve speed and increase protection against loss of data

© Oxford University Press 2016. All rights reserved.


Automated Tape Library
• One or more tape drives to store large amounts of data ranging
from 20 terabytes to more than 411 petabytes
• A cost-effective solution to the problem of storing large volumes of
data

© Oxford University Press 2016. All rights reserved.


CD-ROM Jukebox
• Also known as an optical jukebox, an optical disk library, or a
robotic drive
• Data storage device that can automatically load and unload optical
disks to provide terabytes and petabytes of tertiary storage
• Can have up to 2,000 slots for disks and usually have a robot that
traverses the slots and drives for loading the appropriate CD-ROM

© Oxford University Press 2016. All rights reserved.


Basic Processor Architecture

© Oxford University Press 2016. All rights reserved.


Registers
• A computer memory that provides quick access to the data
currently being used for processing
• ALU stores all temporary and final results in registers

• No. of general purpose registers varies from processor to


processor
• When program execution is complete, the result of processing
is transferred from accumulator to the memory through MBR

© Oxford University Press 2016. All rights reserved.


Registers
• MAR stores the address of the data or instruction to be
fetched from the main memory
• MBR stores the data or instruction fetched from the memory

• IR stores the instructions currently being executed

• I/O register is used to transfer data or instructions to or from


an I/O device
• PC stores the address of the next instruction to be executed

© Oxford University Press 2016. All rights reserved.


Instruction Cycle
• To execute an instruction, a processor follows a set of basic
operations that are together called Instruction Cycle
• Fetch: Retrieving an instruction or a data from memory

• Decode: Interpreting the instruction

• Execute: Running the corresponding commands to process data

• Store: Writing the results of processing into memory

© Oxford University Press 2016. All rights reserved.


Bus Interface

© Oxford University Press 2016. All rights reserved.


Bus Interface
• Provides functions for transferring data between the execution
unit of the CPU and other components of the computer system
that lie outside the CPU
• Puts the contents of the program counter on address bus

• Once the memory receives an address from the BIU, it places the
contents at that address on the data bus, which is then transferred
to the IR of the processor through the MBR

© Oxford University Press 2016. All rights reserved.


Instruction Set
• Set of commands that instructs the processor to perform specific
tasks
• For example, tells the processor what it needs to do, from where to
find the data, from where to find instruction, etc.
• Can be built into the hardware, or can be emulated in the software
using an interpreter

© Oxford University Press 2016. All rights reserved.


System Clock
• Controls the timing of all operations within the computer

• Synchronize various operations that take place within computer

• Measured by the number of ticks per second

• A processor can perform some operations in a single clock tick

• Faster the clock ticks, more is the number of operations that can
be performed

© Oxford University Press 2016. All rights reserved.


Pipelining
• Pipelining is a technique with which the processor can fetch the
second instruction before completing the execution of the first
instruction
• Such processors that can execute more than one instruction per
clock cycle are called superscalar processors
• With superscalar architecture, processors can execute programs
faster by replicating components such as ALUs

© Oxford University Press 2016. All rights reserved.


Parallel Processing
• In parallel processing, multiple processors can be used
simultaneously to execute a single program or task
• A complex and large task is divided into smaller tasks in such a way
that each task can be allocated to a processor

© Oxford University Press 2016. All rights reserved.


CISC Computers
• In CISC, hardware bear more responsibility than the
software so that the software can be simple and easy
• Programs can be very simple and short requiring less space
• Less effort is required by the translator to convert the
program into machine language, thus faster execution
• However, machines require additional hardware circuitry

© Oxford University Press 2016. All rights reserved.


RISC Computers

• RISC utilizes a small but highly optimized set of instructions


• Although RISC machines are less complex and less expensive,
they place extra demand on programmers to implement complex
computations by combining simple instructions

© Oxford University Press 2016. All rights reserved.

You might also like