Has anyone's project been remarked? I emailed the professor on the 10th, and it seems that there are still no updates.
I understand that there is a large amount of exams to mark, just worried if this will be looked at before the marks release on the 2...
Hi everyone,
I m really frustrated with the grading of my recent project submission, where I received a 0 10. I just verified if my submission was proper with the appropriate names and student IDs mentioned in the code and despite the code passing m...
ANONYMOUS wrote
Hi Anon,
I would recommend sending an email to Amitava as soon as possible, it might have been a mistake, especially if your project met the requirements. It seems very odd to get 0, usually that's a grade reserved for submitting nothi...
Hello everyone,
I'm reaching out to seek advice and support regarding the recent grading of our Project 2. Our team received a zero score, which we find difficult to accept given the time, effort, and energy we invested. We carefully rechecked our cod...
ANONYMOUS wrote
I would personally say exit would apply better because technically you can just make a program that does nothing and so doesn't use I O but I O is still a good answer.
I know how you feel, but according to research, it is linked to bet...
ANONYMOUS wrote
Honestly it could be interpreted either way, but I don't think you need to increase the last accessed time if you are ignoring the entry since it would presumably take no time to ignore an entry (as opposed to loading an entry onto RA...
It is definitely possible to complete the project without creating virtual memory, but I believe Amitava intends you to create virtual memory (since it is in the specification), so it is probably best to create virtual memory.
Hi, in the project description it says that "time will increase by 1 for each entry in the file". So, do we need to increase last accessed time if we decide to ignore an entry that already exists in RAM?
Thank you for your help
Is it mandatory to maintain a data structure for virtual memory as an array of size 32? Coz I developed all the way without having virtual memory in mind.
ANONYMOUS wrote
As Anon said this is incorrect. The page table is the slot in RAM the page occupies. A slot is of size 2. So, it should be
0, 1, 2, 3
4, 7, 99, 99
99, 99, 5, 99
99, 99, 6, 99
You are getting confused with the location in the RAM array and the page frame in the RAM.
Page tables print which page frame the process page is in, NOT the array index the page starts at.
From the project description
"We have a computer...
It doesn't matter. As long as the point comes across, write it in your assumptions since most of these are just formatting. As long as it is clear what is what, you'll be fine
ANONYMOUS wrote
shouldn't the page table here be
0 2 4 6
8 14 99 99
10 99 99 99
12 99 99 99
because of each page taking up to spaces in RAM, or am I being dumb?
I actually have already implemented it so as that the command-line arguments will be the files taken from written to- is this okay? I assume that it is, as in.txt and out.txt are always passed when calling . simulation
Hi
In the project brief, RAM is printed as
0,0,0; 0,0,0; 1,0,1; 1,0,1; EMPTY,EMPTY,EMPTY; ...
However in many help forum posts, it is listed as
0, 0, 0; 0, 0, 0; 1, 0, 1; 1, 0, 1; EMPTY, EMPTY, EMPTY; ...
In the first, commas do not have a ...
ANONYMOUS wrote
You are correct on that, yes. By not incrementing the time that is the expected output - you should list that as one of your assumptions though, just in case.
Does time stamp increase when you ignore a page? I have seen some conflicting answers on the forum, and would like to confirm before submitting.
For example, if you don't increase time when ignoring a page, output for
0 0 0 0 1 0 0 2 3 1 0 2 3 3 2
wou...
ANONYMOUS wrote
This isn't correct because we are using the "Local" Least Recently Used (LRU) algorithm to evict processes. You seem to be using "global".
1. At time 0,1,2,3 0 0 0 0 is loaded.
2. At time 4 The fifth zero is ignored.
3. At time 5,6,7,8...
I got the same output, so it's probably correct. In case anyone is looking at this later and wants to know the output for not allowing process pages to be read more than once, the output should be something like this
0, 1, 2, 3
4, 7, 99, 99
99, 9...
ANONYMOUS wrote
You wouldn't gain marks since it isn't asked for in the specification. Whether you lose marks or not would be up to the discretion of whoever marks your code (usually, you wouldn't be marked down for having extra code that exists for ...
Hi, I know the memory struct given to us is an unnamed struct but is it okay if we make a new type called struct memory?
This is how I have defined my struct
struct memory
int process id;
int page num;
int last accessed;
;
Also can you verif...
How come it is correct, if the replacement is ignored?
Because in the example in the given input last sequence of numbers are "1 1 2 2 3 3 2 2 1 1" and because of that all the pages of process 0 will definitely be replaced by the new pages of all the ...
"You have to write a C program in a single file called simulation.c, and
compiled as an executable called simulation. It will read two file names from
the command line, in.txt and out.txt. The first file is the one mentioned
above, for reading process i...
I have code throughout the project that generates an optional log file.
Assuming the debug code is done well, I was wondering if there would be marks taken off for having extra code, marks added for having good debug functionality, or no difference t...
ANONYMOUS wrote
Just what is written in the spec. each page table entry on a new line. Followed by the RAM contents with each page semi-colon separated. You also need to explicitly print out the empty slots of RAM (You can just print "empty" for that...
Hello, I would like to ask regarding the output file we should write to, is there any particular format we need to follow besides the format of the page table and RAM?
0, 2, 99, 99
1, 99, 5, 99
3, 99, 99, 4
99, 99, 7, 6
0, 0, 3; 0, 0, 3; 2, 2, 5; 2, 2, 5;...
Adding to this to show how it'd look if you chose to ignore it instead of pushing
99, 1, 2, 3
99, 99, 4, 5
99, 99, 6, 7
99, 0, 99, 99
3,1,10; 3,1,10; 0,1,1; 0,1,1; 0,2,2; 0,2,2; 0,3,3; 0,3,3; 1,2,13; 1,2,13; 1,3,14; 1,3,14; 2,2,11; 2,2,11; 2,3,12; 2,3,12...
Yes. The spec explicitly states the names of the files will be in.txt and out.txt
As Anon said it is good practice to be able to read a file of any name as opposed to a hard coded value. However, for this project you can assume that the file name pass...
That looks right to me Just tested it on my end and I got the same result, so either we are both right are both wrong. I certainly hope it's the former.
Hi, no this this should not be the case. Note that a process will always replace one of its own pages if the RAM is full and there is one available to replace (as local replacement is prioritised over global).
As a result of this, once 1 page of each...
You can write is as an assumption that it will always be named that. This is a simple project so I doubt they'd check it. But a good practice is to not hard code it but instead let it work with any names. Hope this helps
ANONYMOUS wrote
As Amitava said in his clarification email "(1) What happens if all the pages of a process are already in memory and the process id appears again in the input. You can handle this one of two ways, either you can ignore it, or 'bring' ...
I have emailed Amitava this and he says it doesn't matter how you put it (99, 99, 0 or Empty, Empty, 0 or Empty, Empty, Empty) just put it under your assumptions as comments at the very top of your code
His exact response is "Yes, you can choose your ...
Hello
I was just wondering whether the input file will always be called in.txt, and the outfile will always be called out.txt since the project description says that we should take in.txt and out.txt as command-line arguments.
If a filename o...
I apologise if this has been answered previously
If the RAM is not full, when we are printing the contents should we only print the pages that exist in RAM or should we specify that it is empty with a keyword like 'Empty' if a location in RAM has no p...
Assume that we had called the same process ID 5 times like so
0 0 0 0 0
when we get to that fifth call, since it's already in memory, should we increase the time?
like should it be
0, 1, 2, 3, 4
or
0, 1, 2, 3, 3 (since were not moving values from Virtual...
Sorry if this has been asked in a previously, but do we assume that the input file syntax will always be correct, or should we implement measures to detect errors e.g. alphabetic characters?
Hello,
In the project it says that the VRAM size is 32, however each page specific to a process takes up 2 spaces (i.e. a duplicate).
Do we have to make our VRAM array size 32 in our code or can we make it 16. (And of course printing the duplicate of e...
ANONYMOUS wrote
Yes, Amitava said you can either do that or reload the pg 0 again (which would just be updating the "last accessed" variable).
I believe moving pointers was the intention, otherwise using an array of pointers to structs wouldn't have a...
Hi, I have the following questions about Project 2.
1. Based on the response in the post linked below which states that a process can only be loaded once, does this mean that after the fourth page (with page number 3) of a process has been loaded into...
Hi, I have the following questions about Project 2.
1. Based on the response in the post below stating that a process can only be loaded into RAM once, does this mean that after the fourth page (with page number 3) of a process has been loaded into ...
Hi, I am a bit confused with the role of the disk in the project. From my understanding we just have to initialise each of the 32 slots to their respective pointer structure, for example slot 0 and 1 would point to structure with process-id 0 and pag...
ANONYMOUS wrote
I don't think so, Amitava never said anything about an assumption sheet for this project. From his email he said to put any assumptions you made as comments in the file you submit. Make sure to put them at the top of the file.
ANONYMOUS wrote
The specification states that the struct you use "may" look like the one it provides. So, no you don't have to use the exact same struct. However, I do believe you need to use a struct.
ANONYMOUS wrote
Yes.
Global means evict the page in RAM with the lowest "last accessed" time. Local means evict the page from the same process in RAM with the lowest "last accessed" time (e.g. If you are loading process 0 onto RAM and RAM is full and ...
ANONYMOUS wrote
Amitava needs to clarify. I'm assuming you don't need a ";" at the end.
If memory isn't allocated, then how are you able to store anything in your structure?
Most likely, it's bad practice to not free dynamically allocated (or malloced)...
Hi, just making sure I understand correctly
In reality a page table for each process will be stored in RAM, however in this project only page frames can be stored on RAM - so I am assuming that we can use an array completely separate from main memory...
Hi,
After I ran the in.txt 0 2 1 3 3 2 2 0 2 1 0 2 3 0 , the out.txt format was as shown in the figure. I checked all the records in the help2002 and saw that some people had a ";" after the last line, while others did not. My result did not have a "...
Thanks
But one more question, the project specifies this structure
struct
int process id;
int page num;
int last accessed;
memory;
Would i be penalised if i do not use that struct or can i do this project in any way I like?
Yh, that was more for explaining my current understanding, and making sure that I am meant to remember the previous page.
I think this part explains it well though. Thanks a lot for that, it clears it up a good bit.
ANONYMOUS wrote
Yes.
Yes.
So the out.txt of the example above should look like this? For the RAM content is it process, page, time stamp; or page, process, time stamp; ?
I believe it follows the same order as the struct, which is process;page;last acce...
ANONYMOUS wrote
Yes.
Yes.
You need to remember the last page you loaded for each process. It's up to you how to determine how to do that.
Since RAM is full and there is no page of process 3 on RAM, we can't use local LRU to make room, we need to use glo...
Hi I am just wonder if i do the project with a partner would just one of us submitting be enough and do we just submit simulation.c file or do we submit the exe file as well?
I'm having some difficulties grasping a few ideas and want some clarifications on them if possible. So, lets say the contents of in.txt are, "0 1 1 1 1 2 2 2 2 3 3 3 0", you'd end up with the first 0 being evicted without another page from process 0 ...
This input is on the project sheet 0 2 1 3 3 2 2 0 2 1 0 2 3 0
at t 7, the RAM should look like this right?
0 2 1 3 3 2 2 0
then at t 13 the RAM would look like this right, since local LRU means that the next page replaces ...
ANONYMOUS wrote
If you are ignoring the input the time stamp wouldn't increase since you aren't loading it into RAM.
I'm not sure how project 2 will be marked. You would have to ask Amitava to know for certain. Projects are usually automatically marke...
Will our submissions be manually marked, or will the output.txt be automatically marked against a reference solution?
Under clarification 1 we are allowed to either ignore a process id if all of the pages are in RAM or we can bring in the 0th page. Th...
But we will have to change the time step of the page which is already there and also been requested next. otherwise we will not be able to know the least recently one
Yes, Virtual Memory doesn't change. We are just moving pointers in and out of RAM (and updating the page table to keep record of where the pages are in RAM).
np
Simulations are a model or abstraction of the "real world", they do not 100 match what is done in practice. How much a simulation matches the real world depends on the level of detail necessary (as per the specification). With all simulations you ne...
Hi, based on the current implementation, once every process has at least one page in RAM and the RAM is full, the number of pages for each process effectively gets "locked in" because the local LRU will prioritize evicting a page from the same proce...
I see So when we remove it from RAM we just remove the pointer to it in the RAM while the pointer in the Virtual Memory never changes?
And yes, I was asking if they were separate arrays. Thanks for the help Joshua
ANONYMOUS wrote
Answered here
https secure.csse.uwa.edu.au run help2002?p np opt U564
Their contents are not disjoint (e.g. for the example you gave, after the first-time step the pointer for page 0, process 0 will be in both RAM and Virtual Memory)...
Hi there Just a few questions to clarify if I'm understanding correctly
1.
From an earlier forum question it is stated that
https secure.csse.uwa.edu.au run help2002?p np opt U557
in.txt
0 1 2 3 0 1 2 3 0 1 2 3
out.txt
99, 4, 0, 99
99, 5, 1, 99
99, 6, 2, ...
There will be a maximum of 8 pages in RAM.
It does make sense. You can identify a specific page by its process id and page number.
Why will there need to be 2 different processes in RAM? Technically a page from each process can be in RAM. Unless you ar...
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 o...
ANONYMOUS wrote
It can be initialized sequentially. So long as the disk starts with all the process pages inside. So, 0-3 pages for each of the 0-3 processes.
Yes, as the spec states if a page of a process isn't in RAM its entry in the page table is 9...
Question 1
In terms of disk initialization when saving all the 32 locations, should the pages be initialized in random order, or is it expected that the process pages will be initialized sequentially? For example, starting with process 0, page 0, pag...
Occurs when RAM is full and you are trying to load a new page into memory. E.g. If page 0 of process zero is in memory and RAM is full and you are trying to load the next page of process 0, then you evict the least recently loaded page of process 0 (...
Hi, Just 2 questions about the assignment,
With the global least recently used eviction policy, does this only occur when we try to add a page already in the memory to the memory?
Also, since the output is only interested in the ram, what is the purpos...
This is really hard to read and hard to know what question you are asking.
I mean for one, your output doesn't print empty slots. It also doesn't print the same slot twice. The structure for some reason has 99 in it? 99 should only be used in the page...
RAM starts empty. You only load processes based on the file.
At instruction 0, there is no process to evict. Since the RAM is empty.
Amitava said a process can only be loaded once. So, the fifth 0 would be ignored.
I think that was a mistake on Amitava...
ANONYMOUS wrote
You would just ignore all lines except the first. However, best practice is to stop processing the file if you detect multiple lines since you would assume the file was corrupted.
ANONYMOUS wrote
That is the spec unless Amitava changes it. The output doesn't really "show" the default time anyway. Since you only print the times of pages that are loaded onto RAM.
ANONYMOUS wrote
Yes.
I believe you still have to print "Empty" unless Amitava clarifies.
I wouldn't say so since the spec states to print the contents of RAM, which would include the empty slots.
the way I understand the project is that it starts loaded in with the first 2 processes (page numbers 0-7) but because there are 16 pages in disc there is also a copy of process 0 and 1 in disc
so instruction 0
bring in least recently used page into R...
Hello, I know this quesiton has been answered but I dont fully understand it.
If the input is 0 0 0 0 0 0
Would it load the first 4 pages into RAM then reload the first page then reload the second page, with the reloaded pages having new time stamps?
A...
Because of the line "The simulation starts by reading a file where there is a single line of
integers separated by blanks" do we need to error check for multiple lines or will it just be assumed we wont be provided with more than one line in the in.tx...
The default time for pages is 0
The simulation starts at time 0
If I access the first page, I will set its time to 0, and update the simulation time to 1.
Which kinda makes it look likes its done nothing.
The default time for pages could be changed to -1...
Hey, I'm also not sure what to do in this case. Say the input string was 0 0 0 0 0 0 0 0. Do we load process 0 into RAM twice, and effectively load its 4 pages twice? Or should allow a process to be completely loaded into RAM only once?
Hello,
I've seen a few posts already saying that if the input file tells us to bring the next page of process 0 to RAM, but all pages of process 0 are already in RAM, then we should update the last accessed time of the 0th page of process 0 to the new...
Are pages loaded into RAM cyclically, or on a lowest-index basis?
For example, if the page table of process 0 looks like this 99, 2, 4, 99 , this means that page 0 and 3 are in disk while 1 and 2 are in RAM.
his may happen if pages 0,1,2 were loaded...
Sorry I was referring to the outdated project description. the newer one has says "If there is no page of the process whose page you want to bring in, use a global LRU policy, evict the page that is least recently used among all pages in the RAM."
Ne...
Should our program account for any errors such as incorrect inputs being passed into the command line or incorrect data type or if an integer like 4 is located inside in.txt?
Could I clarify my out.txt results as I am not sure if what I have done is correct.
in.txt
0 1 2 3 0 1 2 3 0 1 2 3
out.txt
99, 4, 0, 99
99, 5, 1, 99
99, 6, 2, 99
99, 7, 3, 99
RAM Contents
0,2,8; 0,2,8; 1,2,9; 1,2,9; 2,2,10; 2,2,10; 3,2,11; 3,2,11; 0,1,4; 0,1...
Actually the best practice is to never call "exit" because it doesn't end the program "gracefully". The best practice is to return EXIT FAILURE (1) in main. If you are interested.
If you encountered a number outside of 0-3 then you would assume the file is corrupted and you shouldn't continue reading. So best practice is to print an error message then call exit(EXIT FAILURE).
If you countered a number outside of 0-3 then you would assume the file is corrupted and you shouldn't continue reading. So best practice is to print an error message then call exit(EXIT FAILURE).
So, if any process request comes other than 0 to 3 in the input string, I am skipping that process and processing rest of the processes as required without printing any error
Yes that seems right. just remember that Disk has all 16 pages in it (4 for each process) and disk is never changed. Also RAM has frames 0-7. Processes have pages 0-3.
so if the RAM has page numbers 0-7 from processes 0 and 1 all initially time step 0, and the disc has processes 2-3, and we receive the instruction '0' there is nothing to move in from the disc as all of process 0 is in RAM.
We need to evict the first...
You need to make your own tests and see if your program produces what you expect given the project specification. I've given one example here
https secure.csse.uwa.edu.au run help2002?p np opt U525
I'll just change the output to avoid confusion. Shame there is no edit option on the forum
0 99 99 99
1 99 99 99
2 99 99 99
3 99 99 99
0,0,0;0,0,0;1,0,1;1,0,1;2,0,2;2,0,2;3,0,3;3,0,3;Empty;Empty;Empty;Empty;Empty;Empty;Empty;Empty;
Will we be expected to sanitise or validate the input file?
For example, if the input file requests the next page for process 9 (obviously doesn't exist), should we print an error? Or perhaps shoudl we catch any potential invalid inputs and skip them...
yes that's the page table, with corrected indexes it looks like this
process 0 0,1,2,3
process 1; 4,5,6,7
process 2 99,99,99,99
process 3 99,99,99,99
process 0 and 1 are loaded into ram with values 0-7
but now there is a new issue with instruction '0'
'...
Isn't this your page table?
process 1 0,1,2,3
process 2 4,5,6,7
process 3 99,99,99,99
process 4 99,99,99,99
It's hard to follow what you are doing to RAM and disk because it doesn't provide information as to which page of which process is in RAM. RAM ...
Ok that makes sense,
RAM and DISC are the values of the page table of the currently loaded processes so
RAM 0,1,2,3,4,5,6,7
DISK 99,99,99,99,99,99,99,99
instruction 3
RAM 0- 99 (evicting process 1 (value 0) and replacing with process 3 (value 99)),1,2,...
If you're having issues tracking down the source of the segfault, I would recommend taking a look at Valgrind, I've found it quite helpful in the past.
When constructing your array of pointers to structures did you make sure to malloc memory to them before accessing their contents?
Segfault means you are going out of bounds in memory. If malloc wasn't used the pointer points to nothing (no memory) s...
I'm not sure what your question is about. Are you asking what happens if RAM is full and we are bringing in another process which isn't in RAM?
In that case you would evict the page of any process with the lowest "last accessed" time.
Also, not sure ...
ANONYMOUS wrote
Also, I should mention the contents of RAM I did was incorrect. The first digit should represent the process and the second should represent the page but I accidently did it the wrong way around.
ANONYMOUS wrote
There is a specific format. Pretty much the one I provided. Except for the empty sections of the RAM because it isn't specified in the spec what should be printed if RAM is empty. Amitava would have to clarify.
Hi, if there are only 5 integers in the in.txt, should I set my last 6 entries in out.txt to something like Empty? Also, is the format of out.txt defined? Or can I stylize it anyway I want?
Eg
in.txt
0 1 2 3 0
out.txt
Process 0 0, 4, 99, 99
Process 1 1...
Hi,
if we load the page frames in sorted by page num the memory looks like this
process 1 0,1,2,3
process 2 4,5,6,7
process 3 99,99,99,99
process 4 99,99,99,99
RAM 0,1,2,3,4,5,6,7
DISK 99,99,99,99,99,99,99
but if we get the instruction '3' there is no...
Hi,
In Project 1, we were instructed to specify the operating system we used, but there is no mention of this in the Project 2 instructions. Should we still indicate which OS we are working on, such as macOS or Linux?
Additionally, my partner and I are...
ANONYMOUS wrote
You should have 4 pages in RAM.
I'm not sure if I understand your question but if you exceed the number of pages for a process you likely would need to evict the first loaded page for that process and replace it with the new process. I...
Each process has exactly 4 pages in VMEM which can be loaded to RAM.
Memory of struct pointers. When you store the pointers in VMEM you are storing the structs there also.
From the in.txt file you know the process to load onto RAM. You load the ne...
Hi,
Q1.
In the project briefing, it mentions
each proces can have 4 pages
Does that mean that each process can have up to 4 pages, or exactly 4 pages.
Q2.
Is the Virtual Memory an array of memory structs, or an array of memory struct pointers.
I'm a...
I C what you mean. I think it's a typo, I think it is just 4 processes. Otherwise, the size of virtual memory wouldn't be enough to store all the processes. To be certain Amitava would need to clarify.
ANONYMOUS wrote
The project sheet states you "can" work as a group. So, I'm assuming that means it's fine if you work alone. Project is definitely small enough to do on your own.
The project sheet said the project can be done in a group of two, but I would like to do it alone. Just wondering if is it allowed to do that. Or it's a requirement to work in a group?
In the project description it says there will be 4 processes, then a bit later it says they will be numbered 0...4 which is 5 processes. Which one is it?