In season 3 of Game of Thrones, Daenerys Targaryen buys Unsullied in exchange for one of her dragons. After turning over the dragon's leash, she is handed a decorated whip as a symbol of ownership. She then orders the Unsullied to "Slay the masters,... slay every man who holds a whip..."
The Unsullied stand motionless as Kraznys mo Nakloz, the seller, screams back at them to kill Daenerys. She then commands the dragon to incinerate Kraznys, after which the Unsullied sack the city.
Is the delay before the initial attack simply for cinematic effect? Or did Kraznys train the warriors with a fail-safe, to refuse any order to kill him, which required him to be dispatched first?
If the whip gives command, how can Daenerys order them to kill other whip holders? Couldn't one of them countermand the order? Or are they motivated by revenge against their former masters?
Probably for cinematic effect. The Unsullied are trained to follow orders without question. They have been known to selflessly sacrifice their life without hesitation if that is what was ordered. In the books the Unsullied attack and the dragon attack happened almost simultaneously.
The whip that was given to Dany was a special one. It told the Unsullied who their new master was. So they followed the holder of that whip, and that whip alone.
This is an example of the book explaining it better. Though there are differences between the show and the books they are based on, this scene is close enough that I can answer your question better because of what I read and the detail it went into that the show didn't have the time to.
The Unsullied are trained in a way to be mindless and abject of desire or care. They are given special narcotics which desensitize them to feeling physical pain or pleasure and are trained to obey any command they are given by breaking their spirits by having them kill a baby while the mother watches and by killing their puppy that they have raised. The symbol of their obedience is the whip that Daenerys receives from Kraznys. There is no other training given to the Unsullied they must obey whoever holds the whip and is proclaimed their master.
The problem with Kraznys and his people is that as slavers they assume that everyone needs their services and that no one would ever fight them because they make the Unsullied. Daenerys however is so sickened by what they have done and what they will continue to do that she buys the Unsullied because she is in need of an army and because she wants to end the practice of making them. All of the other slavers do have whips but they are not whips that symbolize control over the Unsullied. Think of the whip as a key. It doesn't matter to the Unsullied who has the key just that the are controlled by the owner of that particular key. Daenerys orders them to kill all of the slavers.