The MACHO experiment is searching for dark matter in the halo of the Galaxy by monitoring more than 50 million stars in the LMC, SMC, and Galactic bulge for gravitational microlensing events. The hardware consists of a 50 inch telescope, a two-color 32 megapixel ccd camera and a network of computers. On clear nights the system generates up to 8 GB of raw data and 1 GB of reduced data. The computer system is responsible for all realtime control tasks, for data reduction, and for storing all data associated with each observation in a database. The subject of this paper is the software system that handles these functions. It is an integrated system controlled by Petri nets that consists of multiple processes communicating via mailboxes and a bulletin board. The system is highly automated, readily extensive, and incorporates flexible error recovery capabilities. It is implemented with C++ in a Unix environment.