It has long been recognized that many distributed problems can be analyzed in terms of how agents act based on what they know about the system they are in. To make this intuition formal, Fagin, Halpern, Moses, and Vardi proposed a theory of programs for multi-agent systems in which preconditions of actions are formulas in a logic of knowledge. This dissertation aims at further investigating the role of knowledge-based programs in the study of distributed systems, with special focus on global function computation, automatic synthesis of knowledge-based programs and knowledge-based analysis of information flow requirements.