1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6How many page faults would occur for the page replacement algorithms listed below, assuming
csci4534.controller.MainSimulator
. This simulator keeps
track of a set of simulated processes and memory & disk contents,
as processes start/stop, and as memory de/allocation and access take
place. For example,
control.bat SimpleController 5:4:3:4:2 6 7 n a:0:10:rw w:0:1:2 r:0:1 d:0:0 x:0simulates memory behaviour for a system whose physical memory capacity is 6 frames and its disk capacity is 7 blocks; each block is always the same size as a frame in our simulator. The first colon-separated list of numbers specifies the address structure supported by the (simulated) hardware. In general, the memory controller performs address translation in the style of the Intel 80386 processor under OS/2 (figure 9.21 of your textbook). A logical address has two parts, namely a segment selector followed by a segment offset; a linear address is split into three concatenated parts: p1, p2, and d. The first list of numbers specifies the length of each of those five parts in units of bits. So, in this case, we have:
csci4534.controller.AddressTranslation
stub.
In addition to the system configuration, the above command-line specifies a series of memory operations:
make.bat
):
Controller: csci4534.controller.SimpleController Creating process: 0 Allocating length 10 access rw for process 0: 0 w@0:1=2 r@0:1=2 Deallocating 0 for process 0: done Terminating process 0: done Memory: [0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] Disk: [(0,0,0,0);(0,0,0,0);(0,0,0,0);(0,0,0,0);(0,0,0,0);(0,0,0,0);(0,0,0,0)]You are given the implementation of a simple controller in
csci4534.controller.SimpleController
; in general, you can
substitute SimpleController
on the command-line with any
other implementation of the
csci4534.controller.Controller
interface. The simple
controller allows each process to have at most one segment, which is
allocated in a contiguous hole in memory. No paging is used, and there
is no virtual memory. So this controller does not take advantage of
the full (simulated) 80386 hardware. Instead, the logical address is
treated as a simple direct offset into the single segment of the
process; we don't even extract a segment selector from the logical
address since the process has at most one segment (so there is no
selection to be made). This controller illustrates that it is common
to see new hardware run an operating system that does not fully use
the hardware capabilities; this is because there is a time lag between
the production of new hardware and the corresponding OS upgrades to
fully use the new hardware features.
Study Controller
and the provided implementation
SimpleController
, along with the rest of the provided
code, and pay particular attention to the following:
jdoc.bat
). The HTML documentation doesn't cover
everything (e.g. it doesn't cover in-line comments or private
methods), but it's more readable, esp. for sections containing math
equations.
[10 points] Implement
csci4534.controller.ControllerConfiguration
. Please note
the constraints on the nature of computations you may invoke in this
class, as stated in the class comments. This constraint applies only
to Java code you write yourselves; beyond this, you have no control
over what instructions the JVM sends to the real CPU in the course of
running your Java code.
[15 points] Implement
AddressTranslation
. Please note the constraints on the
nature of computations you may invoke in this class, as stated in the
class comments.
[20 points] Implement
csci4534.controller.PhysicalController
. This controller
does not support virtual memory; all pages reside in physical memory
only. While the (simulated) hardware supports virtual memory (since
page table entries set aside space to store a disk block index), the
controller does not use the hardware to the fullest possible extent
(much like SimpleController
doesn't). As an example of
this controller's operation, the command-line
control.bat PhysicalController 2:3:2:2:1 8 8 n a:0:3:rw w:0:0:1 w:0:1:2 a:0:3:rw w:0:8:3 w:0:9:4should produce the following output:
Controller: csci4534.controller.PhysicalController Creating process: 0 Allocating length 3 access rw for process 0: 0 w@0:0=1 w@0:1=2 Allocating length 3 access rw for process 0: 1 w@0:8=3 w@0:9=4 Memory: [1,2,0,0,3,4,0,0,0,0,0,0,0,0,0,0] Disk: [(0,0);(0,0);(0,0);(0,0);(0,0);(0,0);(0,0);(0,0)][15 points] Implement
csci4534.controller.VirtualController
. This controller
supports virtual memory, and is an extension of
PhysicalController
you just built. This controller takes
full advantage of the hardware. As an example of this controller's
operation, the command-line:
control.bat VirtualController 2:3:2:2:2 2 4 n a:0:4:rw w:0:0:1 w:0:1:2 a:0:4:rw w:0:8:3 w:0:9:4 a:0:4:rw w:0:10:5should produce the following output:
Controller: csci4534.controller.VirtualController Creating process: 0 Allocating length 4 access rw for process 0: 0 w@0:0=[DR:0->0]=1 w@0:1=2 Allocating length 4 access rw for process 0: 1 w@0:8=[DR:1->4]=3 w@0:9=4 Allocating length 4 access rw for process 0: 2 w@0:10=[DW:0->0]=[DR:2->0]=5 Memory: [5,0,0,0,3,4,0,0] Disk: [(1,2,0,0);(0,0,0,0);(0,0,0,0);(0,0,0,0)]The notation
[DR:d->m]
show a disk read from disk block
index d
to memory at physical address m
, and
the notation [DW:m->d]
show a disk write from memory to
disk.
Make sure all your code is well documented in the same simple, succinct style that the provided code is documented. As the syllabus states, points will be deducted for poorly commented code you write for this or any other programming task in this course.
[1 point] How much time did you spend on this section?