-Generally speaking, no they did not.
The king would often surround himself with knights and other courtiers, often including one of the sons of each of his vassals (lords). Luis XIV of France liked to surround himself with the nobles themselves.
The different nobles each had their own lands, and they often had some knights who lived in their castles.
The peasants were farmers who lived and worked outside the castle walls. They had their own little houses. In the event of war, they would seek refuge behind the castle walls and form part of the defensive forces.