IMO, a large part of underrepresentation of women in software is due to the following self-reinforcing stereotype.
1. For historical reasons, men got a head-start in the software sector.
2. Software sector came to be seen as a male-dominated field.
3. Both the recruiters and candidates adjust their behavior based on the "knowledge" that software-jobs are more suited for men than women.
I think such accidental clustering happens in many other fields. For e.g., here is a situation where men are the victims: http://www.nurseweek.com/news/features/01-05/men.html