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

Unit-3 Memory Unit

Primary memory, also called main memory, is directly accessible by the CPU and is usually volatile. It is used to store instructions and data currently being processed. Secondary memory, also called auxiliary or external memory, is not directly accessible by the CPU and is non-volatile. It is used for permanent storage of data and includes storage devices like hard disks, solid state drives, CDs, DVDs, and tapes. Secondary memory has a larger storage capacity than primary memory but is slower to access.

Uploaded by

Nageshwar Yadav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
219 views

Unit-3 Memory Unit

Primary memory, also called main memory, is directly accessible by the CPU and is usually volatile. It is used to store instructions and data currently being processed. Secondary memory, also called auxiliary or external memory, is not directly accessible by the CPU and is non-volatile. It is used for permanent storage of data and includes storage devices like hard disks, solid state drives, CDs, DVDs, and tapes. Secondary memory has a larger storage capacity than primary memory but is slower to access.

Uploaded by

Nageshwar Yadav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Unit -3 Memory Unit

Difference between Primary Memory and Secondary Memory:

BASIS FOR
PRIMARY MEMORY SECONDARY MEMORY
COMPARISON

Basic Primary memory is directly accessible by Secondary memory is not directly accessible

Processor/CPU. by CPU.

Altered Name Main memory. Auxiliary memory.

Data Instructions or data to be currently executed Data to be permanently stored is kept in

are copied to main memory. secondary memory.

Volatility Primary memory is usually volatile. Secondary memory is non-volatile.

Formation Primary memories are made of Secondary memories are made of magnetic

semiconductors. and optical material.

Access Speed Accessing data from primary memory is Accessing data from secondary memory is

faster. slower.

Access Primary memory is accessed by the data Secondary memory is accessed by input-

bus. output channels.

Size The computer has a small primary memory. The computer has a larger secondary

memory.

Expense Primary memory is costlier than Seondary Secondary Memory is cheaper than primary

Examples RAM, ROM, Cache memory Hard Disk, Magnetic tape, CD, DVD

Computer organization and Architecture


Difference Between Static RAM and Dynamic RAM:

 Static RAM consumes more power because of low chip density whereas
Dynamic RAM consumes less power because of simple circuitry.

Secondary Memory:
Secondary memory is computer memory that is non-volatile and persistent in
nature and is not directly accessed by a computer/processor. It allows a user to
store data that may be instantly and easily retrieved, transported and used by
applications and services. Secondary memory is also known as secondary
storage. Secondary memory consists of all permanent or persistent storage
devices, such as read-only memory (ROM), flash drives, hard disk drives (HDD),
magnetic tapes and other types of internal/external storage media.

Computer organization and Architecture


Q. What are the different secondary storage devices ? Elaborate on any
one of the devices.
Ans: Here are some list of secondary storage devices:
a. Magnetic Tape
b. Magnetic Disk (Hard Disk)
c. Optical Disk (CD, DVD, CD-ROM, Blur-Ray DVD, DVD RW)
d. RAID
e. Magneto-Optical Disk
f. USB Disks
g. Floppy Disk

Magnetic tape:
• Tapes are used for recording and storing data for computer processing. It is
plastic reel similar to long lengths of movie film. A tape is usually ½” wide and
2400 feet in length and it is coated with particles of ferric oxide on which data can
be recorded magnetically.
• The process of reading and writing of data is carried out on a device called Tape
Drive and the records on magnetic tape are stored in sequential order. For
example: if the payroll file is to be stored on a magnetic tape, the records would
likely to be stored in the sequence of employee numbers. Hence, magnetic tapes
are referred to as sequential access device.
Magnetic disk:
• Magnetic disk is another type of secondary storage device known as random
(direct) access as it permits direct accessing of data. An individual disk is a circular
metal plate coated on both side by ferrous oxide material.
• Data is recorded in the form of magnetized spots on the tracks of the disk, a
spot representing the presence by “1” and its absence by “0” enabling
representing of data in binary form.
• The surface of the magnetic disk is divided into number of invisible concentric
circles called “tracks” and these tracks are further subdivided into “sectors”,

