Don't worry. He is still in the process of resolving issues with the marks and he can still adjust the marks after they have been released. Please send him an email again if you still haven't received a response.
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...
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
Hi,
What Amitava said is correct and so are the other sources (as well as Anon).
A file pointer is a pointer to a file structure, which contains useful information that makes reading writing to files easier. It allows you to treat a f...
ANONYMOUS wrote
All good, this question isn't worded well.
This is the program you are meant to make.
If there are 3 executable programs named ls and 2 named cp that can be found via a PATH environment variable, then the function wil...
Please state the question because it takes a while for me to find it.
But yes, as anon said, assuming all months have 31 days is fine (just make sure you state it when answering the question).
ANONYMOUS wrote
Kind of, they are very similar techniques, the only difference is memory segmentation can provide a process with multiple partitions (or segments) whereas dynamic partitioning only provides one partition per process.
e.g.
With dynamic ...
ANONYMOUS wrote
Strictly handwritten. Do not use a tablet, I had a friend that got their printed tablet notes confiscated because they don't look "handwritten" enough.
np
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.
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
Not completely sure what you mean but you don't need to provide code for this question. Recall there are two types caching methods you can use that apply the principle of Locality of Reference and you can use two examples to demonstrate how they can ...
With this type of question, you would define and explain the Principle of Referential Locality, then create two scenarios (or examples) that demonstrate how it works and how the OS can use it to improve performance.
Ultimately the question is testing ...
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...
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 ...
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...
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...
Could you state exactly which part of the specification you are referring to? Or what it said exactly? I can't seem to find it. The spec states
"The last accessed time of a page will be the time step when you brought the page to RAM. For example, aft...
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...
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)...
ANONYMOUS wrote
Normally half the exam is a writing C code by hand but since Amitava is teaching the unit now that may not be the case. You would have to ask him.
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...
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...
ANONYMOUS wrote
Not sure, you would have to ask Amitava to know for sure. I don't think it will be larger than 10000 inputs.
0 1 2 3
99 99 99 99
99 99 99 99
99 99 99 99
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...
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)...
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...
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...
If you mean RAM is full and you are trying to load a new page onto RAM, so you need to use LRU algorithm to make room then yes.
I mean the program will still output what it is meant to (it will still work) but I'm not sure if Amitava will be fond of t...
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 (...
You have no idea what is in stdout when you call print. When you call print the buffer is "flushed" everything inside of it comes out. So, there no guarantee that the result will always be print 4 times. As the correct answer said "The form of out...
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
Depends on Amitava. I would guess, based on the specification that there wouldn't be a trailing ";", since its only purpose is to separate the locations.
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.
ANONYMOUS wrote
Hi,
Amitava can't access the lab sheets on Chris's website. So, I'm not sure if there will be anymore lab sheets. If there are he will upload them to LMS.
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).
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.
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;
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 ...
ANONYMOUS wrote
See here
https secure.csse.uwa.edu.au run help2002?p np opt U516
Gave an example of output here
https secure.csse.uwa.edu.au run help2002?p np opt U525
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.
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...
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.
ANONYMOUS wrote
There are no stupid questions. Only stupid answers.
I think either will be accepted since it wasn't specified if ml print statement will print a newline at the end or not. I think logically it would make more sense if ml did print a n...
ANONYMOUS wrote
Do not make your code public until all the late submissions are in. Some people will have extensions and so they will still be doing their project.
ANONYMOUS wrote
I don't think Amitava can modify the website. Only Chris can because it is his website. I'm guessing Amitava will place updated on LMS as needed.
ANONYMOUS wrote
Doing your own research is fine so long as you use the approved c11 libraries (e.g. methods from string.h). I think a good rule of thumb is to only use the c libraries covered in labs and lectures.
I can't be 100 sure. If I had to guess it would have something to do with the compiler you are using. E.g. mac vs linux. gcc is more particular wants things done a certain why. I think clang is more lenient. Or in other words I think you are using d...
I don't think you completely understand how argument passing works in ml. Have you read these posts?
https secure.csse.uwa.edu.au run help2002?p np opt U441 hl arg0
https secure.csse.uwa.edu.au run help2002?p np opt U344 hl arg0
Firstly, remember that you need to submit 1 c source file. So, you need to merge these files together.
The error you are getting usually mean you are trying to compile an object file. In other words a file with the ".o" extension. Object files are us...
Could be anything. Need more information.
A common error is people don't pass the correct path to the file in execv or system. So, they try to compile a file that "doesn't exit" and so compilation fails.
You would have to ask Chris since he wrote the project, usually it is fine. However, you definitely can't share the solution to the project until all late submission are in.
ANONYMOUS wrote
This is not what Chris means. He means to not submit header files (e.g. you can't submit a header file you wrote). You still have to import header files or compilation will fail.
Your code won't compile if you do this.
This is what ...
ANONYMOUS wrote
You can make assumptions about any of the project requirements that are unclear. In the doc you are stating what you believe you are meant to do or what you believe the requirements are telling you to do. E.g. one assumption could be ...
ANONYMOUS wrote
No, I don't think so, since they represent the command line arguments. However, since it hasn't been clarified you can put whatever you assume in the doc.
ANONYMOUS wrote
Possibly, but it is a bit ambiguous you could probably have an assumption in your assumption doc about it.
This definitely has to be true.
I believe the point 9 is stating that in the ml file the function definition has to come before t...
ANONYMOUS wrote
Option d is wrong. You just had a lucky number choice where the result is the same.
If you first divide by ten you perform integer division and so the result becomes 2409, modulo 100 gives 09, which is 9 in this case.
A is correct. modu...
ANONYMOUS wrote
I believe Chris intended students to actually parse the strings themselves. If you want confirmation, you will have to ask Amitava. Honestly, I don't think regex.h will make your life easier.
ANONYMOUS wrote
I mean a lot of the advice given on the forum is based off the project requirements and clarifications Chris made, so it really depends on which advice you are talking about.
A rule of thumb for assumptions is If you make an assumpti...
ANONYMOUS wrote
This is a statement, so yes. pqr will be zero so it won't matter. sas will cause the error, since there are two identifiers followed after each other in a statement, which is invalid syntax.
This is invalid syntax.
program
A program is made up of zero or more program items.
program-item
A program item is either a statement or a function, a function can have zero or more identifiers.
statement
A statement is either an assignment or a pri...
ANONYMOUS wrote
The file is temporary and will be deleted by your program. So, you can name it whatever you want (but make 110 sure the name doesn't and will not collide with other file names when run on other people's computers). However, the reaso...
ANONYMOUS wrote
Write them to the file into their respective identifiers. E.g. arg0 is argv 2
assumption.
I believe Chris said that you can assume the appropriate number of command line arguments are passed to the ml program
https secure.csse.uwa....
ANONYMOUS wrote
You can't pass "integers" to a function; the arguments are always doubles, so even if you pass 2, because the argument was defined to be a double, it will become 2.0. Every time you see a constant number, just put (double) in front of...
ANONYMOUS wrote
Amitava needs to answer this one.
From project specification
"Your submission will be examined, compiled, and run on a contemporary Ubuntu Linux or macOS platform. Your project only needs to execute successfully on one of these platfo...
Hi Yuxuan
You are allowed to make assumptions and submit them with your code submission. I believe the original intension was that all expressions will be valid, so you don't need to check them. Statements in a function should be 1 tab and everything ...
ANONYMOUS wrote
Yea that's fine as long as you delete all the files you create.
The only thing that needs to be a single file is the runml program itself.
ANONYMOUS wrote
Yes, otherwise if you have already done it Amitava said you can state the assumptions you made in a file. So, you can do either, just state what assumption you made.
If you want to be 100 sure you can ask Amitava.
You can always do something with var to remove the warning. Literally just do var var 1 and the warning will go away.
ANONYMOUS wrote
Technically they're not considered "identifiers" just "variables". So, in other words, they're an exception to the rule. As stated in the project description
"8.the variables arg0, arg1, and so on, provide access to the program's comm...
ANONYMOUS wrote
It does apply to comments. He made the change to make sure the project isn't too hard.
From Oxford English Dictionary
"white space n. (a) Typography the blank areas of a page or other piece of printed matter, as margins, gutters betwe...
ANONYMOUS wrote
You are missing something.
You replace the identifiers (in the ml file) arg0, arg1, arg2, etc. By the command line arguments that are passed to run ml. e.g.
. runml somefile.ml 1 2 3
means that in the ml file the parameters will be initi...
ANONYMOUS wrote
Why can't the same identifier name be reused? After the function ends the program would believe it is seeing the identifier for the first time and so would initialize it to 0.
ANONYMOUS wrote
I believe Chris said either in the forum or the project sheet that all statements must start at the lefthand most side of the file unless it is a statement in a function.
Not sure where a comment could appear (because technically comme...
It would. Or you can write an if statement in the c version of the ml file to change what is printed, then let c do the hard work.
That would make the most logical sense. Since warnings can be errors and do something unintended.
No guarantees about the...
Yes, I forgot there are no "if" statements in ml, because there are no "if" statements, it would run forever. So, don't worry about recursion. Can't see the point in testing an infinite loop.
ANONYMOUS wrote
Hey guys, ml accepts whole numbers, there is no example in the ml file where there is a decimal point after a whole number, e.g. 2.0 would just appear as 2 in the ml file. I'm assuming as more decimal places are required they will be ...
You wouldn't need to check mismatched brackets as Chris said expression checking isn't necessary.
Yes, if 24.00, print as 24. if 24.5, print as 24.500000
Not sure but better to be safe than sorry and assume it can be as deep as it is in C.
Hi Trisha,
Sorry for the delay.
If no clarification is given, better to be safe than sorry and assume it is possible. This functionality is allowed within the ml syntax.
Identifiers and functions shouldn't have the same name.
Syntax of ml allows this. You should be able to just copy the function call into c and it would work.
You need to change the format string of printf so that you print the double without any decimal places. Answered here
https secure.csse.uwa.edu.au run help2002?p np opt U245 hl integer
I would say so. Some warning in C are straight up errors and res...
ANONYMOUS wrote
Hi I don't believe empty lines are allowed in ml, all the sample files have no empty lines and instead use a comment to create an "empty" line.
ANONYMOUS wrote
Depends on whether the function returns a value or not. You could just always have the function return a double and just add return 0.0 to the end of the function if there is no return value.
ANONYMOUS wrote
If the ml file prints then the correct output should appear in the terminal. The ml file should throw an error if there a syntax error in the ml file. Likewise the ml file should correctly run and not throw an error if there are no er...
Hi Zexu,
"7.variables do not need to be defined before being used in an expression, and are automatically initialised to the (real) value 0.0"
"12. a function's parameters and any other identifiers used in a function body are local to that function, an...
Hi
From my understanding, Chris said "appearing" so, you should only see at most 50 unique identifiers in a single ml file. So, in the case above b would count towards the total.
ANONYMOUS wrote
Hi
From my understanding, Chris said "appearing" so, you should only see at most 50 unique identifiers in a single ml file. So, in the case above b would count towards the total.
Actually sorry, I just realized made a mistake the datatype used should be doubles not floats because it has more precision (e.g. reduces rounding errors). So that way if you're multiplying dividing real numbers and showing 6 decimal plac...
ANONYMOUS wrote
"4.only a single datatype is supported - real numbers, such as 2.71828"
All parameters will be real numbers (doubles) as that is the only datatype supported.
np.
It is this bit "Otherwise, whitespace can (but doesn't need to) appear anywhere else"
In other words, both ways of calling the function as you have shown above are correct. A function call can have white space but doesn't need to have white sp...
ANONYMOUS wrote
I feel you are reading too deeply into that section of that paragraph. If you continue reading
"The strategy is to first translate programs written in other languages, such as our ml, to C, to compile that translated C code using a st...
Hi Harrison
Sorry for the delay, unfortunately, there's been sudden changes to the teaching staff, so I have to wait for the new unit coordinator to clarify these questions.
Answered here https secure.csse.uwa.edu.au run help2002?p np opt U201
perr...
ANONYMOUS wrote
Honestly it would be very hard to tell if a statement is meant to be in a function but it isn't. Since ml syntax allows statements to be inside or outside a function, there's no way of telling if they belong to a function if they aren...
There are no integers in the ml program, all the constants are real numbers, as that is the only datatype supported by ml. So, all the constant integer values in the ml program are actually floats. e.g. "2" is technically "2.0". If there are rounding...
ANONYMOUS wrote
There are no guarantees what the last statement in a function will be, it could return, it could print, or it could be another statement (the syntax of ml allows this). So, relying on seeing a particular statement to know if the funct...
ANONYMOUS wrote
You do not need to display the comments in the c file. Since the c file gets deleted anyway. So, when you come across a comment in ml you can just ignore it.
Ok let me try writing this out again, since half of my response got deleted. When you run your program like so
. runml sample.ml
runml (your project) will read the ml file given as the first parameter (in this case sample.ml), it will validate th...
ANONYMOUS wrote
Hi anon, I'm not 100 sure what you are asking but when you run your program like so
. runml sample.ml
runml (your project) will read the ml file given as the first parameter (in this case sample.ml), it will validate the m...
Hi Chenjun,
When printed, numbers that are exact integers must be printed without any decimal places; other numbers must be printed with exactly 6 decimal places.
Your program wouldn't need two datatypes, it would just need to change the format string ...
ANONYMOUS wrote
Hi anon, I believe your question in answered in these two posts
https secure.csse.uwa.edu.au run help2002?p np opt U145
https secure.csse.uwa.edu.au run help2002?opt U132
Yes, that would break my cool idea. However, we can still fix it, just keep track of the quotes too. If we saw a quote ignore everything until we see another quote.
Unfortunately, ml only supports real numbers, which makes me sad as this circumstance ...
Hi Guys,
Sorry about the delays replying. Some questions about project requirements are really good so I need further clarification (from teaching staff) before I can respond (I don't want to make the project too hard). So, for now if you are unsure o...
I should also mention you'd likely need to recursively "check" functions, e.g. If you're checking the parameters and encounter another function, start checking the new function.
But like I said I'm not sure if it is necessary.
I'm not sure if it is necessary but it does sound like fun (if you're me anyway).
You could check the number of arguments by counting the number of commas and the number of open brackets without a closing bracket. If number of open brackets is 1, then...
Hi
Functions don't always have a return statement (see sample05.ml). Your other question in this post https secure.csse.uwa.edu.au run help2002?p np opt U145
Hey Guys, sadly I am not the prof, but I believe your questions are answered by the following posts
1. https secure.csse.uwa.edu.au run help2002?p np opt U145
2.https secure.csse.uwa.edu.au run help2002?opt U132
Hi, the way I remember it is that refers to a pointer if a datatype comes before it e.g. int . If there is no type beforehand, then is the dereference operation.
e.g. int p , declares a pointer to an int.
p refers to...
ANONYMOUS wrote
You're right. I think there is a typo in the answer. None of the options are correct. However, there is one option that is very close to the correct answer. Can you see which one it is?
ANONYMOUS wrote
One place to the left means index - 1 .
e.g. If an integer is at index 3 it will be at index 2 after the code runs. Likewise, if an integer is at index 1, then after the code runs it will be at index 0.
I hope that makes sense.
Hi Guys,
I am just reminding you to always keep up to date with the lectures, workshops and labs . If you don't you will struggle with this unit as there is a lot of content.
Do not skip the lab exercises they are assessable and build up the fou...
Hey Jinyoung
If I remember correctly floats are 4 bytes and doubles are 8 bytes (hence the name double) but Chris may need to clarify.
An integer value must be at least 2 bytes (or 16 bits) but it is usually 4 bytes (32 bits). It's a bit confusing ...