Skip to main content

Section 3.1 Address Spaces and the Memory API

This reading consists of 2 brief chapters. Chapter 13 introduces the concept of an address space, and Chapter 14 discusses the basic memory allocation API available to user processes.
Start by reading the Address Space chapter start (sections 13.1, 13.2).

Practice 3.1.1.

According to the reading what was a key problem with the early attempts at time-sharing?
  • There was a desire for multiple users to interact with the machines at the same time
  • No this was actually the motivation from moving away from batch processing and towards time-sharing
  • Early approaches required saving the entire memory on disk on each switch, which was prohibitively time-consuming.
  • Connecting the users to the machines was not easy to do.
  • The processors of the time were too slow.
  • The protection of early systems could not be established.
  • While protection was an important issue to consider, it wasn’t a main limitation of the systems at the time.
Read section 13.1 where the concept of address space is defined.

Practice 3.1.2.

What does the address space abstraction refer to?
  • It is a representation of the memory available to the running process, without revealing how this space is situated in the physical memory.
  • It is the mapping between virtual addresses and physical memory addresses.
  • While this is the key mechanism by which this is achieved, it is not its definition.
  • It is the locations in physical memory where the program code is at.
  • It refers to the fact that the heap and the stack grow in opposite directions.
Read section 13.4 about the goals of memory virtualization.

Practice 3.1.3.

Which of the following are key goals of a memory virtualization process?
  • To protect the OS code from the various user processes.
  • To make sure programs can still be run quickly with minimum overhead from the virtualization process.
  • To make sure processes can use as much memory as they would like.
  • This was not one of the stated goals.
  • The implementation should be completely hidden from the user processes.
Read the summary section 13.5.

Practice 3.1.4.

Read section 14.1 about the stack and the heap.

Practice 3.1.5.

    True or False: memory allocated to a function in the stack is available to the user after the function returns.
  • True.

  • False.

Read section 14.2 about the malloc call.

Practice 3.1.6.

    True or False: malloc return 0 if it successed in allocating the requested space.
  • True.

  • False.

Practice 3.1.7.

Read section 14.3 about free and section 14.4 about common errors

Practice 3.1.8.

Which of the following are common errors when programming with the memory API?
  • Allocating less space than needed.
  • Not using memory that you allocated.
  • Writing to memory without allocating it first.
  • Accessing memory after you freed it.
  • Freeing a memory that you already had freed.
Read the remaining sections: 14.5 about the support provided by the OS, 14.6 about important alternatives to malloc, and 14.7 with a brief summary.
You have attempted of activities on this page.