I usually don't give advice on things pertaining to the use of a gun because I don't want someone to get hurt trying to use one the way I do without practicing it. However, the way things have been going with the economy, the number of robberies and shootings involving people who have gone off the deep end have been growing.
For better or worse, in my life I've been involved in many conflicts of varying degrees of aggression and lethality. Something I learned long ago was that quickly recognizing the psychological makeup and behavioral clues of an opponent can give you an advantage in dealing with them. So I've studied human nature extensively in an effort to give myself this advantage in a hostile situation.
I'll leave it to experts like Dave_M and Technique to maybe tell how to deal with a given situation. I'll just say that I'm a big fan of the double tap if dealing with one armed aggressor. Which is why I usually carry a 9mm. Double taps are not something I would recommend when dealing with multiple armed aggressors in close proximity. In those situations a larger caliber would come in handy.
The example I'll use in recognizing behavioral clues will take place in a restaurant as several active shooter situations have taken place in restaurants as of late. But the same concepts would apply to any location including your home.
You see a man as he enters through the main entrance while holding a gun in his hand. (Note: Always sit facing the door in a restaurants or anywhere when you will be required to sit.) The first thing you'll need to do is to recognize his motivation as this will be an indication of how much time you have to react. His purpose for being there could include several scenarios. He could be there to increase his finances. Or he could be there to kill one person, or he could be there to kill everyone in the place.
The first clue to his intentions will be what he says if anything as he enters. If he barks out instructions (hit the floor, no one move, whatever) his motivation is money. This doesn't mean he won't kill everyone in the place after he gets what he wants. But it does mean that his initial desire is to gain the compliance of the people in the restaurant. This buys you time should you need to relocate yourself due to something interfering with getting a clear shot or moving away from people you wouldn't want to get hit by return fire. (your family)
At this point the armed robber is in what I refer to as herding mode. Much like a trained dog herding sheep, he must keep his eyes moving in an attempt to watch everyone to ensure their compliance. This means as he looks in a direction away from you that you have the ability to move a short distance very quickly to get a clear shot or attain cover before firing. He will most likely see you in his peripheral vision. It will still take him a second to turn his head to look at you, register what you are doing and respond. A second is a lifetime in this situation and should provide you with an opportunity to eliminate the threat.
If the man enters the restaurant without issuing any instructions his motivation is to kill someone or everyone. He has already made up his mind before he enters the building. This means you will have very little time to react. The armed man is in hunting mode. He is either looking for someone specific or anyone and his eyes are searching for a target. When he finds that target he will pull the trigger.
If he homes in on another victim you may have a second to rise while drawing your weapon to fire. If he homes in immediately on you then you are in a race for your life. Lets hope that you have practiced drawing your weapon from a sitting position.
Please feel free to add any content that would add to the topic.