Never ever run from a dog that's coming after you, running away is a prey animal behavior, and will only make the dog continue it's chase. Also, never scream or squeal, as animals squeal when injured or frightened, which may also trigger a predatory response. Stand as still as possible, avoiding any eye contact with the dog. Keep your hands by your side or behind your back. Ignore the dog. The dog will find that you're boring, and should soon walk away. Then you should walk calmly away from the area. Now, if the dog isn't moving off and proceeds to try and bite/attack you, get on the ground and get yourself into a fetal position, using your hands to protect your head & neck. Try to remain still, ignoring the dog and avoiding eye contact. The dog should soon grow bored and walk away. Then you can get up slowly and walk calmly away.
If you live in an area that does have aggressive feral dogs, you may wish to carry a small can of pepper spray when going for a walk. Spray it in front of the dog's muzzle, the sound of the compressed air and the strong, irritating scent should drive the dog off. If you do live in an area like this, let your local animal control know about it.