Prices are like signals that send information to buyers and sellers. For producers, a high price is a signal to increase supply. A low price is a signal to reduce the supply or leave the market. For buyers, a low price is a signal to buy, and a high price is a signal to think before buying.
Another advantage of prices is that they are flexible. Prices can usually change more quickly than production levels. A supply shock occurs when there is a sudden shortage of a good, such as wheat or gasoline. Because supply usually cannot be increased quickly, increasing prices helps resolve excess demand.
Rationing is a system for allocating goods and services using tools other than price. Centrally planned economies use rationing, not price, to distribute goods and services. Rationing is expensive to administer. It tends to lead to only a few products, rather than the wide variety we enjoy in our price-based system.
Prices do not always work efficiently in markets in which there is not much competition, or in which buyers and sellers do not have enough information. Another problem is spillover costs, such as air and water pollution, that "spill over" onto other people who have no control over how much of a good is produced. Producers do not usually pay spillover costs, and the extra costs will be paid by consumers.