1. A non-transitory computer readable storage medium storing one or more sequences of instructions, which when executed by one or more processors, causes: in response to receiving a request to execute an application, instantiating a virtual machine in which the application is to be executed, wherein instantiating said virtual machine is performed without receiving an explicit user instruction to instantiate said virtual machine, and wherein instantiating said virtual machine further comprises: identifying one or more templates for use in instantiating said virtual machine based on a policy that considers a type of activity whose execution is being requested by the request, wherein the one or more templates describe virtual machine characteristics for different types of activity, and wherein the one or more templates each reference a shared operating system image used to instantiate a plurality of operating system instances to each run in virtual machines created using the one or more templates; and after instantiating said virtual machine using said one or more templates, executing said application in said virtual machine.