This millipede in my hand. This beautiful little piece of natural art
Smells like maraschino cherries.
The question is why does it smell like maraschino cherries?
The answer is cyanide. Well, specifically, cyanogenesis. As a self-defense mechanism, these guys combine two compounds in glands on their sides. When the two compounds are mixed, they react and release cyanide gas. It is not dangerous to us, since we are SO MUCH LARGER than these little guys.
So, now a good question to ask would be why do maraschino cherries smell like cyanide? The answer is the same, although the process is different. Cyanide seems to be a common defense mechanism among both plants and arthropods. In plants, they bind cyanide to sugars. In response to tissue damage (i.e. herbivory), enzymes are released that free the cyanide gas.
In small amounts, this is not dangerous. For example, if you crush apple seeds, they will release cyanide…but it would take A LOT of well mashed apple seeds to kill you! Notice also that, because apple trees mean for their fruit to be eaten, the cyanide is only in the seeds, which when intact will pass harmlessly through your digestive system.
So. The moral of the story is that lots of things that we think smell like food (almonds, cherry pits, apple seeds, peach pits, etc.) are actually defense mechanisms, harmless in small quantities, deadly in large.