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

memory in c

The document provides an overview of computer memory, categorizing it into primary memory (RAM and ROM) and secondary memory (HDDs, SSDs, optical discs, and magnetic tapes). It explains the characteristics and types of RAM (SRAM and DRAM) and ROM (PROM, EPROM, EEPROM, MROM), as well as the memory hierarchy that optimizes system performance. Additionally, it details the role of registers and cache memory in enhancing CPU efficiency.

Uploaded by

crisnasoby9c
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)
14 views

memory in c

The document provides an overview of computer memory, categorizing it into primary memory (RAM and ROM) and secondary memory (HDDs, SSDs, optical discs, and magnetic tapes). It explains the characteristics and types of RAM (SRAM and DRAM) and ROM (PROM, EPROM, EEPROM, MROM), as well as the memory hierarchy that optimizes system performance. Additionally, it details the role of registers and cache memory in enhancing CPU efficiency.

Uploaded by

crisnasoby9c
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

MEMORY

●​ It is a data storage unit or a data storage device where data is to be processed


and instructions required for processing are stored.
●​ It can store both the input and output .

Primary Memory

• It is also known as the main memory of the computer system. It is used to store
data and programs or instructions during computer operations. It uses
semiconductor technology and hence is commonly called semiconductor memory.
Primary memory is of two types:
• RAM (Random Access Memory)
• ROM (Read Only Memory)
RAM (Random Access Memory):

• The most common type of memory is called random access memory (RAM). As
a result, the term memory is typically used to mean RAM..
•This is a circuit which have its separate space or slot in motherboard. RAM holds
data and program instructions while the CPU works with them.
• When a program is launched, it is loaded into and run from memory. As the
program needs data, it is loaded into memory for fast access.
• As new data is entered into the computer, it is also stored in memory but only
temporarily.
• RAM is volatile, meaning that it loses its contents when the computer is shut off
or if there is a
power failure. Therefore, RAM needs a constant supply of power to hold its data..
RAM is of two types:

• S RAM (Static RAM):


• This memory consists of the number of flip flops with each flip flop storing 1 bit.
It has less access time and hence, it is faster.• SRAM stores data using flip-flops,
which are circuits made up of multiple transistors. Each bit of data requires a
separate flip-flop.
• SRAM is faster than DRAM because it does not need to be refreshed
and can provide immediate access to stored data.
• Requires less power than dynamic RAM but is much more expensive.
• Used for CPU cache memory

• D RAM (Dynamic RAM): D RAM uses capacitors and transistors and stores the
data as a charge on the capacitors.They contain thousands of memory cells. • Each
bit of data is stored in a single capacitor, and the charge can leak away over time.•
Needs to be refreshed thousands of times per second. It needs refreshing of charge
on the capacitor after a few milliseconds. • DRAM works slower than SRAM.
Mostly used because it is much
cheaper than SRAM and requires less space.
• Eg DDR1,DDR2,DDR3,etc..

ROM(Read-Only Memory)

• Unlike RAM, Read-only memory (ROM) permanently stores its data, even when
the computer is shut off.
• ROM is called nonvolatile memory because it never loses its contents.
• Whenever the computer's power is turned on, it checks ROM for directions that
help it start up, and for information about its hardware devices.
• ROM is used to store information that is used to operate the system. As its name
refers to read-only memory, we can only read the programs and data that is stored
on it.
• The information stored in the ROM in binary format. It is also known as
permanent memory.
ROM is used to store permanent or semi-permanent data, such as firmware or
software that doesn't change often.
ROM is of four types:
• PROM (Programmable Read Only Memory): This read-only memory is
modifiable once by the
user. The user purchases a blank PROM and uses a PROM program to put the
required contents into the PROM. Its content can’t be erased once written.
• EPROM (Erasable Programmable Read Only Memory): EPROM is an extension
to PROM
where you can erase the content of ROM by exposing it to Ultraviolet rays for
nearly 40 minutes.Often used in applications where data might need to be updated,
but not very frequently (e.g., in embedded systems or early computer BIOS).
• EEPROM (Electrically Erasable Programmable Read Only Memory): Here the
written
contents can be erased electrically. You can delete and reprogramme EEPROM up
to 10,000 times.
• Erasing and programming take very little time, i.e., nearly 4 -10
ms(milliseconds). Any area in an EEPROM can be wiped and programmed
selectively.It can be rewritten multiple times, but
not as quickly as regular RAM.
• Used in situations where small amounts of data need to be stored or updated, like
in microcontrollers, configuration settings, and some types of firmware.
• MROM(Masked ROM): Hard-wired devices with a pre-programmed collection
of data or
instructions were the first ROMs. Masked ROMs are a type of low-cost ROM that
works in this
way.
Secondary Memory

