Bushido wasn't even a term used until the samurai were struggling as they were no longer needed as warriors in a peaceful society. It is more a modern term to name the general samurai ethos at a time when samurai were no longer needed.
When samurai were still around, many of them had different ideas of what this "Bushido" is. Bushido literally means "Way of the Warrior," but many had different views on what a warrior is. Many felt that it was an ultimate honor to die fighting their master. Some, even after Japan was peaceful and without war, would kill themselves if their master died or was dishonored. But the famous samurai/ronin Musashi disagreed with them, saying that continuing to live and be of use to one's master and the Japanese society made more sense than killing yourself, and that the students were being taught how to die honorably, but not how to live and struggle. Almost all samurai, especially Musashi, believe that the way of the warrior was their duty to perfect their swordsmanship and not to fear the battlefield.
Bushido is closely linked with Zen Buddhism: a warrior's form of Buddhism. It teaches them the important Bushido aspect, to live every day to the fullest because you do not know when you will die/be killed.
I just touched the surface. Bushido is really as hard to explain as Zen Buddhism, except there are so many different views on Bushido that it's even more confusing.
And not all the samurai died out, FYI, most wandered around until the Japanese law said that they could work in the government or as peasants (because samurai were forbidden to 'lower' themselves to working class position until a turnaround in Japanese thought).
The samurai abolished its own class after Commodore Perry intruded in their land, and they played a huge role in reforming the country.