By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,253 Members | 1,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,253 IT Pros & Developers. It's quick & easy.

perl script for simulation of various page replacement algorithm

P: 3
must be algorithm as OPTIMAL,FIFO and LRU and have average sum of page faults pr. algorithm.
sum of simulations i want it to do is ex 5000
and can choose the size of the memory.That means the sum of adresses which the refferance string could generate ex.[0-7]
The sum of frames the process shall have access to
And how long the refferance string should be.

Have had troubles for weeks now how i should begin :(
looking forward to some who can help me :)
Mar 27 '08 #1
Share this Question
Share on Google+
6 Replies


KevinADC
Expert 2.5K+
P: 4,059
must be algorithm as OPTIMAL,FIFO and LRU and have average sum of page faults pr. algorithm.
sum of simulations i want it to do is ex 5000
and can choose the size of the memory.That means the sum of adresses which the refferance string could generate ex.[0-7]
The sum of frames the process shall have access to
And how long the refferance string should be.

Have had troubles for weeks now how i should begin :(
looking forward to some who can help me :)

Start here:

Expand|Select|Wrap|Line Numbers
  1. #!usr/bin/perl
  2. your perl code goes here
Mar 27 '08 #2

eWish
Expert 100+
P: 971
Please read the "Guidelines To Ensuring Better Answers and Assistance To Your Thread(s)" thread. Also pay close attention to number nine. Once you have done that then we might be able to help.

--Kevin
Mar 28 '08 #3

P: 3
have come so far

Start he
Expand|Select|Wrap|Line Numbers
  1. #!usr/bin/perl
  2. your perl code goes here
Expand|Select|Wrap|Line Numbers
  1. # Legger argument i variabler.
  2.  #$ant_sim=$ARGV[10];
  3.  #$ant_adr=$ARGV[6];
  4.  #$ant_frames=$ARGV[5];
  5.  #$ref_streng=$ARGV[10];
  6.  # Tester om det er satt argument.
  7.  if($#ARGV != 4){
  8.     print"Feil argument er satt.\n";
  9.     exit;
  10.  }
  11.  # Array for type algoritme i bruk.
  12.  @alg=("FIFO","LRU","OPT");
  13.  #oppretter teller for algoritmer.
  14.  $alg_teller=0;
  15.  # Array for page-tabell(logiske minnet).
  16.  # Array for frame-tabell(fysiske minnet).
  17.  @pgtab=(0,1,2,3,4);
  18.  my @frtab;
  19.  # Oppretter teller for ref-strengen.
  20.  $ref_teller=0;
  21.  # Array for referansestrengen.
  22.  @refstreng=(1,4,2,3,6,7,8,5,8,9,-1); 
  23.     for($i=0;$i<10;$i++){
  24.         print "$refstreng[$i]\n";
  25.     }
Mar 28 '08 #4

KevinADC
Expert 2.5K+
P: 4,059
I have no idea what you are trying to do. I am note sure if it is because you are not an English speaker and something is getting lost in the translation or maybe I just do not undersatnd what this means: "simulation of various page replacement algorithm". To me that makes so sense. And the code you posted does not help to understand what it is you are trying to do.
Mar 28 '08 #5

P: 3
I have no idea what you are trying to do. I am note sure if it is because you are not an English speaker and something is getting lost in the translation or maybe I just do not undersatnd what this means: "simulation of various page replacement algorithm". To me that makes so sense. And the code you posted does not help to understand what it is you are trying to do.
norvegian :)
this program can simulate Optimal ,FIFO and LRU algorithm for access of memory.And i see now the script should have been in english. Sorry
Mar 28 '08 #6

KevinADC
Expert 2.5K+
P: 4,059
norvegian :)
this program can simulate Optimal ,FIFO and LRU algorithm for access of memory.And i see now the script should have been in english. Sorry
Sorry, I don't know anything about Optimal FIFO LRU algorithims.
Mar 28 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.