The MrEd virtual machine serves both as the implementation platform for the DrScheme programming environment, and as the underlying Scheme engine for executing expressions and programs entered into DrScheme's read-eval-print loop. We describe the key elements of the MrEd virtual machine for building a programming environment, and we step through the implementation of a miniature version of DrScheme in MrEd. More generally, w e s h o w h o w MrEd denes a high-level operating system for graphical programs. Since DrScheme exposes MrEd's language constructs directly to the repl, D r S c heme can easily execute programs that use the full MrEd language, including its GUI toolbox. At the same time, DrScheme must protect its GUI against interference from the programs it executes, and it must be able to halt a program that has gone awry and To address this problem, MrEd provides a small set of new language constructs. These constructs allow a programrunning program, such a s D r S c heme, to run nested programs directly on the MrEd virtual machine without sacri cing control over the nested programs. As a result, DrScheme can execute a copy o f D r S c heme that is executing its own copy of DrScheme (see Figure 1). The inner and middle DrSchemes cannot interfere with the operation of the outer DrScheme, and the middle DrScheme cannot interfere with the outer DrScheme's control over the inner DrScheme.In this paper, we describe the key elements of the MrEd virtual machine, and we step through the implementation of a miniature version of DrScheme in MrEd. More generally, w e s h o w h o w MrEd de nes a high-level operating system (OS) for graphical programs. As in other high-level OSes, safety and security i n M r E d d e r i v e from properties of the underlying programming language. Mere safety, h o wever, provides neither the level of protection between applications nor the kind of process control that conventional OSes provide. Such protection and control is crucial for implementing many kinds of programs, including programming environments and scripting engines. By describing how w e implemented DrScheme in MrEd, we demonstrate how t o obtain key OS facilities through small extensions to a highlevel programming language.