Introduction
Memory is essential in computer science for storing and accessing data. From the moment you turn on your device to the daily tasks you perform, various types of memory collaborate to ensure smooth operation. Let's look at the different types of computer memory and their functions.
We can classify memory into two broad categories: primary memory and secondary memory.
Primary Memory
- Primary Memory, also known as main memory, stores data and instructions for processing. Logically,it is an integral component of the CPU but physically, it is a separate part placed on the computer’s motherboard (also known as main board). Primary memory can be further classified into random access memory (RAM) and read only memory (ROM).
Random Access Memory
- Random access memory is like the computer’s scratch pad. It allows the computer to store data for immediate manipulation and to keep track of what is currently being processed. It is the place in a computer where the operating system, application programs, and data in current use are kept so that they can be accessed quickly by the computer’s processor.
- RAM is much faster to read from and write to than the other kinds of storage in a computer like the hard disk or floppy disk. However, the data in RAM stays there only as long as the computer is running. When the computer is turned off, RAM loses all its contents. When the computer is turned on again, the operating system and other files are once again loaded into RAM.
- When an application program is started, the computer loads it into RAM and does all the processing there. This allows the computer to run the application faster. Any new information that is created is kept in RAM and since RAM is volatile in nature, one needs to continuously save the new information to the hard disk.
- Let us take a simple example of why RAM is used by the computer. Whenever a user enters a command from the keyboard, the CPU interprets the command and instructs the hard disk to ‘load’ the command or program into main memory. Once the data is loaded into memory, the CPU is able to access it much quickly.
- The reason behind this is that the main memory is much faster than secondary memory.The process of putting things the CPU needs in a single place from where it can get them more quickly is similar to placing various documents,which the user needs,into a single file folder.By doing so,the user finds all the required files handy and avoids searching in several places every time he needs them.
- Random access memory is also called read/write memory because, unlike read only memory (ROM) that does not allow any write operation, random access memory allows CPU to read as well as write data and instructions.
Read Only Memory (ROM)
- Just as a human being needs instructions from the brain to perform actions in certain event, a computer also needs special instructions every time it is started.
- This is required because during the start-up operation, the main memory of the computer is empty due to its volatile property so there has to be some instructions (special boot programs) stored in a special chip that could enable the computer system to perform start-up operations and transfer the control to the operating system.
- This special chip, where the start up instructions are stored, is called ROM. It is non-volatile in nature,that is, its contents are not lost when the power is switched off. The data and instructions stored in ROM can only be read and used but cannot be altered thereby making ROM much safer and secure than RAM.
- ROM chips are used not only in the computer but also in other electronic items like washing machine and microwave oven.
- Generally, designers program ROM chips at the time of manufacturing circuits. Burning appropriate electronic fuses to form patterns of binary information does programming. These patterns of binary information are meant for specific configurations, that is why different categories of computers are meant for performing different tasks.
- For example, a micro program called system boot program contains a series of start-up instructions to check for the hardware, that is, I/O devices, memory, and operating system in the memory. These programs deal with low-level machine functions and are alternate for additional hardware requirement. ROM performs the necessary BIOS (Basic Input Output System) function to start the system and then transfers the control over to the operating system.
- ROM can have data and instructions written into it only one time. Once a ROM chip is programmed,it cannot be reprogrammed or rewritten.If it is erroneous, or the data needs to be reorganised, one has to replace it with the new chip.Thus,the programming of ROM chips should be perfect having all the required data at the time of its manufacturing.
- Note that in some instances, ROM can be changed using certain tools. For example, flash ROM (a type of ROM) is non-volatile memory that occasionally can be changed such as when a BIOS chip must be updated. The ROM chips can consume very little power, are extremely reliable, and in case of most small electronic devices, contain all the necessary programming to control the device.
Secondary Memory
- Secondary Memory, also known as auxiliary or external memory is used for storing instructions (software programs) and data, since main memory is temporary and limited in size. This memory is least expensive and has much larger storage capacity than primary memory. Instructions and data stored on such storage devices are permanent in nature. It can be removed only if the user wants or if the device is destroyed.
Floppy Disk
- A floppy disk is a round, flat piece of Mylar plastic coated with ferric oxide (a rust like substance containing tiny particles capable of holding a magnetic field) and encased in a protective plastic cover (disk jacket).
- It is a removable disk and is read and written by a floppy disk drive (FDD), which is a device that performs the basic operation on a disk, including rotating the disk and reading and writing data onto it. The disk drive’s read/write head alters the magnetic orientation of the particles, where orientation in one-direction represents ‘1’ and orientation in the other represents ‘0’.
- Traditionally, floppy disks were used on personal computers to distribute software, transfer data between computers, and create small backups. Earlier, 5¼-inch floppy disks were used. Later, a new format of 3½-inch floppy disk came into existence, which has larger storage capacity and supports faster data transfer as compared to 5¼-inch floppy disks.
- Floppy diskettes are small, inexpensive, readily available, easy to store, and have a good shelf life if stored properly. They also possess the write-protect feature, which allows the users to protect a diskette from being written on. To write-protect a diskette, the user has to shift a slide lever towards the edge of the disk, uncovering a hole. The key advantage of floppy disk is that it is portable.
Read/write Operation of a Floppy Disk
- To read and write data onto a floppy disk, floppy disk drive is used. The drive is made up of a box with a slot (having a drive gate) into which user inserts the disk. When user inserts a disk into the floppy disk drive, the drive grabs the disk and spins it inside its plastic jacket. Also the drive has multiple levers that get attached to the disk.
- One lever opens the metal plate, or shutter, to expose the data access area. Other levers and gears move two read/write heads until they almost touch the diskette on both sides. The drive’s circuit board receives instructions for reading/writing the data from/to disk through the floppy drive controller. If the data is to be written onto the disk, the circuit board first verifies that no light is visible through a small window in the floppy disk.
- If the photo sensor on the opposite side of the floppy disk detects a beam of light, the floppy drive detects disk to be write-protected and does not allow recording of data.The circuit board translates the instructions into signals that control the movement of the disk and the read/write heads. A motor located beneath the disk spins a shaft that engages a notch on the hub of the disk, causing the disk to spin. When the heads are in the correct position, electrical impulses create a magnetic field in one of the heads to write data to either the top or bottom surface of the disk. Similarly,on reading the data, electrical signals are sent to the computer from the corresponding magnetic field generated by the metallic particle on the disk.
- Since the floppy disk head touches the diskette, both media and head wear out quickly. To reduce wear and tear, personal computers retract the heads and stop the rotation when a drive is not reading or writing. Consequently, when the next read or write command is given, there is a delay of about half a second while the motor gathers maximum speed.
Hard Disk
- The hard disk, also called the hard drive or fixed disk, is the primary storage unit of the computer.It consists of a stack of disk platters that are made up of aluminium alloy or glass substrate coated with a magnetic material and protective layers. They are tightly sealed to prevent any dust particle, which causes head crash, from getting inside. Hard disk can be external (removable) or internal (fixed) and can hold a large amount of data.
- The capacity that is the amount of information that a hard disk can store is measured in bytes. A typical computer today comes with 80-320 GB of hard disk. The storage capacity of hard disk has increased dramatically since the day it was introduced. The hard disk speed is measured in terms of access time (typically in milliseconds). A hard disk with lower access time is faster than a hard disk with higher access time; the lower the access time, the faster the hard disk.
Read/write Operation of a Hard Disk
- A hard disk uses round, flat disks (platters) made up of glass or metals which are coated on both sides with a special material designed to store information in the form of magnetic patterns. Each platter has its information recorded in tracks, which are further broken down into smaller sectors. Making a hole in the centre of platters and stacking them onto a spindle mount the platters.
- The platters rotate at high speed, driven by a special motor connected to the spindle. Special electromagnetic read/write heads are mounted onto sliders and are used to either record data onto the disk or read data from it. The sliders are mounted onto arms, all of which are mechanically connected into a single assembly and positioned over the surface of the disk by a device called actuator. Each platter has two heads, one on the top of the platter and one on the bottom, so a hard disk with three platters would have six surfaces and six heads.
- Data is recorded onto the magnetic surface of the disk in exactly the same way as it is on floppies.However, a disk controller is attached to the hard disk drive that handles the read/write commands issued by the operating system. Each read/write command specifies a disk address that comprises the surface number, track number, and sector number. With this information, the read/write head moves to the desired sector and data can be read from or written to. Usually, the next set of data to be read is sequentially located on the disk.
- Note that unlike floppy drives, in which the read/write heads actually touch the surface of the material, the heads in most hard disks float slightly off the surface. Nevertheless, the distance between the head and the disk surface is much less compared to the thickness of a human hair. When the heads accidentally touch the media, either because the drive is dropped or bumped hard or because of an electrical malfunction, the surface becomes scratched.
- Any data stored where the head has touched the disk is lost.This is called a head crash. To help reduce the possibility of a head crash, most disk controllers park the heads over an unused track on the disk when the drive is not being used by the CPU.
Magnetic Tape
- Magnetic tape appears similar to the tape used in music cassettes. It is a plastic tape with magnetic coating on it. The data is stored in the form of tiny segments of magnetized and demagnetized portions on the surface of the material. Magnetized portion of the surface refers to the bit value ‘1’ whereas the demagnetized portion refers to the bit value ‘0’. Magnetic tapes are available in different sizes, but the major difference between different magnetic tape units is the speed at which the tape is moved past the read/write head and the tape’s recording density. The amount of data or the number of binary digits that can be stored on a linear inch of tape is the recording density of the tape.
- Magnetic tapes are very durable and can be erased as well as reused. They are the cheap and reliable storage medium for organizing archives and taking backups. However, they are not suitable for data files that need to be revised or updated often because data on them is stored in a sequential manner. Every time the user needs to advance or rewind the tape to the position where the requested data starts. Tapes are also slow due to the nature of the media.
- If the tape stretches too much, then it will render it unusable for data storage and may result in data loss. The tape now has a limited role because disk has proved to be a superior storage medium than it. Today, the primary role of the tape drive is limited to backing up or duplicating the data stored on the hard disk to protect the system against loss of data during power failures or computer malfunctions.
Magnetic Tape Organisation
- The magnetic tape is divided into vertical columns (frames) and horizontal rows (channels or tracks).The data is stored in a string of frames with one character per frame and each frame spans multiple tracks (usually 7 or 9 tracks). Thus, a single bit is stored in each track, that is, one byte per frame.
- The remaining track (7th or 9th) stores the parity bit. When a byte is written to the tape, the number of 1s in the byte is counted, the parity bit is then used to make number of 1s even (even parity) or odd (odd parity).When the tape is read again, the parity bit is checked to see if any bit has been lost. In case of odd parity,there must be an odd number of 1s represented for each character and an even number of 1s in case of even parity.
- Magnetic tape drive uses two reels,supply reel and take-up reel. Both reels are mounted on the hubs and the tape moves from the supply reel to the take-up reel.The magnetic oxide coated side of the tape passes directly over the read/write head assembly, thus making contact with the heads.As the tape passes under the read/write head,the data can be either read and transferred to the primary memory or read from primary memory and written onto the tape.
- A magnetic tape is physically marked to indicate the location from where reading and writing on tape is to begin (BOT or beginning of tape) and end (EOT or end of tape). The length of tape between BOT and EOT is referred to as the usable recording (reading/writing) surface. BOT/EOT markers are usually made up of short silver strips of reflective type.These markers are sensed by an arrangement of lamps and/or photodiode sensors to indicate the location from where reading and writing is to begin and end. On a magnetic tape, data is recorded in form of blocks where each block consists of a grouping of data (known as records) that is written or read in a continual manner.
- Between these blocks, the computer automatically reserves some blank space called inter-block gap (IBG). One block may contain one or more records that are again separated by blank space (usually 0.5 inch) known as inter-record gap (IRG). In case of reading data from a moving tape, whenever an IRG is reached, the moving tape is stopped. It remains in immobile motion until the record is processed.
Conclusion
To improve system performance and meet particular computing needs, it is necessary to understand the various types of computer memory. Whether it's for long-term storage, quick processing, or improving system responsiveness, each kind has a specific function in the data storage and retrieval process. Computer systems can provide dependable and effective performance for a variety of tasks and applications by utilizing the appropriate mix of memory types.