I have an iMac and I also happen to have a MacBook Air. What I need is this strange layout - I want to be able to control my iMac with my MacBook. I also want to be able to share my iMaс screen to my MacBook's. So ideally I have a single machine - iMac responsible for all the hardware and the MacBook as just as an external display and a keyboard with a touchpad. How do you achieve this?
You can't really use the MacBook as display or keyboard. What you can do is control the iMac remotely via Screen Sharing. This is a builti in function in OS X since 10.5: Screen Sharing.
Please note that his is not a workable solutions for anything that requires fast display refreshes as all data is send via your network.
There are several instruction out there: http://macs.about.com/od/usingyourmac/qt/Mac-Screen-Sharing-How-To-Connect-To-Another-Macs-Desktop.htm