Unit-3 Memory Unit
Unit-3 Memory Unit
BASIS FOR
PRIMARY MEMORY SECONDARY MEMORY
COMPARISON
Basic Primary memory is directly accessible by Secondary memory is not directly accessible
Processor/CPU. by CPU.
Formation Primary memories are made of Secondary memories are made of magnetic
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-
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
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.
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”,
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.
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.
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.
BASIS FOR
VIRTUAL MEMORY CACHED MEMORY
COMPARISON
Basic Virtual memory extends the Cache memory fastens the data
the user.
Function Virtual memory allows execution Cache memory stores the copies of
of the program that is larger original data that has been recently
Size Virtual memory is far larger than Cache memory has bounded size.
cached memory.
address.
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).
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.
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.