0% found this document useful (0 votes)
5 views11 pages

Coa Unit 4

Uploaded by

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

Coa Unit 4

Uploaded by

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

1 CTH EDUCATION

Unit – 04 : Memory Organization


 Characteristics of Memory system,
 Types of memories,
 Main memory, Secondary memory,
 Static & Dynamic memories
 Performance considerations,
 Cache memory with mapping,
 Virtual memory,
 Address memory used pages,
 Page replacement,
 Introduction to RAID.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
2 CTH EDUCATION
What is memory ?
 A memory is the storage space within the computer.
 It is the most important part of the computer.
 It is the storage space within the computer where data & instruction is to be processed.
 It is used to store data and instructions after processing when required.

Characteristics of Memory system


 The characteristics of a memory are the features that belong to them.
 Some of the most important characteristics are given below :
 Location :
 External or
 Internal
 Storage :
 Data can be stored temporarly or permanently.
 Capacity :
 Capacity is a measure of amount of data the memory device can store.
 It is measured in bytes or words.
 Access Method :
 Direct Access Method
 Sequential Access Method
 Random Access Method
 Transfer Rate :
 This is the rate at which data is transmitted into and out of memory.
 Access Time:
 The time required to carry-out read or write operation.
 Volatile :
 Data is vanishes when computer is powered off.
 Non-volatile :
 Data does not vanishes when computer is powered off.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
3 CTH EDUCATION
Types of Memory :
1) Register memory
2) Cache memory
3) Primary memory
4) Secondary memory

Register :
 Register memory is the smallest and fastest memory in a computer.
 It holds operands or instruction that CPU is currently processing.
 It is a combination of flip-flops and has the ability to store data larger than a single bit.
 It is located on the CPU.
 Maximum available size of register is 64 bits.

Cache Memory
 Cache memory is a very high speed semiconductor memory.
 It acts as a buffer between the CPU and main memory.
 It is used to hold those parts of data and program which are most frequently used by CPU.
 It stores the program that can be executed within a short period of time.
 It stores data for temporary use.

Primary Memory
 Primary memory holds only those data and instructions on which computer is currently
working.
 It is also known as main memory or working memory of computer.
 It is generally made up of semiconductor device.
 These memories are faster than secondary but not as fast as registers.
 The data and instruction required to be processed reside in main memory.
 A computer cannot run without primary memory.
 There are two types of primary memory RAM and ROM.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
4 CTH EDUCATION
RAM ROM
RAM is a form of data storage that can be ROM is also a form of data storage that can not
accessed randomly at any time. be easily altered or reprogrammed.

It is also known as R/W Memory. It is also known as Read-only memory.

It allows reading and writing. It only allows reading.

RAM is volatile i.e. its contents are lost It is non-volatile i.e. its contents are retained
when the device is powered off. even when the device is powered off.

The two main types of RAM are static RAM The types of ROM include PROM, EPROM and
and dynamic RAM. EEPROM.

Secondary Memory
 In secondary memory programs and data are stored permanently.
 This type of memory is also known as auxiliary memory or external memory.
 Secondary memory is slower than primary memory & has large capacity.
 It is not directly accessible through CPU and is non-volatile.
For example :
 HDD,
 SSD,
 Magnetic tapes,
 DVD, CD, Pendrive, Memory Chip etc.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
5 CTH EDUCATION
Primary memory Secondary memory

Primary memory is temporary. Secondary memory is permanent.

Primary memory is directly accessible by Secondary memory is not directly


Processor/CPU. accessible by the CPU.

Nature of Parts of Primary memory varies,


RAM-volatile in nature & ROM-Non-volatile It’s always Non-volatile in nature.

Secondary memory devices are less


Primary memory devices are more expensive expensive

Primary memory is also known as Main Secondary memory is also known as


memory or Internal memory. External memory or Auxiliary memory.

Examples: RAM, ROM, Cache memory, Examples: Hard Disk, Floppy Disk,
PROM, EPROM, Registers, etc. Magnetic Tapes, etc.

Static Memory Dynamic memory

Allocation of memory performs at compile Allocation of memory performs at run time.


time.

All the data element stored in the sequential All the data element stored in random
manner. manner.

We fix the size of memory before compilation. We fix the size of memory at the run time .

Wastage of memory. Nominal wastage of memory.

Static is more efficient than dynamic. Dynamic is less efficient than static.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
6 CTH EDUCATION
Cache memory with mapping :
Cache Memory :
 It is a very high-speed memory.
 It is used to speed up and synchronizing with high-speed CPU.
 Cache memory is costlier than main memory or disk memory.
 It acts as a buffer between RAM and the CPU.
 It holds frequently requested data and instructions so that they are immediately available to
the CPU when needed.

Cache Mapping:
 There are three different types of mapping :
1. Direct mapping,
2. Associative mapping, and
3. Set-Associative mapping.

