Пример #1
0
 /**********************************************************************
  *********************************************************************/
 void B_Set_Mbit_Clicked(object sender, EventArgs e)
 {
     if (currentStep > -1)
     {
         //set m-bit of current page
         ram[currentStep, indexCurrentPage, 2] = 1;
         ram[currentStep, 0, 5] = 1;
     }
     PageReplacementStrategiesDraw.Paint();//Update Canvas
 }
Пример #2
0
        //METHODS

        /**********************************************************************
         *********************************************************************/
        void B_Set_Rbit_Clicked(object sender, EventArgs e)
        {
            if (currentStep > -1)
            {
                //Set r-bit of current page
                ram[currentStep, indexCurrentPage, 1] = 1;
                //ram[currentStep, 0, 4] = 1;
                PageReplacementStrategiesDraw.Paint();//Update Canvas
            }
        }
Пример #3
0
 /**********************************************************************
  *********************************************************************/
 void B_Reset_Rbits_Clicked(object sender, EventArgs e)
 {
     if (currentStep > -1)
     {
         //reset all r-bits of current step in ram
         for (int j = 0; j <= ram.GetUpperBound(1); j++)
         {
             if (ram[currentStep, j, 1] == 1)
             {
                 ram[currentStep, j, 1] = 0; //r-bit reset
                 ram[currentStep, j, 4] = 1; //mark r-bit as reset
             }
         }
         PageReplacementStrategiesDraw.Paint();//Update Canvas
     }
 }
Пример #4
0
        /**********************************************************************
         *********************************************************************/
        void B_Next_Clicked(object sender, EventArgs e)
        {
            currentStep++;
            currentPage = SequenceList.First();
            SequenceList.Remove(SequenceList.First());
            switch (strategy)
            {
            case "Optimal Strategy":
                Optimal();
                break;

            case "FIFO":
                Fifo();
                break;

            case "FIFO Second Chance":
                FifoSecond();
                break;

            case "RNU FIFO":
                Rnu();
                b_Reset_Rbits.IsEnabled = true;
                b_Set_Rbit.IsEnabled    = true;
                b_Set_Mbit.IsEnabled    = true;
                break;

            case "RNU FIFO Second Chance":
                RnuSecond();
                b_Reset_Rbits.IsEnabled = true;
                b_Set_Rbit.IsEnabled    = true;
                b_Set_Mbit.IsEnabled    = true;
                break;
            }
            PageReplacementStrategiesDraw.Paint();//Update Canvas
            b_Restart.IsEnabled = true;


            //disable next button if the sequence was processed entirely
            if (currentStep == sequenceLength - 1)
            {
                b_Next.IsEnabled = false;
            }
        }