From 051ada1dadddc9d8cbc2504ece88b04d5279e047 Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Tue, 1 Nov 2022 13:49:33 +1300 Subject: [PATCH] vault backup: 2022-11-01 13:49:33 --- content/notes/22-virtual-memory.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/content/notes/22-virtual-memory.md b/content/notes/22-virtual-memory.md index 609d1d7d2..e3f235685 100644 --- a/content/notes/22-virtual-memory.md +++ b/content/notes/22-virtual-memory.md @@ -67,12 +67,39 @@ This means an extra step in the operating system’s page-servicing routine. FIFO - replace the oldest page +- ![example](https://i.imgur.com/EM09dtl.png) - pro - simple to understand/implement - con - maybe first page to be ref'd is often being referenced - - belady's anomaly + - belady's anomaly: possible to increase numbe of page faults when increasing the number of frames in memory + +Optimal page replacement +- replace the page that will not be used for the longest time +- ![example](https://i.imgur.com/RiNi1JI.png) +- pro: optimal +- con: can predict future + +LRU (least recently used) +- replace page than has not been used for the longest time +- ![example](https://i.imgur.com/VpMGeXY.png) +- pro: optimal if you look back in time +- con: time consuming to keep record of LRU +- future memory references resemble past ones # frame allocation +how many frames to allocate to a process? + +how to distribute frames among n processes in a multitasking scenario +- equal allocation: all created equal: so each get equal number of frames +- proportional allocation: allocate depending on size of process +- local vs global replacement: + - local: steal from your own frames + - global: can steal from "victim" processes # thrashing +when a proces has too lttle frames it will have a lot of page faults. + +a thrashing process spending more time paging than executing + +the working set of a process is the number of pages a process needs in orde \ No newline at end of file