Direct Mapping :
 The simplest technique, known as direct mapping.
 Maps each block of main memory into only one possible cache line.
 An address space is split into two parts index field and a tag field.
 The cache is used to store the tag field whereas the rest is stored in the main memory.
 Direct mapping performance is directly proportional to the Hit ratio.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
7 CTH EDUCATION
Associative Mapping :
 It is used to store content and addresses of the memory word.
 Any block can go into any line of the cache.
 This means that the word id bits are used to identify which word in the block is needed.
 This enables the placement of any word at any place in the cache memory.
 It is considered to be the fastest and the most flexible mapping form.

Set-associative Mapping :
 This mapping is an enhanced form of direct mapping where the drawbacks of direct mapping
are removed.
 Set associative cache mapping combines the best of direct and associative cache mapping
techniques.
 A block in memory can map to any one of the lines of a specific set.
 Set-associative mapping allows that each word is present in the cache can have two or more
words in the main memory for the same index address.

Virtual Memory
 Virtual memor is a feature of an operating system.
 It is a storage scheme that provides user an illusion of having a very big main memory.
 This is done by treating a part of secondary memory as the main memory.
 By doing this, the degree of multiprogramming will be increased and therefore, the CPU
utilization will also be increased.

Introduction to RAID :
 RAID stands for “Redundant Arrays of Independent Disks”.
 It is a collection of disks/drives.
 It is a technique which makes use of a combination of multiple disks for increased performance
 The term was introduced by David Patterson in 1987.
 There are two types of RAID :
1. Software RAID
2. Hardware RAID

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
8 CTH EDUCATION
Performance of Memory :
 The performance of memory is divided into three parts.
 Access Time :
 It represents the total time taken by memory devices to perform a read or write
operation.
 Memory Cycle Time :
 Total time required to access memory block and additional required time before starting
second access.
 Transfer rate:
 It describes the transfer rate of data used to transmit memory to or from an external or
internal memory device.

Page replacement
 It is a process of swapping out an existing page from the frame of a main memory and
replacing it with the required page.
 Page replacement algorithms help to decide which page must be swapped out from the main
memory.
 Various page replacement algorithms are :
1. FIFO Page Replacement Algorithm
2. LRU Page Replacement Algorithm
3. Optimal Page Replacement Algorithm

Note : A good page replacement algorithm is one that minimizes the number of page faults.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
9 CTH EDUCATION
FIFO Page Replacement Algorithm :
 This algorithm works on the principle of “First in First out“.
 It replaces the oldest page that has been present in the main memory for the longest time.

Problem-01: A system uses 3 page frames for storing process pages in main memory. It uses
the FIFO page replacement policy. Assume that all the page frames are initially empty. What is
the total number of page faults that will occur while processing the page reference string given
below-
4 , 7, 6, 1, 7, 6, 1, 2, 7, 2
Also calculate the hit ratio and miss ratio.
Solution :
Total number of references = 10

Total number of page faults occurred = 6


Calculating Hit ratio :
Total number of page hits = Total number of references – Total number of page faults
= 10 – 6 = 4
Hit ratio = Total number of page hits / Total number of references
= 4 / 10
= 0.4 or 40%

Calculating Miss ratio :


Miss ratio = 1 – Hit ratio
= 1 – 0.4
= 0.6 or 60%

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
10 CTH EDUCATION
Optimal Page Replacement Algorithm :
 This algorithm replaces the page that will not be referred by the CPU in future for the longest
time.
 It is the best known algorithm and gives the least number of page faults.
 It is practically impossible to implement this algorithm.

Problem-02 : A system uses 3 page frames for storing process pages in main memory. It uses
the Optimal page replacement policy. Assume that all the page frames are initially empty. What is
the total number of page faults that will occur while processing the page reference string given
below-
4 , 7, 6, 1, 7, 6, 1, 2, 7, 2
Also calculate the hit ratio and miss ratio.
Solution : Total number of references = 10

Total number of page faults occurred = 5


 Hit ratio = 0.5 or 50%
 Miss ratio = 0.5 or 50%

LRU Page Replacement Algorithm :


 This algorithm works on the principle of “Least Recently Used“.
 It replaces the page that has not been referred by the CPU for the longest time.

Problem-03 : A system uses 3 page frames for storing process pages in main memory. It uses
the LRU page replacement policy. Assume that all the page frames are initially empty. What is
the total number of page faults that will occur while processing the page reference string given
below-
4 , 7, 6, 1, 7, 6, 1, 2, 7, 2
Also calculate the hit ratio and miss ratio.

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)
11 CTH EDUCATION
Solution :
Total number of references = 10

Total number of page faults occurred = 6

In the similar manner as above-


 Hit ratio = 0.4 or 40%
 Miss ratio = 0.6 or 60%

Diploma : CSE (All Paper) By : Alok Sir (Mob. No.: +91-80 84 370 470)

You might also like