Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include "part.h"
  2. #include "vm_declarations.h"
  3. #include "System.h"
  4. #include "Process.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. const PageNum PMT_PAGES = 200;
  9. const PageNum MEM_PAGES = 20;
  10. const ClusterNo NUM_CLUSTERS = 30000;
  11.  
  12. #define ss(page) (page << PAGE_BITS)
  13. const unsigned PAGE_BITS = 10;
  14. const PageNum PAGE_GAP = 50;
  15. const unsigned REP = 64;
  16.  
  17. int main() {
  18. Partition* p = new Partition("p1.ini");
  19. void* pmtSpace = ::operator new(PAGE_SIZE * PMT_PAGES);
  20. void* memSpace = ::operator new(PAGE_SIZE * MEM_PAGES);
  21. System* s = new System(memSpace, MEM_PAGES, pmtSpace, PMT_PAGES, p);
  22. Process* process[5];
  23. unsigned ps = 0;
  24. for (int i = 0; i < 5; ++i)
  25. process[i] = s->createProcess();
  26. for (int k = 0; k < REP; ++k) {
  27. for (int i = 0; i < 5; ++i) {
  28. if (process[i]->createSegment(ss(ps), PAGE_GAP, 3UL) != Status::OK) {
  29. cout << "NOT OK at REP: " << k << endl;
  30. return 0;
  31. }
  32. }
  33. ps += PAGE_GAP;
  34. }
  35. delete s;
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement