Get Under the Java Virtual Machine Hood

A great investment for any Java programmer, especially relevant to tool designers and debugging work.


ORIGINAL DRAFT

Java developers seldom need to understand what’s happening at the Virtual Machine (VM) level, but there are times when this kind of information can be invaluable. A good example is understanding garbage collection issues. While the Java VM (JVM) specification does not constrain vendor implementation choices, there are some common algorithms being applied to the problem. Coverage of things like stop and copy, mark and sweep or adaptive collectors, provide insights into the garbage collection process and how it might affect the way you program your classes.

Of course garbage collection is only a small fraction of the material in this book. Chapter 1 introduces the JVM architecture, covering the class loader, class files and architectural tradeoffs. Chapter 2 explores the issues relating to platform independence. These include native methods, user interface dependencies, versioning, dependencies and even the politics of platform independence. Chapter 3 gives delivers a better understanding of all the security constraints imposed by the JVM and how they impact the design and overall objectives. Chapter 4 covers network mobility.

For those who need to dig under the hood, Chapter 5 throws the door open to the Virtual Machine. Chapter 6 provides a detailed explanation of the Java Class structure. This is important for anyone building tools for reverse engineering class code or optimizing performance at the byte code level. Chapter 7 talks about the class life cycle. Chapter 8 covers dynamic linking and resolution. Garbage collection is well explored in Chapter 9, with Stack-handling in Chapter 10 and type conversion in Chapter 11. Chapters 12 to 16 cover arithmetic, logic, floating point operations, objects and arrays, and control flow.

The matter of exception handling is often confusing to Java programmers in-training. Chapter 17 provides insights into the mechanics of exceptions at the VM level, something that may shed light on a number of circumstances. While garbage collection is covered earlier, Java supports finally methods, which can be executed at garbage collection time. These are covered in more detail in Chapter 18. The manner in which Java calls methods and returns from their execution is covered in Chapter 19. The final Chapter (20), Thread Synchronization, covers monitors, locking and the implications of synchronization in a way that few other books could accommodate. Appendix A lists and explains each of the low level operation codes, providing a single-stop reference that won’t disappoint the reader.

The Java Virtual Machine is the engine that runs Java byte code. Understanding how it works may not be critical to effective Java programming, but it provides a better understanding that may prove invaluable in many circumstances. If you need to work directly with class file structures, for example, this book is a must. If you run up against a problem that requires a deeper understanding of your environment, this book is a source of hard-to-find information that may save you a great deal of time. For any Java programmer who’s willing to make the investment, this book is a good buy. Highly recommended.