ebruakagunduz

thp_zero_page_test

Feb 6th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5. int *memory_area1 = malloc(819200000);
  6. int *p;
  7.  
  8. int i, k, j = 0;
  9. printf("starting after 90 seconds\n");
  10. sleep(90);
  11. for (i = 0; i < 195; i++) {
  12. printf("i = %d\n", i);
  13. /* read 512 4kB pages */
  14. for (k = 0; k < 512; k++) {
  15. *p = memory_area1[j];
  16. j += 1024;
  17. }
  18. /* write 512 4kB pages */
  19. for (k = 0; k < 512; k++) {
  20. memory_area1[j] = 1;
  21. j += 1024;
  22. }
  23. }
  24. printf("first 800MB allocated\n");
  25. printf("read-write is completed\n");
  26. getchar();
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment