before receiving input the project specifications say:
"We have a computer whose RAM is an array of size 16. It is an array
of pointers. There are 8 page frames in the RAM, each consisting of two
contiguous locations in the array. Hence, the page size of this computer is 2"
this means that there will be 8 pages in the RAM
"Each process has a page table, which is an integer array,
entry of a process page table indicates whether the page is in RAM or in the
virtual memory (on disc), k if the page is in RAM (k is the frame number,
between 0 . . . 7)"
"Initialise the process id and page num with the id of the process (a
number between 0 . . . 3) and a page number of that process (a number
between 0 . . . 3). Initialise all last access to 0." - there can be 8 RAM in memory so it having page numbers 0-3 doesn't make sense because they can't be uniquely identified, it has to be 0-7 (like mentioned earlier with the frame number)
this means that all time steps are 0, since each process has 4 pages there will need to be 2 different processes in the RAM (starting with 0 and 1) and each page number starts off unique (0-7)
page: {process_id,page_num,time}
RAM pages: {0,0,0},{0,1,0},{0,2,0},{0,3,0},{1,4,0},{1,5,0},{1,6,0},{1,7,0}
"The virtual memory of this computer is an array of pointers of size 32
(We will pretend it is on disc, but actually it is an array in the RAM of
our computer)"
this means that there will be 16 pages in disc
"(k is the frame number,
between 0 . . . 7), and 99 if the page is in disc (99 cannot be a frame number)."
this means initialise the disc with page numbers of 99
"There are 4 processes in this computer, and each process can
have 4 pages, and obviously all the pages of all the processes cannot be in
the main memory at the same time. Some pages will be in the main memory
and some pages will be in the virtual memory at any time. The processes are
numbered 0 . . . 3."
on a different article you mentioned that disc cannot be written to which means it will need 4 pages from each process. For each of the four processes initialise disc memory with page num 99 and time step 0
DISC pages: {0,99,0},{0,99,0},{0,99,0},{0,99,0},{1,99,0},{1,99,0},{1,99,0},{1,99,0},{2,99,0},{2,99,0},{2,99,0},{2,99,0},{3,99,0},{3,99,0},{3,99,0},{3,99,0}
"The simulation starts by reading a file where there is a single line of
integers separated by blanks, for example:
0 2 1 3 3 2 2 0 2 1 0 2 3 0"
this means the first instruction is 0
since all have the same time step go left to right
process 0 page table: {0,0,0},{0,1,0},{0,2,0},{0,3,0}
{0,0,0} is leftmost
you mentioned on a different article if all of process 0 is loaded in from RAM we evict it from RAM
RAM pages: {},{0,1,0},{0,2,0},{0,3,0},{1,4,0},{1,5,0},{1,6,0},{1,7,0}
"Each integer indicates a process id. For example, the first number 0 indicates that the next page of process 0 has to be brought in from virtual
memory to the RAM"
DISC pages with process 0: {0,99,0},{0,99,0},{0,99,0},{0,99,0}
next page of process 0: {0,99,0}
RAM pages: {0,99,0},{0,1,0},{0,2,0},{0,3,0},{1,4,0},{1,5,0},{1,6,0},{1,7,0}
RAM pages: {0,99,1},{0,1,0},{0,2,0},{0,3,0},{1,4,0},{1,5,0},{1,6,0},{1,7,0} // increment time step
"The process table of process 0 and the RAM have to
be updated accordingly. "
process 0 page table:
{0,0,0},{0,1,0},{0,2,0},{0,3,0},{1,4,0},{1,5,0},{1,6,0},{1,7,0} // old one
{0,99,1},{0,1,0},{0,2,0},{0,3,0},{1,4,0},{1,5,0},{1,6,0},{1,7,0} // changes to this
this is repeated with all of the other instructions