0% found this document useful (0 votes)
26 views68 pages

Unit 2

The document provides an overview of computer memory, detailing its types, hierarchy, and functions. It explains the differences between primary memory (RAM and ROM), secondary memory (magnetic tapes and disks), and cache memory, highlighting their characteristics and access methods. Additionally, it discusses virtual memory and its benefits in enhancing system performance and memory management.

Uploaded by

mdpradeep2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views68 pages

Unit 2

The document provides an overview of computer memory, detailing its types, hierarchy, and functions. It explains the differences between primary memory (RAM and ROM), secondary memory (magnetic tapes and disks), and cache memory, highlighting their characteristics and access methods. Additionally, it discusses virtual memory and its benefits in enhancing system performance and memory management.

Uploaded by

mdpradeep2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 68

INTRODUCTION

 The computer’s memory stores data, instructions required


during the processing of data, and output results. Storage may
be required for a limited period of time, instantly, for an
extended period of time.
 Different types of memories, each having its own unique
features, are available for use in a computer. The cache
memory, registers, and RAM are fast memories and store the
data and instructions temporarily during the processing of data
and instructions.
 The secondary memory like magnetic disks and optical disks
have large storage capacities and store the data and instructions
permanently, but are slow memory devices. The memories are
organized in the computer in a manner to achieve high levels
of performance at the minimum cost.
MEMORY
REPRESENTATION
 The computer memory stores different kinds of data
like input data, output data, intermediate results, etc.,
and the instructions.
 Binary digit or bit is the basic unit of memory. A bit
is a single binary digit, 0 or 1. A bit is the smallest
unit of representation of data in a computer.
 A group of 8 bits form a byte. One byte is the
smallest unit of data that is handled by the computer.
One byte can store 28, 256 different combinations of
bits, and thus can be used to represent 256 different
symbols.
 1 bit = 0 or 1
 1 Byte (B) = 8 bits
 1 Kilobyte (KB) = 2^10 = 1024 bytes
 1 Megabyte (MB) = 2^20 = 1024KB
 1 Gigabyte (GB) = 2^30 = 1024 MB = 1024 *1024 KB
 1 Terabyte (TB) = 2^40= 1024 GB = 1024 * 1024 *1024 KB
MEMORY HIERARCHY

 The memory is characterized on the basis of two


key factors—capacity and access time.
 Capacity is the amount of information (in bits)
that a memory can store.
 Access time is the time interval between the
read/ write request and the availability of data.
The lesser the access time, the faster is the speed
of memory. the cost of fast memory is very high.
The computer uses a hierarchy of memory that
is organized in a manner to enable the fastest
speed and largest capacity of memory.
MEMORY HIERARCHY

 1. Registers are placed inside the CPU (small


capacity, high cost, very high speed)
 2. Cache memory is placed next in the
hierarchy (inside and outside the CPU)
 3. Primary memory is placed next in the
hierarchy
 4. Secondary memory is the farthest from
CPU (large capacity, low cost, low speed)
CPU REGISTERS

 Registers are very high-speed storage areas


located inside the CPU. After CPU gets the data
and instructions from the cache or RAM, the
data and instructions are moved to the registers
for processing. Registers are manipulated
directly by the control unit of CPU during
instruction execution.
 Registers store data, instructions, addresses and
intermediate results of processing.
 Registers are often referred to as the CPU’s
working memory.
 Accumulator (ACC) stores the result of arithmetic and
logic operations.
 Instruction Register (IR) contains the current instruction
most recently fetched.
 Program Counter (PC) contains the address of next
instruction to be processed.
 Memory Address Register (MAR) contains the address of
next location in the memory to be accessed.
 Memory Buffer Register (MBR) temporarily stores data
from memory or the data to be sent to memory.
 Data Register (DR) stores the operands and any other
data.
PRIMARY MEMORY
 Primary memory is the main memory of computer. It is a chip
mounted on the motherboard of computer. Primary memory is
categorized into two main types-
 Random Access Memory (RAM)
 Read Only Memory (ROM)
 RAM is used for the temporary storage of input data, output
