1. A computer-implemented method for predictively managing code execution in an on-demand code execution environment, the on-demand code execution environment comprising at least one virtual machine instance executing an initialized operating system and awaiting requests to execute user-specified code within that operating system, the method comprising: as implemented by one or more computing devices configured with specific computer-executable instructions, obtaining a task profile for a first task associated with the on-demand code execution environment, the first task corresponding to a first set of user-defined code executable by the virtual machine instance, wherein the task profile indicates a likelihood that a request to execute the first task on the on-demand code execution environment will be followed by a request to execute a second task corresponding to a second set of user-defined code executable by the virtual machine instance; obtaining the request to execute the first task on the on-demand code execution environment; instructing the virtual machine instance to execute the first set of user-defined code; determining that the likelihood indicated by the task profile satisfies a threshold value; prior to receiving the request to execute the second task, loading the virtual machine instance with the second set of user-defined code; receiving the request to execute the second task; and instructing the virtual machine instance to execute the second set of user-defined code previously loaded on the virtual machine instance.