Use a gas or electronic attack alarm, as these give out a short piercing sound and will temporarily disorientate an attacker, giving you enough time to escape. Carry it somewhere where you can get to it quickly - don't leave it buried at the bottom of your bag. If you don't have an alarm, just make a noise yourself by screaming as loud as you can, or shouting "call the police" - if you're loud enough this can be just as effective as a personal alarm. If you have an alarm, use it and shout as well.
Steady yourself if danger threatens. Panic can disable you, so again it’s useful to learn how to keep control in a difficult situation. And if you must fight back, adopt what police term the "bash and dash" approach. Primary targets are the eyes, nose, mouth, ears, throat, groin, knees or shins; choose whichever is easiest to get to.
If held from behind don't struggle forward, you'll only exhaust yourself. Instead throw yourself backwards to surprise your attacker or stomp on the lower leg or foot.
You have the right to defend yourself with reasonable force and this includes using items you have with you such as an umbrella, bag, briefcase or keys. However, don't carry or use anything that the law would regard as an offensive weapon. Once you've achieved your primary aim of stunning or surprising your attacker, get away as fast as you can. If you manage to overcome them don't attack again, you could be putting yourself in more danger or you could end up being charged with assault.
These are just the very basics of self-defense, but to learn more about it and get some exercise at the same time, find a local self-defense class and encourage your family along to join you. Just remember "anticipation and avoidance" are the best forms of defense.