data and intermediate results. The input data entered into the
computer using the input device, is stored in RAM for
processing. After processing, the output data is stored in
RAM before being sent to the output device. Any
intermediate results generated during the processing of
program are also stored in RAM.
 Unlike RAM, the data once stored in ROM either cannot be
changed or can only be changed using some special
operations. Therefore, ROM is used to store the data that does
not require a change.
Random Access Memory
 RAM provides random access to the stored bytes,
words, or larger data units. This means that it
requires same amount of time to access information
from RAM, irrespective of where it is located in it.
RAM can be read from and written to with the same
speed.
 The size of RAM is limited due to its high cost. The
size of RAM is measured in MB or GB.
The performance of RAM is affected by—
 Access speed (how quickly information can be
retrieved). The speed of RAM is expressed in
nanoseconds.
 Data transfer unit size (how much information can be
retrieved in one request).
RAM affects the speed and power of a computer. More the
RAM, the better it is.
 RAM is a microchip implemented using semiconductors.
There are two categories of RAM, depending on the
technology used to construct a RAM— (1) Dynamic RAM
(DRAM), and (2) Static RAM (SRAM).
Dynamic

RAM (DRAM)
DRAM is mostly used as main memory since it is small and
cheap.
 It uses transistors and capacitors. The transistors are arranged
in a matrix of rows and columns.
 The capacitor holds the bit of information 0 and 1. The
transistor and capacitor are paired to make a memory cell.
 The transistor acts as a switch that lets the control circuitry on
the memory chip read the capacitor or change its state.
 DRAM must be refreshed continually to store information. a
memory controller is used.
 DRAM gets its name from the refresh operation that it requires
to store the information, otherwise it will lose what it is
holding.
 The refresh operation occurs automatically thousands of times
per second. DRAM is slow because the refreshing takes time.
 Access speed of DRAM ranges from 50 to 150 ns.
Static RAM (SRAM)
 SRAM chip is usually used in cache memory due to its
high speed.
 SRAM uses multiple transistors (four to six), for each
memory cell. It does not have a capacitor in each cell.
 A SRAM memory cell has more parts so it takes more
space on a chip than DRAM cell.
 It does not need constant refreshing and therefore is
faster than DRAM.
 SRAM is more expensive than DRAM, and it takes up
more space.
 It stores information as long as it is supplied with
power.
 SRAM are easier to use and very fast. The access speed
of SRAM ranges from 2–10 nanosecond.
Read Only Memory
 ROM is a non-volatile primary memory. It does not lose its
content when the power is switched off.
 The features of ROM are described as follows—
 ROM, as the name implies, has only read capability and no
write capability. After the information is stored in ROM, it is
permanent and cannot be corrected.
 ROM comes programmed by the manufacturer. It stores
standard processing programs that permanently reside in the
computer.
 ROM stores the data needed for the start up of the computer.
The instructions that are required for initializing the devices
attached to a computer are stored in ROM.
 The ROM memory chip stores the Basic Input Output System
(BIOS). BIOS provides the processor with the information
required to boot the system.
 BIOS is a permanent part of the computer. It does not load
from disk but instead is stored in a ROM memory chip.
 ROMs are of different kinds. They vary in the number of
re-writes and the method used for the re-writing.
 Programmable ROM (PROM),
 Erasable Programmable ROM (EPROM)
 Electrically Erasable Programmable ROM (EEPROM)
are some of the ROMs.
 PROM can be programmed with a special tool, but after
it has been programmed the contents cannot be changed.
PROM memories have thousands of fuses (or diodes).
High voltage (12 V) is applied to the fuses to be burnt.
The burnt fuses correspond to 0 and the others to 1.
 EPROM can be programmed in a similar way as PROM,
but it can be erased by exposing it to ultra violet light and
re-programmed. EPROM chips have to be removed from
the computer for re-writing.
 EEPROM memories can be erased by electric charge
and re-programmed. EEPROM chips do not have to be
removed from the computer for re-writing.
SECONDARY MEMORY

 ACCESS TYPES OF STORAGE DEVICES


 The information stored in storage devices can be accessed in
