Download This Work

Transcript
-20-
Different design considerations
I considered not forking at all, and simply making the checkpoint memory space mapped
twice inside the process. The first mapping would be the "normal" mapping, which is used by the
application as if nothing funny were going on. The second mapping would be the place where
atomic snapshots of the memory area would be taken to using copy-on-write similarly to as in
fork(), and would be used by a special checkpointing thread to copy the contents of the checkpoint memory space to backing store. This approach proved to be tricky for several reasons.
First, the code to handle copy-on-write from one VM space to another is readily available in the
operating system kernel. Teaching the page fault code to handle this special case would require
extra effort. Also, tracking the true location of the memory, not the remapped location, would
require effort, even though in the best case the translation would consist of simply offsetting the
address.
Another consideration was to map the checkpoint memory directly to the VM space of
another process. The other process in this case would be a pre-created daemon, whose task would
be to wait for checkpointing requests, and then write the atomic snapshot memory to backing
store. This would have solved the problem of having to teach the page fault code anything special. It would have also solved the problem of having to keep track of the original location of the
checkpoint memory, since the memory could now have been mapped 1:1 address-wise. However,
as an extra task compared with the previous, some sort of IPC would be required to inform the
daemon process that it should write the contents of the memory to the reserve units. Also, the
daemon would need to inform the application that is has completed its work for now, and a new
checkpoint can be taken.
Both approaches pose two additional problems. First, we must manually unmap the memory once we have finished checkpointing. Granted, this is not an insurmountable problem. However, a larger problem arises from the fact that we are limited to one concurrent checkpoint operation.
The possibility of only one concurrent checkpoint becomes a problem if we consider for
example a scenario, where we are taking incremental checkpoints, and we start taking a very large
checkpoint (e.g. full checkpoint), which we wish to follow by a tiny one, or a few, almost immediately. Since we are already busy writing the large checkpoint to backing storage, we a unable to
start taking another checkpoint. The possibilities would be to either wait until the previous
checkpoint has completed or "drop" the checkpoint completely. Both approaches have their
implications, but they will not be discussed here. Writing several incremental checkpoints concurrently may speed up the process a little. Also, it may be possible to use the later incremental
checkpoints even though not all pieces in between have been received in the reserve unit. One
example of such a case is when the later checkpoint data completely overlays the memory areas
missing from an earlier incremental checkpoint (this is better explained when discussing the
checkpoint format in Chapter 3.5.5). Of course, it would be possible to use several backup memory spaces inside the process or start multiple daemons, and then use those resources in a roundrobin fashion, but that would require to keep track of the busy resources and add some more complexity.
One final idea considered was to checkpoint to file-backed memory mapped with
MAP_FILE instead of anonymous memory. The idea was to add a special flag to mmap(), which
would instruct the virtual memory system to not flush the contents of the memory to the file
except when explicitly requested by issuing msync(). At that point, the contents would be made