Known threat is BG with the knife, get as much distance as possible (21 foot rule) Take him out if needed
Most BG's are cowards, if all they have is a knife and you pull a gun, they will more than likely run away. Drugs and /or alcohol may change their mindset about running away...Take him out if needed
hitting someone in the head under stress is a hard thing to do, If 2 to the chest doesn't work ( possibly body armor/drugs/ alcohol) Then shoot for the pelvic girdle If BG can't stand, he can't chase you as you run away.
If BG do run away after display of handgun, Call 911/ Police IMMEDIATELY, Be the first with the report of wrong doing. This may save your right to have a CCW.
If shots are fired, Call 911, report that you were attacked and the BG is down and request Medical help, That will show you did everything you could to help the BG survive (to be prosecuted to the full extent of the Law) rather than just let him bleed to death.
above all else, Call a Lawyer and DO NOT TALK TO THE POLICE without Your Lawyer there. I don't know if this has been posted yet, But it is worth the time to watch.
http://media.regent.edu/lawPreview/031408_DontTalktoPolice.wmv