Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Sp00 Final Exam Review: Virtual Machines
See Final Exam Review - Sp2000
Why VMs are better than native code:
- more portable. instead of entire system, just port the VM code
- better memory security so you don't shoot yourself in the foot. or, have the toaster never turn off...
- internal garbage collection ( generational to make faster ) allows the luxary of not having to worry about memory leaks
- once the VM is ported, you don't have to write any new code. You're done. But if it's in native code, you have to re-write the code for EACH system it is required to run on
HotSpot and Squeak VM Similarities:
- both have generation scaveging and mark-sweep GC algorithms
- use stacks, not registers
- you can compile JAVA's VM bytecode to Squeak VM bytecode
HotSpot and Squeak VM Differences:
- JAVA is typed, squeak isn't
- JAVA handles exceptions in VM, Squeak handles them in Squeak, not VM
- Squeak's VM is smaller than JAVA's
- you canNOT compile Squeaks's VM bytecode to JAVA VM bytecode ( types and operands )
guessing here, but floating point math?
anyone remember what mark said about frames/contexts and stacks in class? something like, contexts are in stacks, but for java, the stacks are in the contexts? or vice versa???
Java: contexts are in stack
Squeak: stack in each context
Java is faster than Squeak. popping off stack requires much less time than context switching
c) if i remember correctly, mark was talking about boxing and unboxing being the hardest part of primitives. meaning, moving between the native types and objects is a challenge. but i could be completely off :)
no.. that sounds right. i didn't think it was floating point math. your answer does look correct, and i remember mark discussing this in class
|Sheetal's not off. The issue that Stephen's grappling with is where the stack is that the bytecodes handle: Inside the contexts (the method execution objects) or global. Stephen's (a) and (b) lists are good, but there are more possible items in each. Mark Guzdial |
a) Portability, garbage collection, security, better for OO. Also the programs run on the VM and not on top of something else (ie, this is good for small devices without an OS).
b) The big difference that we came up with is the difference in garbage collection. Java has a 3 generational, and Squeak has a 2 generational AND a mark/sweep. Also, Squeak has JIT compilation.
I think JAVA's VM also has a M-S GC algorithm as well as the generational scaveging. Not 100% sure, though -Stephen Belknap
Susi Rathmann, jeremy, Matt Flagg
Links to this Page