The emperor, likewise any head of the state, must have a stalwart warrior or military men who’s in charge of protecting their family (in Japan’s case, it’s the Imperial Family). The samurai (warrior-administrators) are those who closely serve and safeguard the noble. They are also considered to be on top of the social ladder. During the Edo Era, many samurais have lost their masters; thus, they are called as ronin (or “master-less”). Bushi, on the other hand, are skilled warriors who are not working for the emperor as samurai. When Emperor Meiji took over, on 1868, the concept of samurai came to an end.
Bushido, as we all know, is the moral and honor code of the samurai, which popularized the concept of dying with honor through the ritual suicide harakiri or seppuku.