Computer organization and Architecture


“blocks” etc. each its own unique addresses to facilitate the location of data and
the Disk moves on a vertical rotating spindle.
• Reading /writing on the disks is accomplished by means of series of read/write
heads which are placed close to the surfaces of the disks.
• It is good to know that data on the magnetic disk can be accessed again and
again. It can also be recorded erasing the older information.

Magneto-Optical Disk:
A magneto-optical disk is a rewritable disk that makes use of both magnetic
disk and optical technologies. It is similar to a magnetic diskette except for its
larger size. Magneto-optical disks are seldom manufactured and used due to the
advent of flash drives and DVD/CD drives, which are less expensive and have
better writing time and reliability.
Magneto-optical disks are also known as magneto-optical drives and MO
drives. One of the most well-known examples of a magneto-optical disk is the
Sony MiniDisc.
The magneto-optical disk has the following features:
 It is capable of having high data intensity by means of a magnetic read/write
head and a laser.
 Like diskettes, the magneto-optical disk allows multiple rewrites.
 The driver for a magneto-optical disk can verify the information written to
the disk and will report any errors to the operating system. This often results
in faster reading but slower writing, although it helps make data storage
more reliable.
 The magneto-optical disk is a special removable disk.
 The design of the drive allows the inserted disk to be exposed to the
magnetic head on one side and to the laser on the other side.
 Its writing speed is faster than that of diskettes, but is slower than that of
CD/DVD drives.
 Convenience and reliability are much better than those of diskettes, along
with high data capacity.

Computer organization and Architecture


Floppy Disks:
These are also called as flexible disks. These are used in the smallest micro
computer systems as well as mini computers. Floppy disks have higher storage
capacity and offer direct access capability. The floppy disk is permanently sealed in
a plastic coated jacket and the whole package is inserted the floppy drive for data
recording and retrieval.
The jacket of the disk has a small slot to permit the read/write head to
contact the disk. They are 5.25 inch (or) 3.5 inch in diameter. They come in single
and double density and recorded on one or both surface of the diskette. The
capacity of a 5.25 inch floppy is 1.2 mega bytes whereas for 3.5 inch floppy it is
1.44 mega bytes.
It is cheaper than that of any other secondary storage devices and is
portable too. The floppy is a low-cost device particularly suitable for personal
computer system. Once data has been recorded, a floppy disk reader can be used
to enter data into CPU. Again, the disk is loaded and rotated at a constant speed
inside its envelope. Tiny magnetic heads in the disk reader access data through
the slot in the jacket.

Differences Between Magnetic disk and Optical disk:

1. The magnetic disk is a fixed storage device whereas optical disk is


transportable storage media which is removable.
2. Optical disk generates better signal-to-noise ratio as compared to magnetic
disk.
3. The sample rate used in the magnetic disk is lower than used in the optical
disk.
4. In the optical disk, the data is sequentially accessed. In contrast, the data in
the magnetic disk is randomly accessed.
5. Tracks in the magnetic disk are generally circular while in optical disk the
tracks are constructed spirally.
6. Optical disk allows mass replication. On the contrary, in the magnetic disk,
only one disk is accessed at a time.
7. The access time of the magnetic disk is lesser than the optical disk.

Computer organization and Architecture


Definition of Virtual Memory

Virtual memory is not exactly a physical memory of a computer instead it’s


a technique that allows the execution of a large program that
may not becompletely placed in the main memory. It enables the
programmer to execute the programs larger than the main memory.

Now let us understand how does the virtual memory works? The program
has its virtual memory address which is divided into a number of pages. The main
memory is also divided into a number of pages. Now, as we can see the virtual
address of a program is larger than the available main memory. So memory map
is used to map the virtual address to the main memory.

Page 0, 1, 2, gets mapped in main memory and the main memory fills up. Now,
when page 3 of virtual memory asks for space in main memory, the oldest placed
page i.e. page 0 get transferred to the hard disk and evacuates the place for page
3, in main memory and the process goes on. In case the page 0 is again needed,
then again the oldest placed page at that time is transferred to hard disk making
the place for page 0.

