Freud's psychoanalytic theories
In order for people to maintain a realistic sense here on earth, the ego is responsible for creating balance between pleasure and pain.  It is impossible for all desires of the id to be met and the ego realizes this but continues to seek pleasure and satisfaction. Although the ego does not know the difference between right and wrong, it is aware that not all drives can be met at a given time.   The reality principle is what the ego operates by in order to help satisfy the id’s demands as well as compromising according to reality.  The ego is a person’s “self,” composed of unconscious desires.  The ego takes into account ethical and cultural ideals in order to balance out the desires originating in the id.  Although both the id and the ego are unconscious, the ego has close contact with the perceptual system.  The ego has the function of self-preservation, which is why it has the ability to control the instinctual demands from the id.