An improved hibernation method and system, including the use of a modified
DMA (Direct Memory Access) mode of transferring data to and from the
disk. The use of DMA increases data transfer speed, while freeing the
system processor to perform other tasks, including
compressing/decompressing the data transferred to and from the disk. An
improved decoder is also provided that reduces the number of bounds
checks needed on average for typical compressed data by first
guaranteeing that there is sufficient room to decode literals and small
substrings, whereby bounds checking is not needed. A combination
hibernation mode and a suspend mode is also provided that essentially
maintains power to the RAM while transparently backing the RAM with the
hibernation file, such that if power to the RAM is interrupted, the RAM
contents are automatically restored from the hibernation file when power
is restored.