In the legal system there are different interpretations of what deterrence means and how it achieves the goal of crime reduction. Deterrence is often contrasted and by some people incorrectly assumed to be the same as retributivism, in which punishment is considered a consequence of a crime and should be calculated based on the gravity of the wrong done.
Specific deterrence is suposed to discourage the criminal from future criminal acts by instilling an understanding of the consequences.
Another form of it is incapacitation. This is believed to prevent future crimes not by rehabilitating the individual but rather from taking away his ability to commit such acts. That's when they lock people up not to rehabilitate them but to keep them from commiting a crime again. Basically its the old lock them up and throwing away the key version of deterrence.
I'd say that none of these will stop someone who is so brainwashed that they believe that the horrible act they will commit will get them into paradise. Personally, I think allowing guns in the cockpit was more a measure to make some people feel like we are doing something that will prevent a tradgedy from happening again. Unfortunately in a totally free society we cannot stop such a thing from happeneing again. If you want complete safety then you need to live in a controlled society. Warrantless wire taps, TSA screening and searching old ladies handbags may be a minor inconvenience but we gave up something when we allow that to be a part of our life. If you really want to be 100% safe we'd be living like people were in the Soviet Union (checkpoints on the roads and having to apply to the goverment to fly)
We should only implement measures that will impede the bad guys and in the case of guns in the cockpit I think it was done to give the feeling of saftey without actually making things safer.