Tuesday, April 26, 2005

QEMU and Queen

I attended USENIX General Technical Conference a few weeks ago, which inspires me to write about QEMU, "a generic and open source processor emulator which achieves a good emulation speed by using dynamic translation." Hm, you think, I know what an emulator is - that's like VMWare - and I know what open source is, but whatever do they mean by generic? It can run all programs compiled for x86?

QEMU is generic in the sense that it emulates many different processor architectures - x86, ARM, SPARC, PowerPC as of this writing, with work progressing on x86_64 and SPARC64. Traditionally, writing an emulator involves a lot of painstaking by-hand coding to translate the machine code instruction for the emulated machine into the appropriate instructions on the host machine. What Fabrice Bellard did with QEMU is harness the compiler and linker in order to generate the instructions for the host machine. Each target instruction is implemented by a small piece of C code, which does something like "ADD r1 to r2 and put the result in r3," which is then compiled into object code. At run time, the pieces of object code are then concatenated and massaged (using linker tricks) in order to emulate the full program. It's a beautiful misuse of the compiler and linker to quickly implement an emulator for one CPU on any other machine.

A full paper on QEMU was published as part of the 2005 FREENIX track. It explains in detail a multitude of neat optimizations used to make QEMU go faster. It's my favorite FREENIX paper; I hope you enjoy it as well.

I recently spoke to a women in computing group about what it takes to be a good computer scientist and they were startled to discover that I do things that don't involve computers (or even math!). Most of the truly successful and talented computer scientists I know have serious, time-consuming, and very artistic hobbies. Valerie Bubb does community theater and marathon bike rides, Armando Fox is an excellent classical and jazz pianist as well as interested in dancing and any number of other ostentatiously liberal arts-esque activities. My main hobby these days is SCA, a medieval recreation group, which provides any number of opportunities for odd artsy activities. Recently, my (awesome) boyfriend won the Crown Tournament of the Kingdom of the West (picture), and I will ironically be spending my weekends during the next 4 months as our local kingdom's paragon of Grace and Beauty - the "Queen." This is probably the most stereotypical thing I've done since I was 7 years old and posed for a photo in all pink clothing - pink velvet dress, pink shoes, pink socks, pink belt with big pink plastic heart-shaped buckle. At least I can smile while clenching my teeth.