Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help C++ Optimal Page Replacement Algorithm Here is the code so far: // DECLARATION int n, m, i, j, k, hit = 0; double

Please help C++ Optimal Page Replacement Algorithm

Here is the code so far:

// DECLARATION int n, m, i, j, k, hit = 0; double hitratio; // PROMPT THE USER cout > n; cout > m; cout

// USE VECTOR vector p(m); cout > p[i]; } vector> a(n, vector(m, -1)); map mp; for (i = 0; i op; vector> c; for (auto q : mp) { c.push_back({ q.second,q.first }); } for (int q = i + 1; q

vector hitv(m); for (i = 1; i

cout

Input should be:

No. of frames: 3

No. of processes: 20

Processes: 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1

And the output should be a matrix for the processes and frames, and:

Hits: 11

Faults: 9

However, I keep getting this instead:

image text in transcribed

Please fix the code. Thank you!

Process 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 Frame 7 7 7 2 2 3 3 4 4 4 0 0 0 0 0 0 0 7 7 7 Frame 1 EOOOOOOO 2 2 2 2 2 1 1 1 1 1 0 0 Frame 2 E E1111111 3 3 3 3 3 2 2 2 2 2 1 1 1 11 11 Hit: 6 Page Fault: 14 Hit Ratio: 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

Students also viewed these Databases questions