• It is also known as auxiliary memory and backup memory. It is a non-volatile


memory and used to store a large amount of data or information.
• The data or information stored in secondary memory is permanent, and it is
slower than primary memory.
• A CPU cannot access secondary memory directly. The data/information from the
auxiliary memory is first transferred to the main memory, and then the CPU can
access it.
• Secondary memory is non-volatile, meaning it retains data even when the power
is turned off.
• Examples of secondary memory include:
• Hard Disk Drives (HDDs)
• Solid-State Drives (SSDs)
• Optical Discs (CDs, DVDs)
• Magnetic Tapes
There are two methods for accessing the data from secondary memory
1. Sequential – This is the method in which we search the data sequentially or line
by line until you find the desired data. E.g.. Magnetic tape, etc.
2. Direct – This is the method in which computer can go directly to the
information that the user wants. e.g. magnetic disk, optical disk, etc.
Magnetic Disk:
• Magnetic Disk refers to storage devices that store data using magnetization
on a rotating disk. Data is written or read by a read/write head.
• Examples:
• Hard Disk Drives (HDDs): These are the most common magnetic disks used for
secondary storage in computers. They have large storage capacities and relatively
slow read/write speeds compared to modern SSDs.
• Floppy Disks: Older, portable magnetic disks with much smaller storage capacity
(obsolete today).
Advantages:
• Large storage capacity.
• Non-volatile, meaning data is retained without power.
Disadvantages:
• Slower access speeds than SSD’s.
• More susceptible to physical damage due to moving parts.
Magnetic Tape:
• Magnetic Tape is a type of secondary storage that stores data in a
sequential manner using a magnetic coating on a long strip of plastic tape.
• It is mainly used for backup, archival, and storage of large amounts of data
in enterprises and data centers due to its cost-effectiveness and high capacity.
Advantages:
• Very high storage capacity at a low cost.
• Good for long-term storage of data.
Disadvantages:
• Data access is slower because it's sequential (you must read through the
tape to get to the desired data).
• Limited random access capabilities.
Optical Storage Devices
• Uses laser light to read and write data on optical discs such as CDs, DVDs, and
Blu-ray discs.
• Data is stored in the form of tiny pits and lands (reflective and non-reflective
areas) on the surface of the disc.
Examples:
• CDs (Compact Discs): Used for music, software, and data storage. Limited
storage capacity (700 MB).
• DVDs (Digital Versatile Discs): Offer higher storage capacity (4.7 GB for a
single layer, 9.4 GB for dual layer)
• Blu-ray Discs: Used for high-definition video and large data storage (25 GB to
100 GB per disc).
Advantages:
• Durable and portable.
• Non-volatile storage with good data integrity.
Disadvantages:
• Slower data access compared to hard drives or SSDs.More prone to scratches and
damage if not properly stored
Memory Hierarchy
• refers to the structured arrangement of different types of memory in a
computer system, organized based on their speed, size, cost, and proximity to the
processor.
• The primary goal of the memory hierarchy is to optimize the system's
performance by providing faster access to frequently used data(locality of
reference) while balancing cost and capacity.
• In a typical memory hierarchy, faster and smaller memory types are placed
closer to the processor, while slower and larger memory types are placed further
away.
• This hierarchy helps improve overall system performance, as the processor
can quickly access small, fast memory when needed, while less frequently
used data can reside in slower, larger memory.

