Picture of Main Memory

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Locations in a digital image are specified by a row number and a column number (both of them integers). A particular digital image is 1024 rows by 1024 columns, and each location holds one byte. How many megabytes are in that image?

Answer:

1024  *  1024  =   210  *   210   =   2(10+10)  =   220  =  one megabyte

Picture of Main Memory

memory array

 

Main memory consists of a very long list of bytes. In most modern computers, each byte has an address that is used to locate it. The picture shows a small part of main memory:

Each box in this picture represents a single byte. Each byte has an address. In this picture the addresses are the integers to the left of the boxes: 0, 1, 2, 3, 4, ... and so on. The addresses for most computer memory start at 0 and go up in sequence until each byte has an address.

Each byte contains a pattern of eight bits. When the computer's power is on, every byte contains some pattern or other, even those bytes not being used for anything. (Remember the nature of binary: when a binary device is working it is either "on" or "off", never inbetween.)

The address of a byte is not explicitly contained in memory. When the processor needs to access the byte at a particular address, the electronics of the computer "knows how" to find that byte in memory.


 

QUESTION 7:

Decide which of the following are true:

  • Each byte of main memory has a unique address.
  • If main memory cotains 4 megabytes, there will be 4 * 220 addresses.