BitTorrent is arguably the most popular media file distribution protocol used in Internet today. Even though empirically BitTorrent seems to be both efficient and scalable, there has been very little research on the detailed dynamics of its built-in control mechanisms, and their effectiveness across a wide variety of network configurations and protocol parameters. The main goal of this paper is to answer the question of how close BitTorrent is to the optimum, and indirectly how much room there is for further performance optimizations. We develop a centrally scheduled file distribution (CSFD) protocol that can provably minimize the total elapsed time of a one-sender-multiple-receiver file distribution task, and perform a comprehensive comparison between BitTorrent with CSFD. In addition, we compare several peer selection algorithms and analyze the applicability of BitTorrent to real-time streaming applications.