two ways—
1. Sequential access 2. Direct access
 Sequential access means that computer must run through the
data in sequence, starting from the beginning, in order to
locate a particular piece of data. Magnetic tape is an example
of sequential access device.
 Direct access devices are the ones in which any piece of data
can be retrieved in a non-sequential manner by locating it
using the data’s address. It accesses the data directly, from a
desired location.
CACHE MEMORY
 Cache memory is placed in between the CPU and
the RAM.
 Cache memory is a fast memory, faster than the
RAM.
 When the CPU needs an instruction or data during
processing, it first looks in the cache. If the
information is present in the cache, it is called a
cache hit, and the data or instruction is retrieved
from the cache. If the information is not present in
cache, then it is called a cache miss and the
information is then retrieved from RAM.
Virtual memory
 Virtual memory is the feature of an
operating system (OS). It is responsible for
memory management.
 In the Virtual Memory the Physical Memory (Hard
Disk) will be treated as the Logical Memory
( (RAM)).
 Means with the help of virtual Memory we can also
temporarily increase the size of Logical Memory as
from the Physical Memory.
 A user will see or feels that all the Programs are
running into the Logical Memory of the Computer.
With the help of virtual Memory all the Space of
Hard Disk can be used as the Logical Memory So
that a user can execute any Number of programs.
Benefits of Virtual
Memory
 Unused Address space: With the help of Unused
Address Space a user can execute any number of
programs because all the actual Addresses will be
treated as the logical Addresses.
 Increased degree of Multiprogramming: With
the help of Virtual Memory we can Execute Many
Programs at a Time because Many Programs can be fit
in the Physical Memory .
 Decrease Number of I/O Operations: There
will be less Operations those are to be used for
performing the Swapping of the Processes.
Secondary Storage
Devices
MAGNETIC TAPE
 Magnetic tape is a plastic tape with magnetic
coating. It is a storage medium on a large open
reel or in a smaller cartridge or cassette (like a
music cassette).
 Magnetic tapes are cheaper storage media. They
are durable, can be written, erased, and re-
written.
 Magnetic tapes are sequential access devices,
which mean that the tape needs to rewind or
move forward to the location where the
requested data is positioned in the magnetic
tape.
 The working of magnetic tape is explained as follows—
 Magnetic tape is divided horizontally into tracks (7 or 9)
and vertically into frames.
 A frame stores one byte of data, and a track in a frame
stores one bit.
 Data is stored in successive frames as a string with one data
(byte) per frame.
 Data is recorded on tape in the form of blocks, where a
block consists of a group of data also called as records.
Each block is read continually.
 Magnetic tape is mounted on a magnetic tape drive for
access. The basic magnetic tape drive mechanism consists
of the supply reel, take-up reel, and the read/write head
assembly.
Features of magnetic tape

 Inexpensive storage device


 Can store a large amount of data
 Easy to carry or transport
 Not suitable for random access data
 Slow access device
 Needs dust prevention, as dust can harm the
tape
 Suitable for back-up storage or archiving
MAGNETIC DISK
 Magnetic disk is a direct access secondary storage device.
 It is a thin plastic or metallic circular plate coated with
magnetic oxide and encased in a protective cover.
 Data is stored on magnetic disks as magnetized spots.
 The presence of a magnetic spot represents the bit 1 and its
absence represents the bit 0.
 The working of magnetic disk is explained as follows—
 The surface of disk is divided into concentric circles known
as tracks.
 The outermost track is numbered 0 and the innermost track
is the last track.
 Tracks are further divided into sectors. A sector is a pie
slice that cuts across all tracks. The data on disk is stored in
sector. Sector is the smallest unit that can be read or written
on a disk. A disk has eight or more sectors per track.
 Magnetic disk is inserted
into a magnetic disk drive
for access. The drive consists
of a read/write head that is
attached to a disk arm, which
moves the head. The disk
arm can move inward and
outward on the disk.
 Accessing data on the disk requires the following—
 The read/write head is positioned to the desired track
where the data is to be read from or written to.
 The time taken to move the read/write head to the
