def p3thread(): p3 = Process(3) p3.load_pages([0,1], 2) modify(p3) printAll("third process p3", p3) # time.sleep(2) # p3.load_pages([2], 1) return
def p2thread(): p2 = Process(3) p2.load_pages([0], 1) printAll("second process p2 ", p2) time.sleep(3) p2.load_pages([1], 1) printAll("More memory added to p2 ", p2)
def p1thread(): p1 = Process(4) p1.load_pages([0, 1], 2) printAll("first process p1 ", p1) time.sleep(3) p1.load_pages([2], 1) printAll("More memory added to p1 ", p1)
def p2thread(): p2 = Process(3) p2.load_pages([0], 1) modify(p2) printAll("second process p2", p2) time.sleep(2) p2.load_pages([1], 1) printAll("load more pages p2", p2) return
def p1thread(): p1 = Process(4) p1.load_pages([0,1], 2) modify(p1) printAll("first process p1", p1) time.sleep(2) p1.load_pages([2], 1) printAll("load more pages p1", p1) return
import numpy as np import sys # sys.path.append('/Users/quentincurteman/Google Drive File Stream/My Drive/William Jessup/Fall 2018/Operating Systems/CS355') from memory.memmgmt import MemoryManagementA from memory.memmgr import MemoryA from process.processx import Process pp = Process(4) print('***** before loading *****') pp.print_mgmt() MemoryA.print_mem() MemoryManagementA.print_management() print('**************************') alist = [0, 1] pp.load_pages(alist, 2) print('***** after loading *****') pp.print_mgmt() MemoryA.print_mem() MemoryManagementA.print_management() print('**************************')
def p4thread(): p4 = Process(4) p4.load_pages([0, 1], 2) modify(p4) printAll("fourth process p4", p4) return
def printAll(astring, process): print(" ********* start: ", astring, '*********') process.print_mgmt() Memory.print_mem() MemoryManagement.print_management() print(" *********** end: ", astring, '***********') def add_random_marks(): for loop in range(25): index = randint(0, 6) MemoryManagement.mark(index) # first process p1 = Process(4) p1.load_pages([0, 1], 2) modify(p1) printAll("first process p1 ", p1) # second process p2 = Process(3) p2.load_pages([0], 1) modify(p2) printAll("second process p2 ", p2) # first process does another load_pages p1.load_pages([2], 1) modify(p1) printAll(" first process p1 do a load again", p1)
def p4thread(): p4 = Process(4) p4.load_pages([0, 1], 2) printAll("forth process p4 ", p4)
def p3thread(): p3 = Process(3) p3.load_pages([0, 1], 2) printAll("third process p3 ", p3)
from memory.memmgmt import MemoryManagementA from memory.memmgr import MemoryA from process.processx import Process p1 = Process(4) p1.print_mgmt() print(" ***** before loading ****") MemoryA.print_mem() MemoryManagementA.print_management() print(" *************************") alist = [0, 1] p1.load_pages(alist, 2) print(" ***** after loading *****") p1.print_mgmt() MemoryA.print_mem() MemoryManagementA.print_management() print(" *************************") # get vectors vectorlist = p1.get_vectors() nbr = 22 for v in vectorlist: for r in range(0, v.shape[0]): v[r] = nbr nbr += 11 print(" ***** modifying ****") MemoryA.print_mem()