Once again, get a copy of Massad Ayoob's "In the Gravest Extreme". It's a bit firearms-oriented, but the information is priceless. If you can cut loose the cash and want to really learn about these issues take his course LFI-1: Judicious Use of Deadly Force. You will learn more than cops and lawyers do about this sort of thing, the legal and ethical dimensions of the use of deadly force, what to expect physically and psychologically after a confrontation and much more.
To make things overly simple, if you reasonably believe that someone is about to use unlawful deadly force against you or an innocent third person and you have no other way of preventing it you can use deadly force. Knife and gun are both deadly force. If you don't honestly believe that is the case, don't use deadly force. Generally an unarmed person of more or less the same size and physicality trying to hit you isn't deadly force. Six or eight guys? That can be different. Twelve of them or four with pick-handles? You're in a wheelchair? Figure it out.