Compare commits
2 Commits
1623b8b240
...
74cad036f8
Author | SHA1 | Date | |
---|---|---|---|
74cad036f8 | |||
03036ff185 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*.o
|
*.o
|
||||||
*
|
*
|
||||||
|
*.vscode
|
@ -21,7 +21,7 @@ public:
|
|||||||
TwoCache(size_t q1sz, size_t q2sz): cpct_q1(q1sz), cpct_q2(q2sz) {} //ctor
|
TwoCache(size_t q1sz, size_t q2sz): cpct_q1(q1sz), cpct_q2(q2sz) {} //ctor
|
||||||
|
|
||||||
void put_page(int id) {
|
void put_page(int id) {
|
||||||
if (umap1.find(id) != umap1.end()) { //page is in fast queue in the end, nothing to do (fast case)
|
if (umap1.find(id) != umap1.end()) { //page is found, nothing to do (fast case)
|
||||||
return;
|
return;
|
||||||
} else if (umap2.find(id) != umap2.end()) {
|
} else if (umap2.find(id) != umap2.end()) {
|
||||||
q2.erase(umap2[id]); //if page is in slow put it in fast
|
q2.erase(umap2[id]); //if page is in slow put it in fast
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_info() {
|
void print_info() {
|
||||||
|
|
||||||
std::cout << "\nq1 (the most usable): ";
|
std::cout << "\nq1 (the most usable): ";
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
answer += std::to_string(*i) + " ";
|
answer += std::to_string(*i) + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
answer.pop_back();
|
answer.pop_back(); //delete last space
|
||||||
|
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user