Computer organization and Architecture


If the two programs need same data, placed in main memory, the memory
mapping unit allows both the programs to share the same address space in main
memory where the shared data is stored. This makes sharing of files easy.

The benefits of virtual memory are:


 The programs are no longer constrained by the limit of main memory.
 Virtual memory increases the degree of multiprogramming.
 Increases CPU utilization.
 The less I/O unit will require to load or to swap programs in the memory.

Computer organization and Architecture


But there is a drawback of virtual memory, placing more pages of a program in
hard disk will slow down the performance as accessing the data from hard disk
takes more time in comparison to accessing data from main memory.

Definition of Cache Memory:


Unlike virtual memory, Cache is a storage device implemented on
the processor itself. It carries the copies of original data that has been accessed
recently. The original data may be placed in the main memory or a secondary
memory. The cache memory fastens the accessing speed of data, but how? Let’s
understand.

We can say that the accessing speed of CPU is limited to the accessing speed
of main memory. Whenever a program is to be executed by the processor, it
fetches it from main memory. If a copy of the program is already present in
the cache implemented on the processor. The process would be able to access
that data faster which will result in faster execution.

Similarities between Virtual Memory and Cache Memory

Computer organization and Architecture


Difference between cache and virtual memory:

BASIS FOR
VIRTUAL MEMORY CACHED MEMORY
COMPARISON

Basic Virtual memory extends the Cache memory fastens the data

capacity of main memory for accessing speed of CPU.

the user.

Nature Virtual memory is technique. Cache memory is a storage unit.

Function Virtual memory allows execution Cache memory stores the copies of

of the program that is larger original data that has been recently

than the main memory. used.

Memory Virtual memory is managed by Cache memory is fully managed by

management the operating system. the hardware.

Size Virtual memory is far larger than Cache memory has bounded size.

cached memory.

Mapping Virtual memory requires No mapping structures are required

mapping structures to map as such in a cache memory.

virtual address to physical

address.

Computer organization and Architecture


BASIS FOR
VIRTUAL MEMORY CACHED MEMORY
COMPARISON

1. What is logical and physical address? Discuss physical and virtual


memory?
Ans: Definition of Logical Address
Address generated by CPU while a program is running is referred as Logical
Address. The logical address is virtual as it does not exist physically. Hence, it is
also called as Virtual Address. This address is used as a reference to access the
physical memory location. The set of all logical addresses generated by a
programs perspective is called Logical Address Space.
The logical address is mapped to its corresponding physical address by a
hardware device called Memory-Management Unit. The address-binding
methods used by MMU generates identical logical and physical address
during compile time and load time. However, while run-time the address-
binding methods generate different logical and physical address.

Definition of Physical Address


Physical Address identifies a physical location in a memory. MMU
(Memory-Management Unit) computes the physical address for the
corresponding logical address. MMU also uses logical address computing physical
address. The user never deals with the physical address. Instead, the physical
address is accessed by its corresponding logical address by the user. The user
program generates the logical address and thinks that the program is running in
this logical address. But the program needs physical memory for its execution.
Hence, the logical address must be mapped to the physical address before they
are used.

Computer organization and Architecture


The logical address is mapped to the physical address using a hardware
called Memory-Management Unit. The set of all physical addresses
corresponding to the logical addresses in a Logical address space is
called Physical Address Space.

Key Differences Between Logical and Physical Address in OS

1. The basic difference between Logical and physical address is that Logical address is
generated by CPU in perspective of a program. On the other hand, the physical
address is a location that exists in the memory unit.
2. The set of all logical addresses generated by CPU for a program is called Logical
Address Space. However, the set of all physical address mapped to corresponding
logical addresses is referred as Physical Address Space.
3. The logical address is also called virtual address as the logical address does not exist
physically in the memory unit. The physical address is a location in the memory unit
that can be accessed physically.
4. Identical logical address and physical address are generated by Compile-time and
Load time address binding methods.
5. The logical and physical address generated while run-time address binding method
differs from each other.
6. The logical address is generated by the CPU while program is running whereas, the
physical addres is computed by the MMU (Memory Management Unit).

