# 1. Memory

## 1.1. Objectives

• To have an understanding about the meaning terms such as gigabytes, megabytes, etc.
• To have an understanding of the relationship between these terms and computer-related terminology encountered in everyday life.

## 1.2. Motivation

In scientific computing, the two biggest constraints on the types of problems that you can solve are

1. how much memory is needed and
2. how fast a computation can be performed.

## 1.3. Types of Memory

There are many ways to store bits. Previously we discussed

• Storing bits and bytes on a piece of paper
• A primitive memory stick
• A DVD or CD
• A hard drive

## 1.4. Primitive Memory Stick

A simple memory stick. If the person holding the large magnet sees the stick move toward him, he records a 1. If it moves away from him, he records a 0.

## 1.5. CD or DVD

A CD or a DVD has small pits in it. In locations where there is a pit, the sensor stops receiving a reflected signal and this is interpreted as "zero". In locations where there is not a pit (a "land"), there is a reflected signal and this is interpreted as "one". What factors do you think control how many bits can be stored per unit area? What factors do you think control how quickly the bits can be read/written?

From img.tfd.com on May 18 2019 17:06:46.

## 1.6. Hard Disk

A hard disk has one or more spinning metal plates. A sensor arm moves to different positions along the radius of the plate. The sensor moves up or down depending on if the plate has a magnetic field pointing up or down in a given location. Below is a hard drive with its cover removed.

From upload.wikimedia.org on May 18 2019 17:06:46.

A laptop with the hard drive enclosure pulled out.

## 1.7. RAM

RAM ("Random Access Memory") does not require any moving parts to work. It is based on many tiny electrical switches (made of transistors) packed into a small volume.

The bottom of a laptop computer showing the RAM sticks.

## 1.8. Computer Specs

• 300 GB Hard Drive - How much data you can store when the power is off (in "slow" memory)
• 1 GB RAM - How much data you can store when the power is on (in "fast" memory)

The human brain has a similar feature. The information in short-term memory is recalled faster than the information in long term memory, but we have more information in our long-term memory.

Informally we say, "The desktop computer has 300 GB of disk space and 1 GB of memory." (The word "memory" is assumed to mean RAM or "fast" memory even though the hard drive is used for memory.)

Note:

• 1 TB = 1 trillion bytes (or 8 trillion bits).
• 1 GB = 1 billion bytes.
• 1 MB = 1 million bytes.

## 1.9. Computer Specs

There are broadly two categories of memory: "fast" and "slow".

• Slow memory usually requires moving mechanical parts and only electric power is needed. Examples include a hard drive and a CD or DVD. In both cases, a sensor reads bits off of a spinning plate.
• Fast memory usually does not require moving mechanical parts, uses only electric power, and requires less power than slow memory. Examples include the RAM memory used inside of a desktop computer and a USB thumb drive.

In terms of bits that can be stored per dollar of cost,

• Slow memory is usually less expensive.
• Fast memory is usually more expensive.

A 300 GB hard drive costs about $100 while 1 GB of RAM costs about$20. This translates to

• 300,000,000,000 bytes/$100 = 3,000,000,000 bytes per dollar for the hard drive • 1,000,000,000 bytes/$20 = 50,000,000 bytes per dollar for the RAM

or, RAM memory is 3,000,000,000/50,000,000 = 60 times more expensive per byte.

$$\frac{300,000,000,000\mbox{ bytes}}{\mbox{100}} = \frac{3,000,000,000\mbox{ bytes}}{\mbox{ dollar}}\mbox{ for the hard drive}$$

$$\frac{1,000,000,000\mbox{ bytes}}{\mbox{20}} = \frac{50,000,000\mbox{ bytes}}{\mbox{ dollar}}\mbox{ for the RAM}$$

or $$\frac{3,000,000,000}{50,000,000} = \mbox{60 times more expensive per byte.}$$

## 1.10. Memory types comparison

