Corrosion is the destructive attack on a metal through chemical and electrochemical reactions with its environment. It involves two reactions - an anodic reaction where the metal oxidizes and electrons are released, and a cathodic reaction where these electrons are consumed, such as by hydrogen gas evolution. Localized corrosion cells form on metal surfaces due to minor differences in conditions. Common mechanisms include differential aeration cells and galvanic cells. Corrosion can be controlled through coatings, cathodic protection, and use of inhibitors.