desired track is called the seek time.
 Once the read/write head is at the right track, then the
head waits for right sector to come under it (disk is
moving at high speed).
 The time taken for desired sector of the track to come
under read/write head is called the latency time.
 Once the read/write head is positioned at
the right track and sector, the data has to
be written to disk or read from disk.
 The rate at which data is written to disk
or read from disk is called data transfer
rate.
 The sum of seek time, latency time and
time for data transfer is the access time of
the disk.
Features of magnetic disk

 Cheap storage device


 Can store a large amount of data
 Easy to carry or transport
 Suitable for frequently read/write data
 Fast access device
 More reliable storage device
 To be prevented from dust, as the read/write head flies
over the disk. Any dust particle in between can corrupt
the disk
Floppy Disk
 Floppy disk (FD) is a flat, round, single disk made of Mylar
plastic and enclosed in square plastic jacket .
 Floppy Disk Drive (FDD) is the disk drive for floppy disk.
 The floppy disk is inserted into the floppy disk drive to read or
write data to it.
 Floppy disk has a write-protect slide tab that prevents a user from
writing to it.
 A floppy disk may be single-sided or double-sided disk, data can
be read and written on one and both sides of floppy disk,
respectively.
 They are portable. They can be removed from the disk drive,
carried or stored separately.
 They are small and inexpensive.
 Floppy disks are slower to access than hard disk. They have less
storage capacity and are less expensive than hard disk
 8-inch:The first floppy disk design, invented by IBM in the
late 1960s and used in the early 1970s as first a read-only
format and then as a read-write format. The typical
desktop/laptop computer does not use the 8-inch floppy disk.
 5¼-inch: The common size for PCs made before 1987 and
the predecessor to the 8-inch floppy disk. This type of floppy
is generally capable of storing between 100K and 1.2MB (
megabytes) of data. The most common sizes are 360K and
1.2MB.
 3½-inch: Floppy is something of a misnomer for these disks,
as they are encased in a rigid envelope. Despite their small
size, microfloppies have a larger storage capacity than their
cousins -- from 400K to 1.4MB of data. The most common
sizes for PCs are 720K (double-density) and 1.44MB (
high-density). Macintoshes support disks of 400K, 800K, and
1.2MB
Hard Disk
 Zip Disk :-A Zip disk was an advanced
version of the floppy disk developed by
Iomega.
 The disk needed a special drive called the
Zip drive in order to be used.
 Zip disks were available in 100- and 250-
MB capacities and were used to store.
 Zip disks were PC and Mac compatible.
They were usually used as secondary
storage devices. Zip disks had faster data
transfer rates and faster seek times than
floppy disks.
Zip Disk
Disk Pack
 A Disk pack is a layered grouping of
hard disk platters (circular, rigid discs coated with
a magnetic data storage surface).
 A disk pack is the core component of a hard
disk drive. In modern hard disks, the disk pack is
permanently sealed inside the drive. the disk pack
was a removable unit, and would be supplied with a
protective canister featuring a lifting handle.
 The protective cover consisted of two parts, a plastic
shell, with a handle in the center, that enclosed the
top and sides of the disks and a separate bottom
that completed the sealed package. To remove the
disk pack, the drive would be taken off line and
allowed to spin down.
Disk Pack
Winchester disk drive
 Introduced by IBM in 1973 as the model 3340,
the Winchester disk drive is a hard drive with 30 MB
of fixed and 30 MB of removable storage, thus
earning its nickname after the Winchester 30-30 rifle.
 The disks of featured a 30 millisecond access
time and a coating of lubrication that allowed the
heads to remain in contact with the surface when
rotation speed was increased or decreased. this
became the standard for mechanical hard drive
development.
 Before the Winchester architecture, removable disks
were like removable disks today, in which the
read/write heads remain in the drive and make
contact with the platter after the cartridge is inserted.
Winchester disk
Hard Disk

 A Hard disk (HD) consists of one or more platters


divided into concentric tracks and sectors. It is mounted
on a central spindle, like a stack. It can be read by a
read/write head that pivots across the rotating disks.
The data is stored on the platters covered with magnetic
coating.
 Hard disk can store much more data than floppy disk.
The data in hard disk are packed more closely (because
fast spinning uses smaller magnetic charges) and they
have multiple platters.
 Hard disk can spin at the speed of up to 10,000
revolutions per minute and have an access time of 9—
14 ms.
Hard Drive Types

 Currently, we can group hard drives into four


types:
 Parallel Advanced Technology Attachment (PATA)
 Serial ATA (SATA)
 Small Computer System Interface (SCSI)
 Solid State Drives (SSD)
 Hard disks are available that can store up to 500 GB of
data.
 Hard disk is the key secondary storage device of
computer. The operating system is stored on the hard
disk. The performance of computer like speed of
computer boot up.
 Nowadays, portable external hard disk drive is
available which can be attached to the USB drive of the
computer.
OPTICAL DISK
 Optical disk is a flat and circular disk which is coated with
reflective plastic material that can be altered by laser light.
 An optical disk consists of a single spiral track that starts
from the edge to the centre of disk. Due to its spiral shape, it
can access large amount of data sequentially.
 The tracks on optical disk are further divided into sectors
which are of same length. the sectors near the centre of disk
wrap around the disk longer than the sectors on the edges of
disk.
 Optical disks can store large amount of data, up to 6 GB, in a
small space. Commonly used optical disks store 600–700 MB
of data. The access time for an optical disk ranges from 100 to
200 ms.
1.CD-ROM.
2. DVD-ROM.
 Compact Disk (CD) was a popular medium for storing
music. Now, it is used in computers to store data and is
called Compact Disk-Read Only Memory (CD-ROM).
 A CD-ROM drive reads data from the compact disk.
Data is stored as pits and lands on CD-ROM disk.
When the laser light is focused on the disk.
 As CD-ROM is read only, no changes can be made into
the data contained in it.
2.DVD-ROM.
 Digital Video Disk-Read Only Memory (DVD-ROM)
is an optical storage device used to store digital video
or computer data.
 Each side of DVD-ROM can store 4.7 GB of data, so a
single DVD can store 9.4 GB of data.
 It improves on CD technology.
 It is a high-density medium with increased track and bit
density.
3. Recordable Optical Disk
 Compact Disk-Recordable (CD-R) is a Write Once-
Read Many (WORM) disk. A CD-R disk allows the
user to write data permanently on to the disk.
 Compact Disk-Re Writable (CD-RW) allows data to be
written, erased and re-written on. The capacity of CD-
RW is same as a CD.
 Digital Video Disk-Recordable (DVD-R) The data once
written on a DVD cannot be erased or changed.
Flash Memory

 Flash Memory is a kind of semiconductor-based non-


volatile, rewritable computer memory that can be
electrically erased and reprogrammed. It is a specific
type of EEPROM.
 It combines the features of RAM and ROM. It is a
random access memory and its content can be stored in
it at any time.
 Flash memories are high-speed memories, durable, and
have low-energy consumption. Since flash memory has
no moving part
Memory storage Device
 Flash drive
 Memory Card
Flash drives have many names — jump drives, thumb drives,
pen drives, and USB keychain drives. they all refer to the same
thing, which is a small data storage device that uses flash
memory and has a built-in USB connection. Early flash drives
could store only a few megabytes of data, but modern flash
drives can store several gigabytes of information. Since they are
small in size but have large storage capacities, flash drives have
replaced most previous portable data storage mediums such
as floppy disks and removable hard disks like Zip disks.
Because they have a built-in USB connection, flash drives also
don't require a special disk drive to be used. , they can be used
on any computer with a USB port.
Pen Drive
 A pen drive, or a USB flash drive, is a portable data-
storage device. Pen drives have replaced the floppy
drives of old and have become the most popular
data-storage devices among consumers. Micro,
lightweight and handy, a pen drive can be easily
carried from place to place by students,
professionals, academicians and independent tech
consultants. Currently available pen drives with
storage capacities ranging from 8GB and 32GB can
be used to store graphics-heavy documents, photos,
music files.
Secure Digital card
 A Secure Digital card (SD card) is a non-
volatile form of flash memory for portable and
mobile devices. Because it is not proprietary,
SD card usage is widespread. SD cards are
located in thousands of consumer electronic
device models, including mobile phones, digital
cameras, camcorders, tablets and portable audio
players.
 Micro SD (15 mm × 11 mm)
 Mini SD (21.5 mm × 20 mm)
 SD (32 mm × 24 mm)
PROGRAMMING
LANGUAGES
 A programming language is a means of communication
for the user to communicate with the computer system.
The programming language is a set of instructions which
tells the computer what to do. This is a language which is
understood by both man and machine. There are a number
of programming languages. However all these languages
are designed to perform at least certain basic instructions
and operations; These instructions and operations are :
 Input/output operations,
 Arithmetic operations - mathematical operations like
addition, subtraction.
 Logical operations - Comparison for equality, inequality
 Movement of instructions and data to and from the CPU.
Types of programming
languages
a) Machine Language
b) Assembly Language
c) High Level Language
Machine Language:

 This is the only language which is understood by the


computer. This is the language nearest to the machine.
 In this language the programs are written in binary code
i.e. the instructions are made only by a combination of
binary digits 0 and 1. Machine language may vary from
machine to machine depending upon the computer
architecture.
 Machine languages execute the fastest since they are
immediately understood by the computer.
 No translation of the programs is required. Also they
make efficient use of primary memory. But it is very
difficult to program in this binary or machine language.
Assembly Language:
 The Os and 1 s of the machine language were substituted by
letters and symbols in assembly languages.
 The assembly languages use mnemonics (memory aid) in place
of operation codes.
 The language uses symbols instead of numbers to write
programs. A program written using such symbols in the
assembly language is called the source program.
 The program written in assembly language has to be converted
into machine language for use by the computer. This is
achieved with the help of the assembler.
 The assembler is a system program which is supplied by the
manufacturer. It converts the assembly program into a machine
readable program and the resulting program is called the
object program.
 Thus the input to the assembler is the source program and the
output of the assembler is the object program. The assembler
translates each assembly language instruction into a
corresponding machine code.
High Level Languages :
 Higher level languages make use of English like words and
statements and mathematical symbols for instructions. Higher
level languages make programming easier, since they are
relatively easy to learn.
 Less time is required to write programs in high level languages.
The programmer is not required to know the detailed working of
the computer system in order to program in a high level language.
 They are machine independent. Higher level languages are also
known as problem oriented languages. However a high level
language is not directly understood by the computer.
 It is required to be translated into machine language. Therefore
they generally execute more slowly and require more memory
than the same program written in assembly language.
 The programs which are used to translate programs written in
high level language into machine language are known as
translators.
The types of translators are:
I) Compiler
II) Interpreter
Compiler:
 The compiler translates the entire source program into machine
language program at once. The source code remains intact.
 Once a program is compiled it can be run as many times as required,
without being required to be recompiled.
 A compiler can translate only those programs which have been
written in the language for which it is designed. Also each machine
has to have its own compiler.
 A compiler is a program which normally resides on the secondary
storage device. It gets loaded into the CPU when the source program
is to be translated.
 A compiler checks for errors like illegal symbols, statements etc.
during compilation and gives out a list of error messages at the end of
execution. This is a very valuable aid to the programmer to correct
the programs.
 The compiler is incapable of detecting any logical errors in the
program.
Interpreter:
 The interpreter is the program which translates a
high level language program into machine
language as follows :
- it takes one statement from the high level
language program
- translates it into a machine instruction and the
instruction is immediately executed.
Since the program is translated statement by
statement, the machine level program of the source
program is not stored anywhere in memory.
 Linker
 Linker is a program that links several object
modules and libraries to a single executable
program. A source code of a program is often very
large consisting of several hundred or more lines.
The source code may also include reference to
libraries.
 Loader
 The loader software is used to load and re-
locate the executable program in the main
memory. Software has to be loaded into
the main memory during execution. Loader
assigns storage space to the program in
the main memory for execution

You might also like