1. In a system having a processor unit, a memory, and one or more media/storage devices, a method for handling input or output (I/O) to or from the one or more media/storage devices, comprising: a) receiving an incoming I/O request from an application running on the processor to transfer data to or receive data from the one or more media/storage devices; b) creating a tree structure including instructions executable by the processor and embodied in the memory that define one or more layers of processing associated with the I/O request, wherein the instructions divide the data in the I/O request into one or more chunks at each of the one or more layers of processing, wherein each instruction at one or more of the layers has an associated data dependency to one or more corresponding instructions in a previous layer, wherein the data dependency for a given instruction permits the given instruction to execute only after execution of a corresponding one or more dependent instructions in the previous layer; c) sorting the instructions in the tree structure into an order of processing by determining a location of each chunk and data dependencies between chunks of different layers of processing; d) inserting one or more instructions into a schedule embodied in the memory, wherein a position of the one or more instructions within the schedule depends at least partly on the order of processing; and e) servicing the I/O request by executing the instructions according to the schedule with the processor, wherein the instructions are executed by the processor according to the order of processing associated with the tree structure embodied in the memory.