• Like
Vm
Upcoming SlideShare
Loading in...5
×
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
120
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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