You are previewing Beautiful Architecture.

Beautiful Architecture

Cover of Beautiful Architecture by Georgios Gousios... Published by O'Reilly Media, Inc.
O'Reilly logo

Four in Four: It Just Won’t Go

Many of the problems that we have come across while developing and designing JPC have been those associated with overhead. When trying to emulate a full computing environment inside itself, the only things that prevent you from extracting 100% of the native performance are the overheads of the emulation. Some of these overheads are time related such as in the processor emulation, whereas others are space related.

The most obvious place where spatial overheads cause a problem is in the address space: the 4 GB memory space (32-bit addresses) of a virtual computer won’t fit inside the 4 GB (or less) available in real (host) hardware. Even with large amounts of host memory, we can’t just declare byte[] memory = new byte[4 * 1024 * 1024 * 1024];. Somehow we must shrink our emulated address space to fit inside a single process on the host machine, and ideally with plenty of room to spare!

To save space, we first observe that the 4 GB address space is invariably not full. The typical machine will not exceed 2 GB of physical RAM, and we can get away with significantly less than this in most circumstances. So we can crush our 4 GB down quite quickly by observing that not all of it will be occupied by physical RAM.

The first step in designing our emulated physical address space has its origin in a little peek at the future. If we look up the road we will see that one of the features of the IA-32 memory management unit will help guide our structure for the address ...

The best content for your career. Discover unlimited learning on demand for around $1/day.