In Freuds theory of personality

The ego obeys the reality principle

The id operates by secondary process thinking

The super-ego obeys the pleasure principle

The ego operates by primary process thinking