Crying is a release of built up emotions and is a way for the emotions to come out of the body in physical form. People generally cry when they are happy, sad, in awe of something or otherwise overwhelmed by a large amount of any emotion.
Crying is often a signal that something needs to be addressed or expressed. This signal could be the reason behind why many people cry when they get frustrated. Crying has a biochemical purpose in that it often is able to release toxins and stress hormones that are within the body. People who cry may be doing it for a social purpose, whether consciously or subconsciously. Others will often sympathize with or support people who are crying and some will use this as a way to manipulate others.
The most common trait associated with crying is vulnerability. For this reason, many men have worked to control their emotions and will not cry. This is not in response to anything physical, but is a social interaction in which they believe they will be perceived as weaker or less masculine. It tends to be more socially acceptable for women to cry and most women are not as uncomfortable as men when it comes to crying.