Filling up at the pump is a constant and somewhat annoying ritual for drivers.

Justin Sullivan/Getty Images

Your vacation has just begun and you're making the drive to the mountains or to the beach or to some other place that you've been dreaming about for months. You're ready to go, but before you can go more than a few miles, you have to head for the nearest exit -- it's already time to buy gas. With gasoline prices as volatile as they've been in recent years, this isn't likely to be your favorite part of the trip. There's even a chance that sticker shock at the pump may lead you to skip that evening's fancy dinner and stop for a fast-food meal instead. Unfortunately, in a world that depends on automobiles for basic transportation, pumping and purchasing gas is a necessary evil -- for the moment, anyway.

During all those trips to the pump, have you ever stopped to wonder where the gas in the service station dispenser comes from or how it gets from the dispenser to your car's gas tank? The process isn't difficult to understand, but gas companies have gone to a great deal of trouble to hide the details. Pumping gas may seem like a simple matter of lifting a pump, pushing some buttons and sometimes swiping a credit card through a reader or waving a credit wand at a detector. What goes on inside the gas dispenser itself, however, is a bit more complicated than that.

You already know the drill: Swipe your credit card, tell the dispenser what kind of gas you want and start pumping. When your tank is full, pay for the gas, hop back in the driver's seat and head for the open road. But that simple description raises more questions than it answers. How does the gas get to the car? How does the pump know when to stop pumping? How does it mix the exact blend of gas that the customer wants? And what happens if you accidentally drive off with the gas pump still attached to your car? Keep reading to find out.