Wednesday, May 19, 2010

Resistance is futile. You will be simulated.

Resistance is futile. You will be simulated. was the text printed (using a Star Trek font) on a limited number of t-shirts we had printed when I worked at Virtutech. The simulator is called Simics, and is a full-system simulator capable of simulator entire computer systems with sufficient fidelity that the simulated software is not aware that it is being simulated.

Raymond Chen recently posted an entry on his excellent The Old New Thing blog, titled If you can detect the difference between an emulator and the real thing, then the emulator has failed. This made remember a fun challenge once held at a party at Virtutech after I had left the company (I don't remember the occasion). There were two black screens displaying a Linux command prompt. One of the screens was connected to a physical PowerPC board, and the other was connected to a simulated PowerPC board. The task was then to decide, using the only the command lines of the two machines, which machine was simulated and which one was not.

Doing "cat /proc/cpuinfo" only revealed that both systems where running on PowerPC hardware (the output was different, but then only the people setting up the challenge new exactly which PowerPC hardware was being used), and the simulation was fast enough to not reveal anything performance wise. Now, I happened to have some insider info allowing me to solve the problem: Simics does not (or did not then) have any USB-support, which meant that the "lsusb" command should provide some crucial hints. Quite correctly, the simulated machine did not have any USB-devices, while the real hardware had a number of USB-related devices. I'm not sure if I won the challenge or not, but I remember a bunch of people standing around the terminal discussing different ways of beating the system.

No comments: