Assume that we have 100 pages of physical memory.
Let's start at time t = 0. You want to serve the request:
+ 2 100 --> starting a process and allocating memory is very
fast in our simulation, this happens instantnously:
T doesn't change (== 0)
w 2 42 --> writing page 42 takes T_mem_access. T += T_mem_access
+ 3 70 --> here we want to start process 3, which needs 70 pages
of memory. This requires swapping process 2 out, meaning
you've to write 100 pages to disk:
T += 100 * T_disk_write
w 3 21 --> reading page 21: T += T_mem_access
r 2 42 --> swapping out process 3: T += T_disk_write * 70
swapping in process 2: T += T_disk_read * 100
reading page 42: T += T_mem_access
---> total time = T
---> number of accesses: 3 (two write, one read)
---> average memory utilization:
% memory used on average: 100 % (+ 2 100)
70 % (+ 3 70)
100 % (+ 2 42)
-----
90 %