It's UWAweek 45 (2nd semester, 2nd exam week)

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying the 12 articles in this topic
Showing 12 of 827 articles.
Currently 7 other people reading this forum.


 UWA week 42 (2nd semester, week 12) ↓
SVG not supported

Login to reply

👍?
helpful
5:31pm Mon 14th Oct, ANONYMOUS

Hi, can you check if the output below is correct using the LRU eviction method if the RAM is fully occupied? in.txt 0 0 0 0 0 1 1 2 2 3 3 2 2 1 1 out.txt 99, 99, 99, 99 99, 99, 4, 5 6, 7, 3, 0 1, 2, 99, 99 RAM Contents: 2,3,12; 2,3,12; 3,0,9; 3,0,9; 3,1,10; 3,1,10; 2,2,11; 2,2,11; 1,2,13; 1,2,13; 1,3,14; 1,3,14; 2,0,7; 2,0,7; 2,1,8; 2,1,8 Once all 4 pages of process 0 have been loaded, the 5th page is assumed as page 0 again. Request 5, Process 0, Page 0 (again) Page 0 is already in RAM. Update its last accessed time to 4 Thank you!


SVG not supported

Login to reply

👍?
helpful
5:41pm Mon 14th Oct, ANONYMOUS

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 process is in the RAM and the RAM is full each process will have a consistent number of pages. In this case you would end up with 3 process 0, 2 process 1 pages, 2 process 2 pages and 1 process 3 page. You are correct that you can update the last access time of the page 0 process 0 after the 5th 0 though.


SVG not supported

Login to reply

👍?
helpful
8:17pm Mon 14th Oct, ANONYMOUS

ANONYMOUS wrote:
> 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 process is in the RAM and the RAM is full each process will have a consistent number of pages. In this case you would end up with 3 process 0, 2 process 1 pages, 2 process 2 pages and 1 process 3 page. > > You are correct that you can update the last access time of the page 0 process 0 after the 5th 0 though.
Noted, I've made the changes. Could you verify if this should be the correct output? Thanks! in.txt 0 0 0 0 0 1 1 2 2 3 3 2 2 1 1 out.txt 0, 99, 2, 3 99, 99, 4, 5 99, 99, 6, 7 99, 1, 99, 99 RAM Contents: 0,0,4; 0,0,4; 3,1,10; 3,1,10; 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


SVG not supported

Login to reply

👍?
helpful
8:56pm Mon 14th Oct, ANONYMOUS

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.


SVG not supported

Login to reply

👍?
helpful
9:21pm Mon 14th Oct, Joshua N.

Looks good.


SVG not supported

Login to reply

👍?
helpful
11:09pm Mon 14th Oct, ANONYMOUS

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;


SVG not supported

Login to reply

👍?
helpful
8:50am Tue 15th Oct, Joshua N.

Thanks. Your solution is correct.


SVG not supported

Login to reply

👍?
helpful
4:09pm Tue 15th Oct, ANONYMOUS

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 other processes right? my input and output is as follows in.txt 0 0 0 0 0 1 1 2 2 3 3 2 2 1 1 out.txt Process 0 : 99 99 99 99 Process 1 : 5 99 4 99 Process 2 : 6 7 2 3 Process 3 : 0 1 99 99 0,3,9; 0,3,9; 1,3,10; 1,3,10; 2,2,11; 2,2,11; 3,2,12; 3,2,12; 2,1,13; 2,1,13; 0,1,14; 0,1,14; 0,2,7; 0,2,7; 1,2,8; 1,2,8;


SVG not supported

Login to reply

👍?
helpful
4:26pm Tue 15th Oct, ANONYMOUS

Okay nevermind, i have'nt read the specification properly.


SVG not supported

Login to reply

👍?
helpful
4:33pm Tue 15th Oct, Joshua N.

ANONYMOUS wrote:
> 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 other processes right? my input and output is as follows > > in.txt > > 0 0 0 0 0 1 1 2 2 3 3 2 2 1 1 > > out.txt > > Process 0 : 99 99 99 99 > Process 1 : 5 99 4 99 > Process 2 : 6 7 2 3 > Process 3 : 0 1 99 99 > 0,3,9; 0,3,9; 1,3,10; 1,3,10; 2,2,11; 2,2,11; 3,2,12; 3,2,12; 2,1,13; 2,1,13; 0,1,14; 0,1,14; 0,2,7; 0,2,7; 1,2,8; 1,2,8;
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: 1 1 2 2 is loaded. RAM is now full. 4. Since RAM is full we need to evict a process to make room for 3, but no page of 3 is currently on RAM so we need to use "global" LRU instead of "local". 5. At time 9: The first 0 on RAM is evicted and replaced with 3. 6. At time 10: The next 3 is loaded and replaces the other 3 ("local" LRU). 7. At time 11, 12: 2 2 replaces the 2's currently in RAM ("local" LRU). 8. At time 13, 14: 1 1 replaces the 1's currently in RAM ("local" LRU). so in the end the contents of RAM are: 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;


SVG not supported

Login to reply

👍?
helpful
5:30pm Tue 15th Oct, ANONYMOUS

Hi I would like to see if these test outputs are correct: in.txt: 0 0 0 0 0 1 1 0 0 0 1 1 2 3 3 2 1 2 out.txt: 99, 99, 2, 3 4, 5, 6, 7 99, 99, 0, 99 99, 1, 99, 99 2,2,17; 2,2,17; 3,1,14; 3,1,14; 0,2,2; 0,2,2; 0,3,3; 0,3,3; 1,0,5; 1,0,5; 1,1,6; 1,1,6; 1,2,10; 1,2,10; 1,3,11; 1,3,11; in.txt: 0 0 0 0 0 1 1 2 2 3 3 2 2 1 1 out.txt: 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; int.txt: 0 0 0 0 1 0 0 2 3 1 0 2 3 3 2 out.txt: 0, 1, 2, 3 4, 7, 99, 99 99, 99, 5, 99 99, 99, 6, 99 0,0,0; 0,0,0; 0,1,1; 0,1,1; 0,2,2; 0,2,2; 0,3,3; 0,3,3; 1,0,4; 1,0,4; 2,2,14; 2,2,14; 3,2,13; 3,2,13; 1,1,9; 1,1,9;


SVG not supported

Login to reply

👍?
helpful
8:49am Wed 16th Oct, Joshua N.

Answered here: [help2002]

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy