Refers to physical memory that is internal to the computer. The word main is used to distinguish it from external mass storagedevices such as disk drives. Another term for main memory is RAM.

The computer can manipulate only data that is in main memory. Therefore, every program you execute and every file you accessmust be copied from a storage device into main memory. The amount of main memory on a computer is crucial because it determines how many programs can be executed at one time and how much data can be readily available to a program.

Because computers often have too little main memory to hold all the data they need, computer engineers invented a technique called swapping, in which portions of data are copied into main memory as they are needed. Swapping occurs when there is no room in memory for needed data. When one portion of data is copied into memory, an equal-sized portion is copied (swapped) out to make room.

Now, most PCs come with a minimum of 32 megabytes of main memory. You can usually increase the amount of memory by inserting extra memory in the form of chips.

ARCHIVED: What is the difference between memory and disk storage?

Memory and disk storage both refer to internal storage space in a computer. Each is used for a different purpose.

The term "memory" usually means RAM (Random Access Memory); RAM is hardware that allows the computer to efficiently perform more than one task at a time (i.e., multi-task).

The terms "disk space" and "storage" usually refer to hard drive storage. Hard drive storage is typically used for long-term storage of various types of files. Higher capacity hard drives can store larger amounts and sizes of files, such as videos, music, pictures, and documents.

"Virtual memory" is hard disk space that has been designated to act like RAM. It assists the computer with multi-tasking when there is not a sufficient amount of RAM for the tasks.

Computers also contain a small amount of ROM (Read-Only Memory) containing permanent or semi-permanent (firmware) instructions for checking hardware and starting up the computer. On a PC, this is called the BIOS.

What is the relationship between CPU usage and RAM?


The CPU processes (performs instructions on things, such as adding) stuff in memory. RAM is just part of the memory pyramid (see below). So when you are processing lots of data, that data ( or maybe large portions of it) will likely get loaded into RAM so it is ready for the cpu, this is to speed things up because RAM is faster to access than storage devices. So CPU usage and RAM can often correlate, but don't have to.

A basic example might be an p_w_picpath editing program. I load up my 20MB jpeg, the program reads the entire p_w_picpath, and the OS keeps that in RAM for you (all working memory looks the same to the program, the OS decides if it goes to the page/swap file on disk or RAM). So the p_w_picpath is in RAM waiting to be processed, but I go for coffee before telling the program to apply so silly filter, so the CPU isn't doing anything. I come back, apply the filter to add some bubbles to the p_w_picpath, and the CPU goes to 100% and even more memory gets used because it keeps the preprocessed p_w_picpath in memory, so I can undo the change I just made. When the program is done adding the bubbles, the CPU drops, but maybe not the memory.

Of course, it isn't quite this simple :-)

Picture of Memory Pyramid



Buffer and Block


  • Buffers

  • file manager : confirms file use info; finds physical location of file on disk; makes sure required sector in buffer;

  • I/O buffer: holds sectors of data; often doesn't get written back to disk until the buffer is needed for other uses (that way if more stuff done to the same sector, it doesn't have to be loaded again)

  • I/O processor: may be simple chip or complex CPU;

  • Block: smallest amount of data that can be read from or written to secondary storage at one time. Often generalized to mean any chunk of data that can be treated as a unit (for reading, writing, organizing). We will distinguish between disk blocks (physical) and program defined blocks (logical).

     http://www.minkhollow.ca/Courses/461/Notes/BasicOps/BlocknBuffer.html

  • - can't always ensure that logical and physical blocks match (often don't even want to).

  • should make sure they compliment each other

    • - logical blocks should not be split between physical blocks

    • - it's often more efficient to waste a little physical space in order to achieve a better match

      • eg. logical blocks = 10 bytes; physical blocks = 32 bytes; so fit 3/p.b. (waste 2 bytes per physical block)

  • Blocking: the process of grouping several components into one bloc

Buffers" represent how much portion of RAM is dedicated to cache disk block. "Cached" is similar like "Buffers", only this time it caches pages from file reading. Buffers are associated with a specific block device, and cover caching of filesystem metadata as well as tracking in-flight pages. The cache only contains parked file data. That is, the buffers remember what's in directories, what file permissions are, and keep track of what memory is being written from or read to for a particular block device. The cache only contains the contents of the files themselves.

Second storage device

hard drives (a prime example of secondary storage) are the go-to solution for nearly all data kept on today's computers.

storage.jpg


A CPU cache is a cache used by the central processing unit (CPU) of a computer to reduce the average time to access data from the main memory. The cache is a smaller, faster memory which stores copies of the data from frequently used main memory locations. Most CPUs have different independent caches, including instruction and data caches, where the data cache is usually organized as a hierarchy of more cache levels (L1, L2, etc.).