Vm

558 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
558
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Vm

  1. 1. Virtual Memory By Marco Antonio Ordoñez Contreras 1412474
  2. 2. VMKernel.java <ul><li>“A kernel that can support multiple demand-paging user processes.”
  3. 3. public class VMKernel extends UserKernel {
  4. 4. “Allocate a new VM kernel.”
  5. 5. public VMKernel() {
  6. 6. Super(); “this funtion for called proccess”
  7. 7. }
  8. 8. “Initialize this kernel. ”
  9. 9. public void initialize(String[] args) {
  10. 10. super.initialize(args);
  11. 11. } </li></ul>
  12. 12. <ul><li>“Test this kernel.”
  13. 13. public void selfTest() {
  14. 14. super.selfTest();
  15. 15. }
  16. 16. “Start running user programs.”
  17. 17. public void run() {
  18. 18. super.run();
  19. 19. } </li></ul>
  20. 20. <ul><li>“Terminate this kernel. Never returns. ”
  21. 21. public void terminate() {
  22. 22. super.terminate();
  23. 23. }
  24. 24. // dummy variables to make javac smarter
  25. 25. private static VMProcess dummy1 = null;
  26. 26. private static final char dbgVM = 'v';
  27. 27. } </li></ul>
  28. 28. VMProccess.java <ul><li>public class VMProcess extends UserProcess {
  29. 29. “ Allocate a new process.”
  30. 30. public VMProcess() {
  31. 31. super();
  32. 32. }
  33. 33. “Save the state of this process in preparation for a context switch.”
  34. 34. “Called by UThread.saveState()”
  35. 35. public void saveState() {
  36. 36. super.saveState();
  37. 37. } </li></ul>
  38. 38. <ul><li>“Restore the state of this process after a context switch. Called by UThread.restoreState()”.
  39. 39. public void restoreState() {
  40. 40. super.restoreState();
  41. 41. }
  42. 42. “Initializes page tables for this process so that the executable can be demand-paged.”
  43. 43. protected boolean loadSections() {
  44. 44. return super.loadSections();
  45. 45. } </li></ul>
  46. 46. <ul><li>“Handle a user exception. Called by UserKernel.exceptionHandler().”
  47. 47. “The cause argument identifies which exception occurred; see the Processor.exception constants.”
  48. 48. public void handleException(int cause) {
  49. 49. Processor processor = Machine.processor();
  50. 50. switch (cause) {
  51. 51. default:
  52. 52. super.handleException(cause);
  53. 53. break;
  54. 54. }
  55. 55. }
  56. 56. private static final int pageSize = Processor.pageSize;
  57. 57. private static final char dbgProcess = 'a';
  58. 58. private static final char dbgVM = 'v';
  59. 59. } </li></ul>
  60. 60. Paguina de ejemplo <ul><li>http://yoursunny.com/study/IS206/?p=nachos-vm </li></ul>

×