Virtual memory is a memory management capability of an OS that uses


hardware and software to allow a computer to compensate for physical memory
shortages by temporarily transferring data from random access memory (RAM)
to disk storage. Virtual address space is increased using active memory in RAM
and inactive memory in hard disk drives (HDDs) to form contiguous addresses that
hold both the application and its data.

Computer organization and Architecture


Physical memory allocates information in a "first in, last out" process. The
information is placed on the stack. Virtual memory uses a process called paging.
These pages are laid across the hard drive in fixed sizes.
Physical memory is the actual real memory used in RAM. Virtual memory as
the name suggests is not real. The OS uses virtual memory as a memory
management technique in which non-contiguous memory is presented to software
as contiguous memory. If the RAM falls short of memory to accommodate more
running processes, the OS allocates a portion of your hard drive to act as though it
were RAM. That's what is referred to as virtual memory.
Physical memory is the only memory that is directly accessible to the CPU.
CPU reads the instructions stored in the physical memory and executes them
continuously. The data that is operated will also be stored in physical memory in
uniform manner.
Virtual memory is one classification of memory which was created by using the
hard disk for simulating additional RAM, the addressable space available for the
user. Virtual addresses are mapped into real addresses.
Physical memory is limited to the size of the RAM chips installed in the
computer. Virtual memory is limited by the size of the hard drive, so virtual
memory has the capability for more storage.

2. Explain how the virtual address is converted into real address in a


paged virtual memory system.
3. How many memory chips are needed to construct 2 M × 16 memory
system using 512 K × 8 static memory chips ?
4. What do you mean by associative memory page table in virtual
memory ?
5. What is the difference between cache and virtual memory ?
6. Explain the design principles of memory hierarchy.

Translation Look Aside Buffer (TLB):

Computer organization and Architecture


The CPU's memory management unit (MMU) stores a cache of recently used
mappings from the operating system's page table. This is called the translation
lookaside buffer (TLB), which is an associative cache.
When a virtual address needs to be translated into a physical address, the
TLB is searched first. If a match is found (a TLB hit), the physical address is
returned and memory access can continue. However, if there is no match (called
a TLB miss), the memory management unit, or the operating system TLB miss
handler, will typically look up the address mapping in the page table to see
whether a mapping exists (a page walk). If one exists, it is written back to the TLB
(this must be done, as the hardware accesses memory through the TLB in a virtual
memory system), and the faulting instruction is restarted (this may happen in
parallel as well). This subsequent translation will find a TLB hit, and the memory
access will continue.

Actions taken upon a virtual to physical address translation. Each translation is restarted if a TLB miss
occurs, so that the lookup can occur correctly through hardware.

Note: Tanenbaum suggests that ``associative memory'' and ``translation lookaside buffer''
are synonyms. This is wrong. Associative memory is a general structure and translation
lookaside buffer is a special case.

An associative memory is a content addressable memory. That is you access the memory by
giving the value of some field and the hardware searches all the records and returns the
record whose field contains the requested value.

Computer organization and Architecture


For example
Name | Animal | Mood | Color
======+========+==========+======
Moris | Cat | Finicky | Grey
Fido | Dog | Friendly | Black
Izzy | Iguana | Quiet | Brown
Bud | Frog | Smashed | Green

If the index field is Animal and Iguana is given, the associative memory returns
Izzy | Iguana | Quiet | Brown

A Translation Lookaside Buffer or TLB is an associate memory where the index field is
the page number. The other fields include the frame number, dirty bit, valid bit, and others.
 A TLB is small and expensive but at least it is fast. When the page number is in the
TLB, the frame number is returned very quickly.
 On a miss, the page number is looked up in the page table. The record found is placed
in the TLB and a victim is discarded. There is no placement question since all entries
are accessed at the same time. But there is a replacement question.

Computer organization and Architecture

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy