aboutsummaryrefslogtreecommitdiff
path: root/fifo.py
diff options
context:
space:
mode:
authorAdam NAILI2018-04-02 16:14:45 +0200
committerAdam NAILI2018-04-02 16:14:45 +0200
commit3dc844c1dfea604bc43890794a5cbc4c5fdef89d (patch)
tree3599db4a41125f3934d2d9ebc7aa6eaed2a9aaab /fifo.py
parent0441d28435e8db1d60c1ae30c81e3a54f12149c8 (diff)
downloadmempager-simulator-3dc844c1dfea604bc43890794a5cbc4c5fdef89d.tar.gz
PageException created and LRU,Second Chance Handling
Diffstat (limited to 'fifo.py')
-rw-r--r--fifo.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/fifo.py b/fifo.py
index 61e70f5..c48629f 100644
--- a/fifo.py
+++ b/fifo.py
@@ -4,6 +4,7 @@
4# Pacien TRAN-GIRARD et Adam NAILI 4# Pacien TRAN-GIRARD et Adam NAILI
5 5
6from mem import Memory 6from mem import Memory
7from pageexception import *
7 8
8 9
9class FifoPaginator: 10class FifoPaginator:
@@ -18,7 +19,7 @@ class FifoPaginator:
18 return overwritten 19 return overwritten
19 20
20 def load(self, page): 21 def load(self, page):
21 if not self.mem.page_in_range(page): raise IndexError 22 if not self.mem.page_in_range(page): raise PageException
22 if page in self.mem.main: return 23 if page in self.mem.main: return
23 if page in self.mem.virt: self.mem.remove_virt(page) 24 if page in self.mem.virt: self.mem.remove_virt(page)
24 overwritten = self._put_main(page) 25 overwritten = self._put_main(page)