Using CLOCK replacement algorithm to simulate request paging system (operating system course design)

Contents
1. Course design purpose 1
2. Course design content and requirements 2
3. System analysis and design 2
1. System analysis
2 2. System design: 2
4. System testing and debugging analysis 5
1. System testing 5
2. Debugging analysis : 6
V. User Manual 7
2. Successful login, enter the main page of the system 7
3. Choose the way to read from the file to generate jobs (after clicking OK) 8
5. Simulate the CLOCK algorithm for reading from the file (click to start) 8
5 . Click the reset button to set all the contents of the interface to 9
6. Select the random generation method to generate jobs 9
8. Click the pause button to check the memory usage 10
9. Click the continue button to continue the program 11
10. Write the generated job pages to the file (d://b.txt) 11
11. Click the exit button to exit the system safely. 126.
Program list 127.
Experience and self-evaluation 178.
References 179.
Course design evaluation 172.
Course design content and requirements
Design content:
use CLOCK replacement algorithm to simulate request paging system
Design requirements:

  1. A page replacement algorithm that implements request paging storage management: CLOCK algorithm
  2. The number of physical memory blocks is fixed at 15, and the strategy of variable allocation and global replacement is used to allocate physical blocks for multiple jobs
  3. Job quantity and job size (10-20 pages) can be set on the interface
  4. All jobs are scheduled according to the RR algorithm, and the time slice length is 1 second
  5. The referenced page string can be randomly generated for each job, and the referenced page string can also be manually input. The length of the page string is 50-100. It is required to include all the pages of the job, which can be saved as sample data
  6. Can read sample data (required to be stored in an external file) to initialize the number of jobs, job size, and page string length
  7. It is required to use a visual interface to simulate memory allocation and usage diagrams. It can be paused at any time during the running process to view the current usage of physical memory blocks.
  8. After each operation is finished, it is required to print out the access hit rate
    2. System design:
    This system is mainly divided into two large modules, which read data from external files for algorithm simulation and input job details for simulation. The two major functions Realize the selection through the radio buttons in the operation interface. (The system defaults to randomly generating jobs.) The external data read from the file is divided into the input of the file name, and the number and length of the generated jobs are displayed in real time. When the "OK" button is clicked, the interface will display the page replacement status. Algorithmic Simulation. Random job generation is to input the number of jobs and job size, click the "Random Generation" button, the real-time display of the post-job situation, and algorithm simulation. Whether it is a job generated by reading from a file or a job generated by input, it can be paused and continued during the running process to view the memory usage. At this point, the system design is basically completed.
    2.1. Module design:
    This system mainly includes several modules such as user login, data reading from external files, random generation, page call details and dynamic memory display.
// Clock.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "Clock.h"
#include "ClockDlg.h"
#include "Login.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/
// CClockApp

BEGIN_MESSAGE_MAP(CClockApp, CWinApp)
	//{
    
    {AFX_MSG_MAP(CClockApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/
// CClockApp construction

CClockApp::CClockApp()
{
    
    
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/
// The one and only CClockApp object

CClockApp theApp;

/
// CClockApp initialization

BOOL CClockApp::InitInstance()
{
    
    
	SkinStart("slate.urf",0,0,1,0,0);
//	AfxEnableControlContainer();
	CLogin dlg1;
	if(dlg1.DoModal() == IDCANCEL)
	{
    
    
		return -1;
	}

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	CClockDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
    
    
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
    
    
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}
SkinRemove();
	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/newlw/article/details/130718190