Computer memory is a temporary storage area. It holds the data and instructions that the Central Processing Unit (CPU) needs. Before a program can run, the program is loaded from storage into the memory. This allows the CPU direct access to the computer program. Memory is needed in all computers.

A computer is usually a binary digital electronics device. Binary means it has only two states. On or Off. Zero or One. In a binary digital computer transistors are used to switch the electricity on and off. The computer's memory is made from lots of transistors. 

Each on/off setting in the computer's memory is called a binary digit or bit. A group of eight bits is called a byte. A byte is made from two nibbles of four bits each. Computer scientists made up the words bit and byte. The word bit is short for binary digit. It takes bi from binary and adds the t from digit. A collection of bits was called a bite. The computer scientists changed the spelling to byte to avoid confusion. When the computer scientists needed a word for half a byte, they thought nibble, as in half a bite, would be a fun word to choose.

Characters in memory
A byte of memory is used to store a code to represent a character such as a number, a letter or a symbol. Eight bits can store 256 different codes. This was thought enough and a byte became fixed at eight bits. 
This allows the ten decimal digits, 26 lower-case letters, 26 upper-case letters and many symbols. 
Early computers used six bits to a byte. This gave them 64 different codes. These computers did not have lower-case letters. 

Computer scientists had to agree on which code would represent each character. Most modern computers use ASCII, the American Standard Code for Information Interchange. In ASCII each code is eight bits – any combination of 0s and 1s – and form one character. The letter A is denoted by the code 01000001.

To allow for all the different characters in all the worlds languages, modern computers need more than 256 different characters. Another code system called Unicode allows for 1,112,064 different characters by using from one to four bytes for each character.

Memory address
The computer's CPU can access each individual byte. It uses an address for each byte. Computer memory addresses start at zero and go up to the biggest number the computer can use. Older computers were limited in how much memory they could address. 32-bit computers can address up to 4GB of memory. Modern computers use 64 bits and could address up to 18,446,744,073,709,551,616 bytes = 16 exabytes of memory.

The numbers that computers use can get very large. To make it easier, the unit K (for kilobyte) or Ki (for kibibyte) can be used. In computer memory numbers are powers of two. One Kibibyte is two to the power of 10, that is 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 and written as 210 = 1024 bytes. For example, 64 Kibibytes, written as 64KiB or 64KB, of memory is the same as 65,536 bytes (1,024 × 64 = 65,536). For larger memory capacities, the units megabyte (MB) or mebibyte (MiB) and gigabyte (GB) or gibibyte (GiB) are used. One megabyte of computer memory means 220 bytes or 1024KB, which is 1,048,576 bytes. One gibibyte means 230 bytes or 1024MB. 

The numbers are multiples of two. This is why a kilobyte of memory is 1024 bytes and not 1000 as would be the case for kilogram. To try to avoid this confusion the International Electrotechnical Commission (IEC) use the names kibibyte, mebibyte, and gibibyte for binary powers. They use kilobyte, megabyte, and gigabyte to mean powers of 10. The Joint Electron Device Engineering Council (JEDEC) have kept the older names. To make it worse the sizes of computer storage, such as hard disk drives (HDD), are measured in powers of ten. So a 500GB disk drive is 500 x 1000 x 1000 x 1000 bytes. This is a lot less that 500GB of memory which is 500 x 1024 x 1024 x1024. Most computer scientists still use the old names and have to remember that the units are different when talking about memory and storage devices.

Read only memory  
There are some programs and instructions which the computer will always need. Read only memory (ROM) is the permanent memory which is used to store these important control programs and systems software to perform functions such as booting up or starting up programs. ROM is non-volatile. That means the contents are not lost when the power is switched off. Its contents are written when the computer is built, but in modern computers, the user can change the contents using special software.

Random access memory 
Random access memory (RAM) is used as the working memory of a computer system.  It stores input data, intermediate results, programs, and other information temporarily.  It can be read and/or written.  It is usually volatile, which means that all data will be lost when the power is turned off. In most cases it is loaded again from the hard disk which is used as data storage.

Non-volatile memory 

Non-volatile memory is computer memory that keeps the stored information when not powered.
Examples of non-volatile memory include:
 read-only memory 
 flash memory

It can sometimes refer to computer storage. These are always non-volatile. 
Examples inlcude:
 Solid state devices that use flash memory, like Solid State Drives (SSD) and USB flash drives.
 Magnetic computer storage devices like hard disk drives (HDD), floppy disks and magnetic tape
 optical discs such as CD-ROM, DVD-ROM and Blu-ray
 paper storage such as paper tape and punched cards

References