The 27-inch iMac has a bi-directional Mini DisplayPort or a Thunderbolt port (depending on the model) that can be used to drive a second monitor. The same Mini DisplayPort or Thunderbolt port can be used as a video input that allows your iMac to serve as a monitor for another Mac.