Q:

Has an entire generation of a young children in a civilization ever been orphaned and raised as loyals?

In a movie I watched a ruler kills all of the adults in a kingdom in order to raise the young children (who were too young to remember or at least understand the event) as loyal soldiers.
Has anything like this ever happened in history? If so, which was the largest occurance?

A:

This is quite reminiscent of the Ottoman Empire's original Janissaries. 
At first these were young boys forcibly taken from Christian families as slaves and raised to be the Sultan's personal guard. Not being from Muslim families they could legally be enslaved, and they had no social position in the Empire apart from their relationship to the Sultan. So not only were they indoctrinated to be loyal soldiers, but their position was entirely dependent on their Sultan. Thus, unlike Muslim volunteer troops, they had nothing to gain and everything to lose if something were to happen to the Sultan.

