What were the first castles like and who built them?

The first castle were a defencestructure or a fortress. Monarch (royalty) or nobles were the usual residents of these castles.