Exercise

Enhance your understanding and skills by attempting the exercise provided in this lesson.

We'll cover the following...

This exercise introduces you to a new tool, vmstat, and how it can be used to understand memory, CPU, and I/O usage. Read the associated README and examine the code in mem.c before proceeding to the exercises and questions below.

all: mem

mem: mem.c
	gcc -o mem mem.c -Wall -O

Note: You have to press the Run button to register your changes from the editor to the terminal.

Questions

  1. First, open two separate terminal connections to the same machine, so that you can easily run something in one window and the other. Now, in one window, run vmstat 1, which shows statistics about machine usage every second. Read the man page, the associated README, and any other information you need so that you can understand its output. Leave this window running vmstat for the rest of the exercises below.

    Now, we will run the program mem.c but with ...