As a slight reference to some of the above comments, may I point out that in the Navy the Captain messes on his own, and is not a member of the wardroom. He may only come in by invitation.
This makes sense when one considers that "living above the shop", as the Navy have to do when onboard ship, would be intolerable if you were to be in the presence of your boss, arbiter of your future career, throughout your waking hours. Everybody needs the opportunity to say rude things about those that are set in authority over them from time to time.
The same thing is surely also true of the upper/lower deck divide.