With Target Display mode, you can use your 27-inch iMac with Mac OS X as an external display. Connect any computer or other device with a Mini DisplayPort to your 27-inch iMac using a Mini DisplayPort to Mini DisplayPort cable or using a converter that converts other electrical, video, and audio protocols from another source device to Mini DisplayPort compliant signals. (Cables and converters available separately.)
https://support.apple.com/kb/HT3924