Results 1 to 4 of 4

Thread: FIFO sorting

  1. #1
    fanle is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default FIFO sorting

    Hey all
    I have to create a class that illustrates the implementation of FIFO page replacement algorithms on string of value passed in and then record the page faults incurred.
    The number of frames that is used is a fixed at 7 and the size of the string will be 20 values.

    I was thinking that the best way to create this would be to
    Put the string values in an array.
    Have a for loop reading values from the array and using a queue to show the FIFO.
    Then finally using an if statement to judge if the inserted value is the same as replaced and thus counting up the faults.

    Can you suggest if I am going about this the correct way or if there is a more efficient way of carrying this out.

    Thanks

  2. #2
    Mr.Beans's Avatar
    Mr.Beans is offline Senior Member
    Join Date
    Apr 2009
    Location
    Virginia Beach, Virginia
    Posts
    149
    Rep Power
    0

    Default

    I'm confused.

    What do you mean by page faults, frames, and value size?

    Is the value size the amount of strings passed in?

  3. #3
    fanle is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default

    By frames i mean that there will be the number of inserts done before the first one has to be removed.
    eg. say theres 3 frames
    1
    1 2
    1 2 3
    4 2 3

    The value size is the amount of numbers i will be using in the string.
    eg. there are 6
    1,2,3,4,5,6

    And a page fault is basically where the number inserted is not the same as the value being replaced

    I hope that explains things a bit better

  4. #4
    rdtindsm is offline Member
    Join Date
    Feb 2009
    Posts
    92
    Rep Power
    0

    Default sets ?

    This is evidently an algorithm that would be used in an OS to obtain a page that is needed in memory, but not present. it is a dynamic process, and of course works because most memory access is to places close to the current address.

    I had to something like this over a dozen years ago, but I was using C/C++ and don't remember a lot except that I was using a stack. Doesn't help you, but it would seem that you could use sets, and see if the current page is in the set.

Similar Threads

  1. Sorting 3 Integers Using If Else
    By MSteinman in forum New To Java
    Replies: 12
    Last Post: 02-19-2010, 12:52 PM
  2. FIFO communication over a unreliable UDP
    By r_rama in forum Networking
    Replies: 1
    Last Post: 12-21-2008, 09:04 AM
  3. sorting
    By jot321 in forum New To Java
    Replies: 18
    Last Post: 10-02-2008, 10:30 AM
  4. sorting problem...
    By mark-mlt in forum New To Java
    Replies: 4
    Last Post: 04-17-2008, 02:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •