Throat
Having seen a friend's pit bull "play" with a five-pound steel ball bearing, and turn a 3' 2x4 into match sticks for fun in about an hour, I will want to get the fight over sooner rather than later--especially with head shaking and drag attempts going on.
Assuming you already have one arm lost to the dog's mouth . . .
I would suggest, along the lines of many others, that a dog's throat is it's closest and most vulnerable spot. Try to lift the dog up as high as possible and first punch its throat to try to collapse the windpipe. Second move is to grab the throat and throw the dog ahead of you, on it's back, onto the ground and you land on top. Then choke it into submission with both your hands, as the one in it's mouth will likely come free.
The two elements of submission for a dog (most animals) are:
1. On back on ground so legs are useless
2. Throat (kill area) compromised
Take breath away from any animal and it will release/submit.
If a dog is already viciously shaking your arm, getting to your knife or gun and wielding it effectively (especially if you made the mistake of letting the dog get your strong arm) sounds macho but would probably take a lot longer and be more dangerous even to you than using your physical size, leverage, and knowledge of the dog's vulnerabilities to draw the event to its conclusion quicker.
BTW, if you can get a vicious kick or knuckle punch to a dog's throat before he gets to one of your body parts, the fight will likely be over as soon as it starts. Collapse the larynxx/trachea of any animal, including a human, and there won't be any fight left in it. You don't need a gun or knife for this, just knowledge of how to do it.
If I had a knife out and the dog was on my arm, I would go for it's throat. It's close and vulnerable.
Getting behind a dog that's attacking you is about impossible--only good for getting it off someone or something else by grabbing legs or other body parts, and if you don't do substantial damage at that end, it's going to turn and get you. I'd rather kick it with all the force possible between the hind legs--male or female, attempting to break it's pelvis even, rather than grab onto it.
If you have to shoot--I've seen too many anmials shot that do not stop their activities, and it is too hard with all that commotion to think you can get a CNS shot the first time. Break the pelvis or both shoulders and you will stop the attack--just like dangerous game, which a dog attack is.
Just my thoughts. CB3