Skip to content

Commit

Permalink
Merge pull request #9 from RonnanSouza/memory_management
Browse files Browse the repository at this point in the history
Memory management
  • Loading branch information
thiagomanel authored May 29, 2019
2 parents 9d6d1b1 + 94a7837 commit 0e6be93
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lab_mem/memory_management/Mapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys

class Mapper:

def processAddrs(self):
for line in sys.stdin:
v_addr = int(line, 16)
if v_addr < 0:
return
address, n_page_faults = self.map(v_addr)
sys.stdout.write(str(address)+" "+str(n_page_faults)+"\n")

def map(self, addr):
return (addr, 0)
9 changes: 9 additions & 0 deletions lab_mem/memory_management/genAddrs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import sys, os

n = int(sys.argv[1])

for i in range(n):
addr = os.urandom(4).hex()
sys.stdout.write(addr+"\n")

sys.stdout.write("-1")

0 comments on commit 0e6be93

Please sign in to comment.