Virtual Machine Design and Implementation in C/C++
Virtual machines are, in effect, a software model of a whole system architecture and processor. They take in bytecode (formed of opcodes, operands, and other data) and execute it, much in the same way a real system executes code. Running these operations in software, however, gives you more security, and total control over how the system works.
Virtual machines are popular for a number of reasons. The first is that they give programmers a third compiler option. You don't have to either go the dynamic interpreted route or the static compiled route, you can compile for a virtual machine instead. Another is that virtual machines aid portability. If you compile your code for a virtual machine, you can run that binary on any system to which the virtual machine has been ported.
Few books have been written on virtual machines, with only a few Java Virtual Machine titles available. Virtual Machine Design and Implementation by Bill Blunden is therefore a landmark book for anyone with an interest in virtual machines, or even system and processor architecture as a whole.
What's to Like?Blunden makes sure to cover every topic related to virtual machines in extreme depth. The beauty of this is that you're not left in the dark, but that experts can simply skip sections. The book is well divided up, and off topic rants or notes are clearly marked with dividers. This is an easy book to read, even though it runs to some 650 pages.
To lead the reader through the entire production of a virtual machine, Blunden showcases the development of his own 'HEC' virtual machine (HEC being one of the fictional companies in 'CPU Wars'). Initially he starts slowly, and introduces the reader to how CPUs work, how memory works, how paging works, and how almost any other system process you can imagine works. Nothing is missed out. Multitasking, threads, processes, porting.. he covers it all. This is excellent for those new to some of these topics, and makes this an advanced book that's actually quite readable by someone with a modicum of computer science experience.
After laying down the foundations for the design of the virtual machine, the actual development starts in Chapter 3. All of the code in this book is in C or C++, and nearly all of the code is talks about is actually printed on the right pages in the book. No more flipping between code on your computer and the book, it's all just where it should be!
Further on in the book, a number of extremely advanced concepts are introduced, but even these need not be out of the reach of an intermediate programmer. Blunden presents the most vivid insight into how assemblers and debuggers are created, and the book is worth it for this information alone.
Another important thing about this book is that it looks at creating a register based virtual machine. Stack based virtual machines are covered, but the author makes a compelling argument for using registers. This makes a refreshing change from the Java Virtual Machine books that ram stack based theory down your throat. It's also useful if you're interested in the Perl 6 'Parrot' project, which is also an in-development register based virtual machine, and bound to become rather important over the next few years.
What's to Consider?Virtual machines aren't for everyone. If you're a high level programmer working with database apps, this isn't really for you. This book is primarily for system engineers, low level programmers, and hobbyists with an interest in compilation, assembler, and virtual machine theory.
This is not a book for beginners. You need to have a reasonable knowledge of C to understand the plentiful examples and source code in the book. C++ is also useful, although OOP is clearly explained, so even a standard C programmer could follow it. That said, this is an excellent book for intermediate programmers or computer science students, as a number of advanced topics (garbage collection, memory management, assembler construction, paging, token parsing) are dealt with in a very easy to understand way.
The SummaryReleased in March 2002, this book is extremely up to date. This is good news, as virtual machines are clearly going to take up a good part of future compiler and operating system technology, and this makes it important to learn about their construction and operation now. These technologies are already in the marketplace; Microsoft's .NET, and JVM, for example. Perl 6's 'Parrot' is also going to become a big player, with languages like Ruby, Python, and Scheme being able to run on it in the future.
Whether you want to learn about system architecture, assembler construction, or just have a reasonably fun programming-related read, this book is great.
Table of Contents- History and Goals
- Basic Execution Environment
- Virtual Machine Implementation
- The HEC Debugger
- Assembler Implementation
- Virtual Machine Interrupts
- HEC Assembly Language
- Advanced Topics
You can purchase Virtual Machine Design and Implementation in C/C++ from bn.com. Slashdot welcomes readers' book reviews -- to submit yours, read the book review guidelines, then visit the submission page.
Despite the popularity of tools such as Together Control Center and Rational Rose, it is clear the UML is dying. Despite the bloat which occured between versions 1.2 and 1.4, the "language" is still incomplete in many places whilst still containing multiple notations in others.
UML will never be able to implement the feature sets which are vital to modern programming. These include multiple thread representation (which can be done clumsily using coloured sequence diagrams) and multiple view representation (such as the private and remote interfaces to an EJB). Even Peter Coad's group admit this.
The promise of the so-called "unified" modelling language has led to individual developers adding their own ad-hoc notations for the missing concepts - or, in many cases, abandoning UML altogether in favour of a home-grown notation. UML needs to be scrapped and replaced with a notation which is capable of representing the concepts which affect software developers today.
"Under the iron bridge, we fist" - The Smiths, Still Ill
I was under the impression that Perl is compiled at runtime to machine code, not for a virtual machine. Am I completely off the mark?
.NET and its open source counterparts catch on?
Slightly more on topic, the idea of a vm for C/C++ is great, but isn't this going to become outdated once (if)
You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
will a moderator please troll that guy, thx
At least you should read carefully before posting this stupid comment!
Mainstream operating systems which drop support [slashdot.org] for the virtual machines?
Yay! First off-topic anti-MS post - mod this up!!!
whomever gave this guy an Informative, please go out back for a photo session
You're continuing trollage shows a dedication that few have.
[n/t]
- It's old, we've seen it before
- You don't give proper credit to the originating troll
- It might have been kind of funny the first time, but it's not anymore.
(oops make that three)YHBT. YHL. HAND.
No, im sorry you have been the one trolled.
Heh!