Question: I literally don't get this and the previous expert's code didn't work. The screenshots contain the instructions and the tests the program must pass (
I literally don't get this and the previous expert's code didn't work. The screenshots contain the instructions and the tests the program must pass Ill be thrilled if I end up with or more
Im not sure if you need the content of the other three Python files to make this work but here's how the Operating system code looks like the one I actually need to modify:
from typing import Optional
from ram import RAM
from process import Process
from pageregisters import PageRegisters
#
# Operating System Memory Management
#
#
# InvalidAddressException does nothing, but program will crash with
# an appropriate error
# NotImplementedException Catches the error that a function was called that has not been written yet
# pagefaultselfvaddr called when the MMU accesses a page register that is set to None
# loadprocessselfprocess a process is being loaded
#
#
class InvalidAddressException:
pass
class OS:
#
# constructor
#
def initself ram: RAM, pageregisters: PageRegisters:
#
# put whatever other data you want need here
#
#
# every OS must have access to the ram
#
# to load data into ram...
# 'self.ram.setdata physicaladdress, value
self.ram: RAM ram
#
# Divide the RAM into frames
#
self.ramframes Noneselfram.maxaddr pageregisters.pagesize
#
# every OS must have access to the pageregisters
#
# to set a specific frame number for a given page
# 'self.pageregisters.setframenumberpagenumber,framenumber
# to get the framenumber from the page registers for a specific page
# 'framenumber self.pageregisters.getframenumberpagenumber
self.pageregisters: PageRegisters pageregisters
# page size or frame size
self.pagesize pageregisters.pagesize
#
# total number of frames available to the RAM
#
self.numframesinram lenselframframes
#
# which process is currently running
#
self.currentprocess: OptionalProcess None
#
# os deals with invalid address complaint from mmu
# you must load the appropriate data from the process into
# the ram, and update page registers accordingly
# other information may also need to be saved
#
def pagefaultself vaddr:
handles the mmu page faults"""
#
# new processes is loaded
# NOTE: each process has the properties:
# pid uniquely identify each process integer
# entrypoint which address is the location of the first
# size the size of the process
#
def loadprocessself processobject:
load a new process"""
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
