CSCI 3500: Studio 15-a

Physical Memory

The earliest memory systems managed physical memory directly, and typically the operating system could do very little to make programming easier.

In this studio, you will:

  1. Consider statically partitioned physical memory
  2. Consider dynamically partitioned memory with base and limit registers
  3. Explore the limitations of physical memory based methods

Please complete the required exercises below, as well as any optional enrichment exercises that you wish to complete.

As you work through these exercises, please record your answers in a text file. When finished, submit your work via the git repository.

Make sure that the name of each person who worked on these exercises is listed in the first answer, and make sure you number each of your responses so it is easy to match your responses with each exercise.

Required Exercises

  1. As the answer to the first exercise, list the names of the people who worked together on this studio.

  2. Consider a program that uses absolute physical memory references meaning that each reference refers to a specific physical memory location. One part of such a program is below:

    movl	($0x100),	%eax
    movl	($0x104),	%ebx
    movl	%eax,		($0x104)
    movl	%ebx,		($0x100)

    This program works fine when it is loaded at address 0x0, but not when it is loaded at address 0x1000. Why not?

  3. Re-write the above code so the program works when it is loaded at memory address 0x1000.

  4. Suppose you have a machine with four static parititons, each capable of holding a program with a length of 4096 bytes (0x1000 bytes). The first partition starts at address 0x0. Give the first and last address of each of the four partitions.

  5. Suppose the first of the four programs executes the following line of code, with the operand located at byte 0x25, and the destination address located at bytes 0x26-0x2A:

    0x25:	jmp	($0x50)

    Suppose also another program executes the following line first.

    		movl $0x1234,	($0x26)

    What happens to the first progam upon executing the instruction at address 0x25?

  6. Now consider a more advanced machine that uses base + limit registers to provide protection. Suppose the program from question 2 is loaded at address 0x1000. Does the code need to be re-written? Why or why not?

  7. Suppose the two programs from question 5 were to execute again in the same order. The first program has base 0x0 and limit 0xFFF. The second program has base 0x1000 and limit 0x1FFF. What happens this time?

  8. Suppose this more advanced machine has 0x4000 bytes of program memory. The operator of the machine executes program A, which needs 0x1000 bytes of memory, and then program B, which needs 0x2000 bytes of memory. Then program A finishes and releases its memory back to the system. Draw a picture of the memory of the system at this time. How many bytes are now not in use?

  9. The operator from the previous exercise then tries to execute program C, which requires 0x2000 bytes of memory, and recieves an error. Why can't the machine execute program C?

  10. Program B from the previous two exercises won't be done for some time, but the operator really wants to start program C now. What could be done in order to support this?

Optional Enrichment Exercises

  1. No optional exercises