Registers: Registers are small, high-speed memory units located in the CPU. They
are used to store the most frequently used data and instructions. Registers have the
fastest access time and the smallest storage capacity, typically ranging from 16 to
64 bits.
Cache Memory: A small, fast memory located between the CPU and main memory
(RAM) that stores frequently accessed data or instructions.
Main Memory: Random Access Memory (RAM) is the primary memory used by
the computer to store data and instructions that are currently in use. Provides fast,
temporary storage for running programs and data.
Magnetic Disks: A magnetic disk is a secondary storage device that uses rotating
platters coated with magnetic material to store data. It provides long-term storage
for data.
Optical Disk (CD, DVD, Blu-ray): Optical disks use laser technology to read and
write data on the surface of discs like CDs, DVDs, and Blu-ray discs. Used for
media storage, software distribution, and data backup.
Magnetic Tape: Magnetic tape is a sequential storage medium that stores data on a
long strip of plastic tape coated with magnetic material.Used primarily for backup
and archival purposes due to its large storage capacity.
Registers
• CPU registers are small, high-speed storage units inside the CPU that allow quick
access to data, instructions, and memory addresses during program execution.
They are faster than other memory types, like RAM, and play a crucial role in
enhancing the performance of the computer by providing immediate access to
necessary information.
Important Registers in a CPU:
Program Counter (PC):Stores the address of the next instruction to be executed. It
helps the CPU know where to fetch the next instruction from in memory.
Accumulator Register (A):Often used in arithmetic and logic operations. For
example, in a CPU, when adding two numbers, the result is typically stored in the
accumulator.
Instruction Register (IR):Holds the instruction that is currently being executed.
After fetching an instruction from memory, it is loaded into the IR for decoding
and execution
Stack Pointer (SP):Points to the current top of the stack. The stack is used for
function calls, local variables, and returning to previous states in the program.
Memory Address Register (MAR):Holds the address in memory where data is to
be fetched or written.Used to specify the memory location during read or write
operations.
Memory Data Register (MDR):Holds the data that is being transferred to or
from memory.
Cache Memory

• Extremely fast memory type that is placed between main memory and the CPU.
• Holds frequently requested data and instructions, ensuring that they are
immediately available to the CPU when needed.
• Whenever the CPU needs to access memory for a data/ instruction , it first checks
the cache memory. If the data is not found in cache
memory, then the CPU checks into the main memory.
• Costlier than main memory or disk memory but more economical than CPU
registers.
• Used to speed up processing and synchronize with the high-speed CPU.

Cache memory is divided into different levels based on proximity to the CPU and
size.
L1 Cache: The smallest and fastest cache, located directly inside the CPU, stores
the most frequently used data and instructions
L2 Cache: Larger and slower than L1, it stores data that isn't in the L1 cache but is
still needed frequently, located either inside or near the CPU.
L3 Cache: The largest and slowest cache, shared between multiple CPU cores,
provides additional storage for data that supports multi-core processing.
Characteristics of Memory Hierarchy
• Capacity: It is the global volume of information the memory can store. As we
move from top to bottom in the Hierarchy, the capacity increases.
• Access Time: It is the time interval between the read/write request and the
availability of the data.As we move from top to bottom in the Hierarchy, the access
time increases.
• Performance: One of the most significant ways to increase system performance is
minimizing how far down the memory hierarchy one has to go to manipulate data.
• Cost Per Bit: As we move from bottom to top in the Hierarchy, the cost per bit
increases i.e. Internal Memory is costlier than External Memory.

You might also like