It was one of the most critically acclaimed performances and one of the ones that some of us had been waiting for the longest, since having a piece of monitor like the one that the iMac brings (in any of its variants) totally wasted was not exactly logical.
These are the steps to follow, according to Apple:
1) Make sure that both computers are turned on and are not idle.
2) Connect the Mini DisplayPort male-male cable to both computers. The 27 ”iMac will enter Target Display mode, and will display the content from the source device.
Note: If two 27 "iMac are connected, connect the cable on both computers and press Command + F2 on the 27" iMac to be used as secondary display.
3) To exit Target Display mode, press Command + F2 on the keyboard of the 27 ”iMac you are using as a secondary monitor. To return to the Target Display press Command + F2.
Easy and simple, who had one to prove it ...
Source | Apple weblog