• Slow memory is cheaper than fast memory.
• Slow memory usually takes up more space. (Smart phones and iPads don't have a DVD player or hard drive.)
• Slow memory is not lost when the power is turned off. Most types of fast memory lose their memory when the power is off (such memory is called "volatile"). An exception is the memory used in a USB thumb drive, which does not lose its memory when unplugged [1].

## 1.11. Computer Specs

You may have also heard of 32-bit or 64-bit "operating systems". A 32-bit operating system means that the fundamental size of a memory slot used by the software that makes up the operating system is 32-bits. That is, roughly speaking, memory retrieved from the hard disk or in RAM is read, interpreted, and communicated in chunks of 32-bits. (To see why having a fixed size is important, consider how the mail system works. Standard U.S. letters are very easy for the mail system to handle because very efficient machines exist that can quickly process letters of this size. Although the mail system can handle odd-sized objects, they require more time and effort to process.)

Examples of operating systems with both 32 and 64-bit versions include:

From upload.wikimedia.org on June 06 2016 21:35:13.

Many 32-bit operating systems will not allow you to use more than about 4 GB of RAM. The reason is that each memory slot in RAM requires an address that has a length of 32 bits. With 32 bits, you can create 232=4,294,967,296 unique patterns (addresses).

# 2. Problems

## 2.1. Gigabytes

A gigabyte is roughly equal to one billion bytes. How many bits are contained in one billion bytes?

 A. 1 billion bits B. 2 billion bits C. 4 billion bits D. 8 billion bits E. None of the above

## 2.2. Bytes per dollar

If a 300 GB hard drive costs $100 and a 4.7 GB DVD disk costs$2, which is a better deal in terms of bytes per dollar?

## 2.3. Bytes per dollar

If a 2 TB hard drive costs $300 and a 4.7 GB DVD disk costs$3, which is a better deal in terms of bytes per dollar?

## 2.4. Estimate

How many hard drives could you fit in a shoe box? How many USB thumb drives could you fit in a shoe box? Use rough estimates for the size of a hard drive, USB thumb drive, and shoe box.

How many bytes are stored in the shoe box full of hard drives? How much does it weigh?

How many bytes are stored in the shoe box full of USB thumb drives? How much does it weigh?

What is the storage capacity of a human brain? How much does the average human brain weigh? Cite your sources.

## 2.5. 32-bit SSN

Suppose that the government decided to assign every person in the U.S. a 32-bit number (a binary number of length 32) instead of assigning each person a 9-digit decimal number. Would any two people be associated with the same number?

## 2.6. Bit SSN

If we wanted to assign a unique binary number of length N to each person in the world, what is the minimum value of N that would be needed so that no two people had the same number assigned to them?

## 2.7. OS Memory

If you install a 32-bit operating system twice, do you have a 64-bit operating system?

## 2.8. Bits and Bytes

You measure your internet download speed to be 32 Mbits/second. How long (in hours) will it take to download all of the information stored on a DVD? (Assume a DVD holds 4.7 GB).

# 3. Activities

## 3.1. Human RAM

When the instructor says "go," memorize as many digits as possible (in sequence) from the list of decimal digits written on the board. When the instructor says "stop" (after about 30 seconds), write down as many numbers as possible without looking at the board. When you are done, look at the board and compute the number of digits you were able to memorize and write this value on the note card. The instructor will collect the note cards at the end of class and enter the numbers in the "Numbers Remembered" column Spreadsheet. As a follow-up question, the instructor will ask you how many bits per second that you were able to memorize.

How does this compare to how many bits per second a computer can store? (Hint: Think about how long it takes you to copy a file from a thumb drive to a computer.)

## 3.2. Memory

Every person U.S. citizen is assigned a Social Security Number (SSN) composed of 9 decimal digits. Why isn't the number 5 digits? Why isn't the number 100 digits?

## 3.3. Computer Specs

Look up the details about your smart phone, laptop, or desktop computer. Which of the specifications listed correspond to memory? Which correspond to fast versus slow memory?

## 3.4. Better choice

Which is a better deal, a computer with a hard drive that can store

• 50,000 images or
• has a capacity of 100 GB?