# Assignment 2, Question 5 and 6

Posted by mwolvaardt
Announcements Last Post
SoC Curricula 09/30/2017 01:08PM
Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
School of Computing Short Learning Programmes 11/24/2014 08:37AM
Unisa contact information 07/28/2011 01:28PM
 Assignment 2, Question 5 and 6 May 02, 2007 11:53AM Registered: 14 years ago Posts: 46 Rating: 0
Hi,

Has anyone attempted these 2 questions? I'm stuck and would really appreciate any assistance.

Regards,

Marnus.
 Re: Assignment 2, Question 5 and 6 May 02, 2007 10:05PM Registered: 12 years ago Posts: 457 Rating: 0
HI Marnus, for question 6 i don't think all the answer was straight out the book but you can get most of it from the part on fragmenation on pg 287. For question 5 i showed my working just like they do in the text book did ( fig 9.12 on pg 332 or fig 9.14 pg 333 or fig9.15 pg 334). i used a table , with 3 rows for the frames and a 4th row to show the page fault number (basically 1 on every fault so you jsut dont add one where there is no change to the frames, which happens when a character comes up which is already in one of the frames) That is the best way i thought to show each character going into the frames,
Do you know how to apply the different page algorithms or is this where you are stuck? these diagrams are the best way to see how the algoriths work, heres a summary but go folllow the explanations for these graphs step by step:

FIFO: Each character goes into frame, oldest character gets replaced first, every replacement counts as a pae fault. only when there comes a character that is already in a frame then no page fault occurs.

Optimum: characters go in again one by one, now instead of replacing the oldest charater you look ahead at whats coming up in the string, and replace the character in frame that is not going to reappear, or is going to reappear in the string the latest. ie if your frame has (2, 0 , 4) and the remainder of your string still needing to be read in is 1, 3, 0, 2, 7 you can see 0 is coming up soon, then 2 and 4 isn't coming up again . so you can replace 4.. then next to be replaced is 2, because 0 comes up again before 2...

LRU: here you replace the character thats was used the longest time ago. i think if i try explain this i might confuse you and myself. see if you get the first 2 right then try the LRU.

hope this all makes sense? if not mail me ildsarria@gmail.com
 Re: Assignment 2, Question 5 and 6 May 02, 2007 10:09PM Registered: 12 years ago Posts: 457 Rating: 0
eg FIFO:
```
a, b, c,   a,  d,  e

a  a  a	       d   d
b  b	       b   e
c	       c   c
1  2  3	       4   5   <--- number of page faults

```
 Re: Assignment 2, Question 5 and 6 May 03, 2007 11:48AM Registered: 14 years ago Posts: 46 Rating: 0
Thank you very much for your help iva. Starting to make some more sense now.
 Re: Assignment 2, Question 5 and 6 May 09, 2007 08:03PM Registered: 13 years ago Posts: 41 Rating: 0
I found the study guide more useful than the prescribed book for question 5.1
Sorry, only registered users may post in this forum.