WUT_Computer_Science/EOPSY/lab4/task4/work/javadoc/PageFault.html
2022-05-06 11:42:53 +02:00

108 lines
3.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Mon Nov 19 12:24:52 EST 2001 -->
<title>
Class PageFault
</title>
</head>
<body>
<a name="_top_"></a>
<h1>
Class PageFault
</h1>
<pre>
java.lang.Object
|
+----PageFault
</pre>
<hr>
<dl>
<dt> public class <b>PageFault</b>
<dt> extends Object
</dl>
<hr>
<a name="index"></a>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#PageFault()"><b>PageFault</b></a>()
<dd>
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#replacePage(java.util.Vector, int, int, ControlPanel)"><b>replacePage</b></a>(Vector, int, int, ControlPanel)
<dd> The page replacement algorithm for the memory management sumulator.
</dl>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="PageFault"></a>
<a name="PageFault()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>PageFault</b>
<pre>
public PageFault()
</pre>
<a name="methods"></a>
<h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="replacePage(java.util.Vector, int, int, ControlPanel)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="replacePage"><b>replacePage</b></a>
<pre>
public static void replacePage(Vector mem,
int virtPageNum,
int replacePageNum,
<a href="ControlPanel.html#_top_">ControlPanel</a> controlPanel)
</pre>
<dl>
<dd> The page replacement algorithm for the memory management sumulator.
This method gets called whenever a page needs to be replaced.
<p>
The page replacement algorithm included with the simulator is
FIFO (first-in first-out). A while or for loop should be used
to search through the current memory contents for a canidate
replacement page. In the case of FIFO the while loop is used
to find the proper page while making sure that virtPageNum is
not exceeded.
<pre>
Page page = ( Page ) mem.elementAt( oldestPage )
</pre>
This line brings the contents of the Page at oldestPage (a
specified integer) from the mem vector into the page object.
Next recall the contents of the target page, replacePageNum.
Set the physical memory address of the page to be added equal
to the page to be removed.
<pre>
controlPanel.removePhysicalPage( oldestPage )
</pre>
Once a page is removed from memory it must also be reflected
graphically. This line does so by removing the physical page
at the oldestPage value. The page which will be added into
memory must also be displayed through the addPhysicalPage
function call. One must also remember to reset the values of
the page which has just been removed from memory.
<p>
<dd><dl>
<dt> <b>Parameters:</b>
<dd> mem - is the vector which contains the contents of the pages
in memory being simulated. mem should be searched to find the
proper page to remove, and modified to reflect any changes.
<dd> virtPageNum - is the number of virtual pages in the
simulator (set in Kernel.java).
<dd> replacePageNum - is the requested page which caused the
page fault.
<dd> controlPanel - represents the graphical element of the
simulator, and allows one to modify the current display.
</dl></dd>
</dl>
</body>
</html>