Patent ID: 6996746

Claim:
A method to handle power failures during the performance of a task by a peripheral device, wherein said peripheral device receives electrical power with an “on” state and an “off” state from a power supply, and said peripheral device is part of a data processing system which also contains a non-volatile memory, said method comprising: monitoring said power supply to determine whether said electrical power is changing from said “on” state to said “off” state, or changing from said “off” state to said “on” state; and if it is determined that said electrical power is changing from said “on” state to said “off” state, examining a first task queue for said peripheral device to find at least one task for said peripheral device placed in said first task queue before it is determined that said electrical power is changing from said “on” state to said “off” state; calculating the amount of electrical energy required for said at least one task; performing said at least one task if sufficient electrical energy remains available to said peripheral device to complete said at least one task; and storing data describing said task in a second task queue in said non-volatile memory if insufficient electrical energy remains available to said peripheral device to complete said at least one task.