Introduction to Computer Memory

Introduction to Computer Memory

Published by: Sujan

Published date: 18 Jun 2021

Introduction to Computer Memory -Photo

Computer Memory

 

Computer memory is any physical device capable of storing information temporarily, like RAM (random access memory), or permanently, like ROM (read-only memory). Memory devices utilize integrated circuits and are used by operating systems, software, and hardware. Memory is the storage media or device which stores data permanently or temporarily.

Memory Representation:

We store data in a computer so it is important to know how different types of data (text, integer etc.) can represent in memory.
Bits, bytes, and words:
The most fundamental unit of computer memory is the bit and it can only take one of two values: it is either 0 or 1. A collection of 8 bits is called a byte and a collection of 4 bytes, or 32 bits, is called a word.

The number of bytes and words used for an individual data value will vary depending on the storage format (OS, computer hardware) but in many cases, a single letter or character of text takes up one byte and an integer number takes up one word. A real or decimal number takes up one or two words depending on how it is stored.
For example, the text “hello” would take up 5 bytes of storage, one per character. The text “12345” would also require 5 bytes. The integer 12,345 would take up 4 bytes (1 word), as would the integers 1 and 12,345,678. The real number 123.45 would take up 4 or 8 bytes, as would the
values 0.00012345 and 12345000.0.

Binary, Octal, and Hexadecimal:
A single byte of memory that contains the letter `A' (ASCII code 65; binary 1000001).
01000001
Octal: A more convenient notation is octal, where each digit represents a value from 0 to 7. Each octal digit is the equivalent of 3 binary digits, so a byte of memory can be
represented by 3 octal digits.
Example: the binary code of character `A' splits into triplets of binary digits (from the right) like this: 01 000 001. So the octal digits are 101, commonly written 0101 to emphasize the fact that these are octal digits.

Memory is a hexadecimal form: Each digit represents a value between 0 and 16, with values greater than 9 replaced with the characters A to F. A single hexadecimal digit corresponds to 4 bits, so each
byte of memory requires only 2 hexadecimal digits. The binary form for the character `A' splits into two quadruplets: 0100 0001. The hexadecimal digits are 41

Numbers: If we use two bits together to store a number, each bit has two possible states, so there are four possible combined states and each state to represent a different number.
▪ For example, the four possible states for 2 bits are 00, 01,10, 11, and could store four numbers using two bits: 0, 1,2, and 3. This representation is called binary notation. In general, if we use k bits, each bit has two possible states, and the bits combined can represent 2k possible states, so with k bits, we could represent the numbers0,1,2 up to 2k - 1.

Integers: Integers are commonly stored using a word of memory, which is 4 bytes or 32 bits, so integers from 0 up to4,294,967,295 (232 - 1) can be stored. Below is the integers 1 to 5 stored as four-byte values (each row represents one integer).
0 : 00000001 00000000 00000000 00000000 | 1
4 : 00000010 00000000 00000000 00000000 | 2
8 : 00000011 00000000 00000000 00000000 | 3
12 : 00000100 00000000 00000000 00000000 | 4
16 : 00000101 00000000 00000000 00000000 | 5

 

Memory Hierarchy

{PHOTO}

 

Memory and its classification:

⚫ Computer memory is the generic term that is an electronic circuit to store data in a computer.

⚫ It uses different types of data storage technology including RAM, ROM, flash memory, and secondary storage.

⚫ Another way, computer memories are the non-volatile and volatile type

⚫ Non-Volatile means they can store data on a long term basis even when there is no power and volatile which are often faster but lose all the data stored on them as soon as the power is switched off.

⚫ A computer system is built using a combination of these types of computer memory, and the exact configuration can be optimized to produce the maximum data processing speed or the minimum cost, or some compromise between the two.

Types of computer memory:

Primary Memory:
⚫ Primary memory includes ROM and RAM and is located close to the CPU on the computer motherboard, enabling the CPU to read data from primary memory very quickly indeed. It is used to store data that the CPU needs imminently so that it does not have to wait for it to be delivered.

Secondary Memory:
⚫ Secondary memory by contrast, is usually physically located within a separate storage device, such as a hard disk drive or solid-state drive (SSD), which is connected to the computer system either directly or over a network. The cost per gigabyte of secondary memory is much lower, but the read and write speeds are significantly slower.

⚫With computer evolution, many computer memory types have been deployed, each with its own strengths and weaknesses.
There are two key types of primary memory:
▪ RAM = Random Access Memory
▪ ROM = Read-Only Memory

RAM Computer Memory:

⚫ RAM stems from the fact that data stored in Random Access Memory can be accessed in any random order.
⚫ RAM memory is very fast both in write and read.
⚫ It is volatile (so all data stored in RAM memory is lost when it loses power).
⚫ It is very expensive compared to all types of secondary memory in terms of cost per gigabyte.
⚫ It is because of the relatively high cost of RAM compared to secondary memory types that most computer systems use both primary and secondary memory.
⚫ Data that is required for imminent processing is moved to RAM where it can be accessed and modified very quickly, so that the CPU is not kept waiting.
⚫ When the data is no longer required it is shunted out to slower but cheaper secondary memory and the RAM space that has been freed up is filled with the next chunk of data that is about to be used.

ROM Computer Memory:

▪ ROM (read-only memory) means data can be read from this type of memory, data can not normally be written to it.
▪ It is a very fast type of computer memory that is usually installed close to the CPU on the motherboard.▪ ROM is a type of non-volatile memory, which means that the data stored in ROM
persists in the memory even when it receives no power. In that sense it is similar to secondary memory, which is used for long term storage.
▪ When a computer is turned on, the CPU can begin reading information stored in ROM without the need for drivers or other complex software to help communicate.
▪ The ROM usually contains "bootstrap code" which is the basic set of instructions a computer needs to carry out to become aware of the operating system stored in secondary memory, and to load parts of the operating system into primary memory so that it can start-up and become ready to use.
▪ ROM is also used in simpler electronic devices to store firmware which runs as soon as the device is switched on.