Measuring with Jugs

Given a 5-liter jug, a 3-liter jug, and an unlimited supply of water, how do you measure out exactly 4 liters?

In her book In Code: A Mathematical Journey, Sarah Flannery gives this classic brainteaser as an example of the sorts of playful puzzles that her father, a mathematics lecturer at the Cork Institute of Technology in Ireland, often offered to her and her four younger brothers at dinnertime and other occasions.