A method for handling input or output (I/O) to or from one or more media/storage devices (115, 118) in a system having one or more processor units (105A, 105B), a memory, and the one or more media/storage devices, the method comprising the steps of: 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 of the tree structure 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. 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 of the tree structure 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.