How did they defend castles?

Can you answer this question?