For centuries, pigs in some countries have been castrated to prevent boar taint which can show up in a small percentage of boars in some breeds.
Another possible method to control boar taint is to select the sex of the piglet before birth in an attempt to breed only female pigs, using sorting based on sex chromosome and artificial insemination.