Abstract:
A mechanism for maintaining a consistent, periodically updated state in main memory without constraining normal computer operation is provided, thereby enabling a computer system to recover from faults without loss of data or processing continuity. In a typical computer system, a processor and input/output elements are connected to a main memory subsystem. A checkpoint memory element, which may include one or more buffer memories and a shadow memory, is also appended to this main memory subsystem. During normal processing, an image of data written to primary memory is captured by the checkpoint memory element. When a new checkpoint is desired, thereby establishing a consistent state in main memory to which all executing applications can safely return following a fault, the data previously captured is used to establish that checkpoint. This structure and protocol can guarantee a consistent state in main memory, thus enabling fault-tolerant operation.

Description:
FIELD OF THE INVENTION 
     The present invention is related to computer memory systems and checkpointing protocols, particularly for fault tolerant computer systems. 
     BACKGROUND OF THE INVENTION 
     Fault tolerance in computers is generally realized in either of two ways: either through a hardware-intensive technique called masking, or a software-based approach called checkpointing. Masking is achieved by replicating hardware and executing computer programs on several independent units in parallel. The outputs of these units are then compared to determine their validity. In the simplest and oldest embodiment of this technique, three complete computers are implemented and a simple majority vote on their outputs is used to determine the &#34;correct&#34; output. If at least two of the computers are functioning properly and the voter system itself is also working correctly, the potentially incorrect output of the malfunctioning computer is outvoted and the correct answer is indeed presented to the user. While there are other embodiments of masking that are somewhat more efficient, masking systems generally suffer from the significantly increased cost of the hardware that must be added to mask out the effect of a faulty component. In addition, masking protects only against hardware faults; a software bug that causes one unit to malfunction will also cause other units running the same software to malfunction in the same way. All outputs will contain the same error which as a result will, as a result, pass undetected. 
     The alternative technique called checkpointing has the potential of providing tolerance to faults in a considerably more cost-effective way. This technique requires that the state of the entire computer be periodically recorded at time intervals designated as checkpoints. A fault may be detected by either a hardware fault monitor (e.g., by a decoder operating on data encoded using an error detecting code, by a temperature or voltage sensor, or by one device monitoring another identical device) or by a software fault monitor (e.g., an assertion executed as part of the executing code that checks for out-of-range conditions on stack pointers or addresses into a data structure). If a fault is detected, recovery involves first diagnosing and circumventing a malfunctioning unit, if possible, and then returning the system to the last checkpoint and resuming normal operation from that point. 
     Recovery is possible if sufficient hardware remains operational after any elements identified as faulty during the recovery process have been circumvented. In a multiprocessor system, for example, the system can continue to operate as long as at least one of the processors continues to function. Similarly, a system that can remap memory or redirect I/O through alternate ports can survive the loss of memory or I/O resources as well. Moreover, most faults encountered in a computer system are transient or intermittent in nature, exhibiting themselves as momentary glitches. It is therefore generally possible to recover from such faults without circumventing any hardware. However, since transient and intermittent faults can, like permanent faults, corrupt the data that is being manipulated at the time of the fault, it is necessary to have a consistent state to which the computer can return following such events. This is the purpose of the periodic checkpointed state. 
     Since checkpoints are typically established every 50 milliseconds or so, rolling an executing program back to its last checkpoint is generally entirely transparent to a user. If handled properly, all applications can be resumed from their last checkpoints with no loss of continuity and no contamination of data. 
     There are two primary advantages to checkpointing relative to masking. First, checkpointing is considerably less expensive to implement. Second, checkpointing offers protection against software as well as hardware faults. The first advantage simply reflects the fact that checkpointing does not require massive replication of hardware. The second advantage is a consequence of the fact that most software bugs remaining in well tested, mature software are exposed only in exceptional situations. Were this not true, the bugs would have been found and removed during normal testing. Such exceptional situations are generally caused by some asynchronous event such as an interrupt that forces program execution to follow a sequence that would not otherwise have been followed. If the system is forced to roll back to a consistent state and continue forward, that is, if the software bug is treated like a hardware transient, it is highly unlikely that the system will encounter exactly the same exception in exactly the same state as before. Consequently, it is highly unlikely that it will encounter the same bug a second time. 
     Checkpointing also suffers from two potential disadvantages relative to masking. First, masking generally results in instantaneous or near-instantaneous recovery from faults. Any resulting errors are simply masked, so no explicit recovery is necessary. Checkpointing requires that certain software routines be executed to diagnose the problem and to circumvent any permanently malfunctioning component of the computer. As a consequence, the resulting recovery time, typically on the order of one second, may preclude the use of this technique for achieving fault tolerance for some real-time applications where response times on the order of milliseconds or less are required. In applications in which humans directly interact with the computer, e.g., in transaction processing applications; however, a momentary interruption of a second or so is entirely acceptable and, in fact, is generally not even perceptible. Thus, this potential disadvantage of checkpointing is not relevant to that class of applications. 
     Second, checkpointing has traditionally been achieved at the application level. Thus, the application programmer has been required to be concerned about what data has to be checkpointed, and when it should be done. This requirement places a serious burden on the programmer and has seriously impeded the widespread use of checkpointing as a means for achieving fault tolerance. 
     More recently, techniques have been developed that allow checkpointing to be done at the system software level so that the application programmer need not be concerned with attempting to identify the data that has to be checkpointed or even be aware that checkpointing is taking place. For this to be possible, the system itself must be able to establish periodic checkpoints, regardless of the applications that it might be running. U.S. Pat. Nos. 4,654,819 and 4,819,154 to Stiffler describe a computer system capable of doing exactly that. The system accomplishes this kind of checkpointing by requiring each of its processors to retain all modified data in its local cache until it is time to establish a new checkpoint at which time all modified data is flushed out to main memory. Such caches are sometimes called blocking caches. Prior to flushing its blocking cache, a processor does a context switch during which it places the contents of its internal registers, including its program counter, on a stack which is flushed out with all the other modified data. Consequently, memory is updated all at once with data that is internally consistent, thereby establishing a checkpoint to which the system can safely return should it subsequently suffer a fault. To guarantee the ability to survive both main memory faults and faults experienced during the flushing operation itself, memory is duplicated, with each data item stored in both a primary location and a shadow location. 
     While this technique does accomplish its goal of establishing checkpoints without burdening the application programmer, it does have certain disadvantages due to its dependence on the use of a blocking cache. Since a processor cannot write any cache line back to main memory unless it writes back all currently modified lines at the same time, any cache overflow or any request by one processor for data held in another processor&#39;s cache requires the processor releasing the data to flush its entire cache. This requirement precludes the use of standard cache coherency protocols (for example, the protocol described in U.S. Pat. No. 5,276,848 to Gallagher) and creates potential porting and performance problems when programs are executed that rely on such standard protocols. 
     Other methods for capturing data for checkpointing purposes have been proposed, for example, by Kirrmann (U.S. Pat. No. 4,905,196) and by Lee et al. (&#34;A Recovery Cache for the PDP-11&#34;, IEEE Trans. on Computers, June, 1980). Kirrmann&#39;s method involves a cascade of memory storage elements consisting of a main memory, followed by two archival memories, each of the same size as the main memory. Writes to the main memory are also written by the processor into a write buffer. When it is time to establish a checkpoint, the buffered data is then copied by the processor first to one of the archival memories and then to the second, although techniques are also described that eliminate the need for one of the copies. The two archival memories ensure that at least one of them contains a valid checkpoint, even if a fault occurs while a buffer-to-memory copy is in progress. Some problems with this architecture include a triplication of memory, the use of slow memory for the archival memory and the effect on processor performance since the three memory elements are different ports on the same bus. 
     The paper by Lee et al. discusses a method for saving data in a recovery cache before updated data is written to memory, for all memory locations falling within an application-specified range of addresses. This method involves converting all writes to memory within the range specified by the application into read-before-write operations. If a fault occurs during the execution of the application, the contents of the recovery cache are stored back into main memory, thereby restoring it to the state that it was when the application began its current execution. One problem with this method is that it slows the host system due to interference with memory cycles by the read-then-write operations which are required. It also requires checkpointing to be handled or considered by the application programmer. 
     Other techniques have been developed to establish mirroring of data on disks rather than in main memory. Since disk access is orders of magnitude slower than main memory access, such schemes have been limited to mirroring data files, that is, to providing a backup to disk files should the primary access path to those files be disabled by a fault. No attempt is made to retain program continuity or to recover the running applications transparently to the users of the system. In some cases, it is not even possible to guarantee that mirrored files are consistent with each other, only that they are consistent with other copies of the same file. U.S. Pat. No. 5,247,618 discloses one example of such a scheme. 
     SUMMARY OF THE INVENTION 
     Embodiments of the present invention provide a device and process for maintaining, in a computer system, a consistent, periodically updated checkpoint state in the computer system&#39;s main memory while allowing the use of conventional cache coherency protocols and non-blocking caches. Embodiments of the invention provide a main memory which is accessed through one or more logical ports in which a primary memory element and a checkpoint memory element are both coupled to the same logical port. The primary and checkpoint memory elements may be connected to the same physical port or distinct physical ports. The primary memory element is accessed in the same way as a standard main memory. The checkpoint memory element captures accesses, i.e., writes and/or reads, to the main memory which are detectable because the checkpoint memory element is connected to the same port as the primary memory element. Access may come from a processor, an I/O device or other device in the computer system. The checkpoint memory element may be a physically separate memory module from the primary memory element, or the checkpoint memory element and the primary memory element may reside within the same memory module at different addresses. The captured accesses are then used to ensure the existence of a consistent checkpoint state in the main memory. Such a computer system with the appropriate detection and circumvention procedures can recover from faults without loss of data integrity or processing continuity. 
     In a typical computer system, a processor and input/output elements are connected to a main memory. The connection is typically provided by one or more memory buses, cross-point switches or other interconnection mechanisms. In all cases, the main memory has one or more logical ports through which all accesses to the main memory are made. In one embodiment of the present invention disclosed herein, the standard main memory, hereafter called the primary memory, is augmented with a buffer memory (typically a first-in, first-out memory) connected to the same logical port(s), and a second memory element (typically a random-access memory), equal in storage capacity to the primary memory element, also connected to the same port(s) and to the buffer memory. The buffer memory and the second memory, also called a shadow memory, define a checkpoint memory element. During normal processing, data written to the primary memory element is also simultaneously captured by the buffer memory. When a checkpoint is desired, thereby establishing a consistent state in main memory to which all executing applications can safely return following a fault, the data previously captured in the buffer memory is then copied to the shadow memory. 
     In a system in accordance with this invention, input and output (I/O) operations are normally handled in the following manner. During normal operations, I/O requests are made in any standard way, and are entered on an appropriate I/O queue by the operating system. However, the actual physical I/O operation is not initiated until the next checkpoint. Thus, in the event of a fault and a subsequent rollback to a checkpointed state, all pending I/O operations are also checkpointed. Disk and other idempotent I/O operations, i.e., operations that can be repeated without changing the result, can simply be restarted. 
     The appropriate disposition of communications I/O activities depends upon the communication protocol. For those protocols that accommodate the possible duplication of messages, the pending I/O can be restarted. For those protocols that handle dropped messages, the I/O can be deleted from the pending queue. For those protocols that do not handle either dropped messages or repeated messages, the pending I/O is deleted from the pending queue. If the message was not actually sent before the fault, or was aborted as a result of the fault, the effect is the same as a transient communication link failure with the same consequences to the application or to the user. Since communication link interruptions are generally considerably more common than computer faults, the use of a protocol that cannot make such events transparent presumably means that the user or the application is prepared to cope with them in any event. 
     The mechanisms described herein can guarantee the existence of a consistent checkpoint state from which the computer can resume operation following a fault, thus supporting fault-tolerant computer system operation. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     For a better understanding of the present invention, reference is made to the drawings which are incorporated herein by reference and in which: 
     FIG. 1 is a block diagram of a computer system which uses a main memory structure of one embodiment of the present invention; 
     FIG. 2 is a block diagram illustrating in more detail a processing unit with a cache and a checkpointed main memory according to one embodiment of the present invention; 
     FIG. 3 is a more detailed block diagram of the shadow memory shown in FIG. 2; 
     FIG. 4 is a more detailed block diagram of the memory control logic shown in FIG. 3; 
     FIG. 5 is a diagram of memory locations used by the processing units to maintain main memory consistency; 
     FIG. 6A is a flowchart describing how each processing unit controls flushing of its cache to maintain main memory consistency; 
     FIG. 6B is a flowchart describing an alternate method by which each processing unit controls flushing of its cache to main memory; 
     FIG. 7 is a flowchart describing how the computer system of one embodiment of the invention recovers from a fault. 
    
    
     DETAILED DESCRIPTION 
     The present invention will be more completely understood through the following detailed description which should be read in conjunction with the attached drawings in which similar reference numbers indicate similar structures. Reference is made to Applicant&#39;s co-pending U.S. patent application Ser. No. 08/258,165, filed Jun. 10, 1994, which is incorporated herein by reference. 
     FIG. 1 is a block diagram of a computer system 11 with which the invention generally may be used. One or more processing elements 14 and 16 are connected to one or more main memory systems 18 and 20 via interconnection mechanisms 10 and 12 such as a bus or crosspoint switch. One or more input/output (I/O) subsystems 22 and 24 are also connected to the interconnection mechanism 10 (12). Each I/O subsystem comprises an input/output (I/O) element or bridge 26 (28) and one or more buses 30 and 32 (34 and 36). An I/O element 26 (28) may also be connected to any standard I/O bus 38 (40), such as a VME bus. For ease of description, only one of each of these systems and subsystems is referred to below. 
     As shown in FIG. 2, each processing element, e.g., 14, includes a processing unit 44 connected to a cache 42. This connection also connects the processing unit 44 and the cache 42 to the interconnection mechanism 10. The processing unit 44 may be any standard microprocessor unit (MPU). For example, the PENTIUM microprocessor, available from Intel Corporation, is suitable for this purpose. The processing unit 44 operates in accordance with any suitable operating system, as is conventional. A processing element 14 may include dual processing units 44 for self-checking purposes. 
     The cache 42 is either a write-through or a write-back type of cache and has an arbitrary size and associativity and may consist of more than one cache level in a hierarchical structure. The processing unit 44 may store in the cache 42 either data only or both computer program instructions and data. In the former case, an additional similar instruction cache 43 may be connected to the processing unit 44 for the processing unit 44 to store computer program instructions. This connection also connects the instruction cache 43 to the interconnection mechanism 10. If this system is a multiprocessing computer system, each processing unit 44 may use any conventional mechanism to maintain cache coherency, such as bus snooping. 
     The cache 42 is connected to a main memory system, e.g., 18, via interconnection mechanism 10. The main memory system includes a primary memory element (PME) 46 and a checkpoint memory element (CME) 48 which are interconnected and connected to interconnection mechanism 10. The CME 48 must have at least the capacity of the PME 46, but both may have arbitrary capacities. 
     The CME 48, as shown in FIG. 3, includes buffer memories 52 and 56 which are preferably first-in, first out (FIFO) buffers and a shadow storage element 50 called the shadow memory, each having data inputs, data outputs and control inputs including access control and address inputs. The FIFO buffer memories and the shadow memory element are typically implemented with dynamic, volatile, random-access memories (DRAMs), in the form of integrated circuits, typically, single in-line memory modules (SIMMs). 
     A bus transceiver 55 connects the inputs of a data input buffer 54 and data outputs of the shadow memory 50 to interconnection mechanism 10. Outputs of the data input buffer 54 are connected to the data inputs of buffer memory 52 and the data inputs of the shadow memory 50. The data outputs of the buffer memory 52 are also connected to the data inputs of the shadow memory 50. 
     Memory control logic 58 has control outputs which are connected to control inputs of each of the buffer memory 52, the shadow memory 50, the data input buffer 54 and the bus transceiver 55 to control the flow of data among those elements, in a manner that is described below. Memory control logic 58 also has data paths connected to interconnection mechanism 10 through the bus transceiver 55, a first address input connected to the address portion of interconnection mechanism 10 via bus transceiver 57 and a second address input connected to the data outputs of an address buffer memory 56. The address buffer memory 56 is also connected to outputs of an address input buffer 59, of which inputs are connected to the address portion of interconnection mechanism 10 via bus transceiver 57. Both bus transceiver 57 and address input buffer 59 have a control input connected to the memory control logic 58. The memory control logic 58 also controls storage in the address buffer memory 56 of addresses which correspond to data stored in the buffer memory 52, in a manner that is described below. 
     The non-memory logic elements may be implemented using conventional circuitry, custom or semi-custom integrated circuits or programmable gate arrays. Since it may be advantageous to keep the number of module types to a minimum, the PME&#39;s 46 may also have the same structure as the CME&#39;s 48. The buffer memory 52 in a memory element used as a PME 46 may store computer program instructions or read-only data which does not have to be shadowed. The memory control logic 58 in a memory element is preferably designed to enable the memory element to be either a PME or a CME on command from the operating system. The buffer memory 52 should be large enough to capture all data modified between any pair of consecutive checkpoints. Given the process described below for using this system, the total capacity of all of the buffer memories 52 combined in computer system 11 should preferably be (at least) of the order of the combined capacity of the caches 42 in the computer system 11. 
     The memory control logic 58 is illustrated in more detail in FIG. 4. It includes a command register 68 which has data input connected to interconnection mechanism 10 via the bus transceiver 55. A status register 66 has an output also connected to the interconnection mechanism 10 via bus transceiver 55. Buffer memory control circuit 60 and shadow storage control circuit 62 provide the row address strobe (RAS), column address strobe (CAS), row and column addresses and write enable (WE) control signals to the buffer memory 52 and shadow memory 50, respectively. Control circuits 60 and 62 also have connections for coordinating data transfer between buffer memory 52 and shadow memory 50 using addresses stored in buffer memory 56. Buffer memory control circuit 60 has outputs connected to the input of the status register 66 to indicate how full the buffer memory 52 is and whether copying from the buffer memory 52 to shadow memory 50 is complete. Buffer memory control circuit 60 also has an input connected to the output of command register 68 which indicates whether it should copy data between the buffer memory 52 and the shadow memory 50. The command register also indicates whether the memory element is acting as a primary memory element or a checkpoint memory element. An I/O interface control 64 controls the flow of information through the status register 66 and command register 68, and coordinates data transfers through the bus transceivers 55 and 57 with the buffer memory control circuit 60 and checkpoint storage control circuit 62. The I/O interface control 64 also accepts inputs from the address portion of interconnection mechanism 10, so as to recognize addresses to the command and status registers and to the main memory system itself. 
     The process of using this system to maintain a consistent state in main memory following a fault will now be described. In contrast to systems such as in U.S. Pat. No. 4,654,819, this process allows data to be passed from one processing element 14 to another processing element 16 without requiring the entire cache 42 of processing unit 14 to be flushed. If all processing units 44 in the computer system 11 have access to all buses or communication paths to the main memories, each processing unit 44 may use conventional bus snooping methods to assure cache coherency. If all processing units 44 do not have access to all system buses, the processing units 44 may use other well-known cache coherency techniques instead. 
     The buffer memory 52 in each checkpoint memory element 48 allows periodically updated checkpoints to be maintained in the main memory system 18 so that a consistent system state can be restored in the event of a fault. All data lines that are stored in the primary memory element 46 are also stored in the buffer memory 52, along with their corresponding memory (physical) addresses which are stored in the associated address buffer memory 56 in the checkpoint memory element 48. The protocol also applies to lines written to the primary memory element 46 when a cache 42 is flushed by the operating system using either specially designed flushing hardware or conventional cache flushing processor instructions. Flushing operations by the processing units 44 are synchronized. When all processing units 44 have completed their flush, the operating system instructs the checkpoint memory element 48, using command register 68, to copy, the contents of the buffer memory element 52 into its shadow memory element 50 using checkpoint storage control circuit 62. To checkpoint a consistent system state, once a processing element 14 has begun a flush, it cannot resume normal operation until all other processing elements 14 have completed their flushes, except under certain conditions discussed below. 
     Processor cache flushing is synchronized because the buffer memory needs to know which data should be copied to the shadow memory element 50, and which data should not. That is, the buffer memory needs to distinguish between post-flush and pre-flush data. Thus, if the buffer does not know what processor is sending data, all processors must complete their flushes before normal operation can begin in order to maintain consistency. Synchronization is preferably controlled using a test-and-set lock or equivalent operation using a designated location in main memory 18, such as indicated at 80 in FIG. 5, to store the lock value. To ensure that it is possible to recover from primary memory element failures as well as other failures, this designated location is preferably implemented as part of the status register in the checkpoint memory element. A failure in the checkpoint memory element does not disrupt normal operation. Consequently, this data structure is not needed in this event. 
     At periodic intervals, each processing unit 44 determines whether it should initiate a flush operation as indicated at step 90 in FIG. 6A. The processing unit 44 can make this determination in a number of different ways. For example, one or more bits in the status register 66 of the checkpoint memory element 48 could be used to indicate the remaining capacity of the buffer memory 52. If the buffer memory 52 is too full, a processing unit 44 initiates a flush. Also, a flush may be initiated after a fixed period of time has elapsed. 
     If this processing unit 44 does not need to initiate a flush, then it examines the designated memory location 80 to determine whether another processing unit 44 has already set the lock (step 92). If the lock is not set, this process ends as indicated at 94. Otherwise, if the lock is set, this processing unit 44 flushes its cache 42 in step 96. The effect of the flushing operation is to store all lines in the cache (or preferably only those lines that have been modified since the last flush) to the primary memory element 46, and, because of the aforementioned properties of the checkpoint memory element 48, to the buffer memory 52 of the checkpoint memory element 48 as well. Prior to the actual flushing operation, the processing unit 44 saves its state in the cache 42 so that this information is flushed as well. 
     Input and output (I/O) operations are normally handled in the following manner. During normal operations, I/O requests are made in any standard way, and are entered on an appropriate I/O queue by the operating system. However, the actual physical I/O operation is not initiated until the next checkpoint. Thus, in the event of a fault and a subsequent rollback to a checkpointed state, all pending I/O operations are also checkpointed. Disk and other idempotent I/O operations, i.e., operations that can be repeated without changing the result, can simply be restarted. 
     The appropriate disposition of communications I/O activities depends upon the communication protocol. For those protocols that accommodate the possible duplication of messages, the pending I/O can be restarted. For those protocols that handle dropped messages, the I/O can be deleted from the pending queue. For those protocols that do not handle either dropped messages or repeated messages, the pending I/O is deleted from the pending queue. If the message was not actually sent before the fault, or was aborted as a result of the fault, the effect is the same as a transient communication link failure with the same consequences to the application or to the user. Since communication link interruptions are generally considerably more common than computer faults, the use of a protocol that cannot make such events transparent presumably means that the user or the application is prepared to cope with them in any event. 
     If the processing unit 44 determines in step 90 that it should initiate a flush, it then determines whether the lock is already set in step 98, similar to step 92. If the lock is already set, the processing unit 44 continues by flushing its cache 42 in step 96. Otherwise, it sets the lock in step 100, sends a message to the other processors to trigger their flush line operations thereby identifying itself as the initiator of the flush, before flushing its cache 42. 
     After a processing unit 44 flushes its cache 42 in step 96, it increments its corresponding flush counter in step 102. As indicated in FIG. 5, each processing unit 44 has a flush counter, such as shown at 82 and 84, which are predetermined designated locations in main memory 18. After the flush counter (e.g., 82) is incremented, the processing unit 44 determines whether it is the initiator of this flush sequence (step 104). If it is not the initiator, it then waits until the lock is released in step 106. When the lock is released, this process ends in step 108 and the processing unit 44 may resume normal operations. 
     If the processing unit 44 is the initiator of the flush as determined in step 104, it then waits until all flush counters (82-84) are incremented in step 105. Once all flush counters have been incremented, this processing unit 44 sends a commit command to the checkpoint memory element, thereby instructing the checkpoint memory element 48 to begin copying data in the buffer memory 52 into the shadow memory 50, by sending a command to the command register 68, and releases the lock (step 107). Receipt of the command notifies the checkpoint memory that element 48 that the flush has completed and causes the buffer memory control 60 in conjunction with the shadow memory control 62 to move the data that was stored in the buffer memory 52 prior to the receipt of the notification into the appropriate locations (as determined by the corresponding physical address stored in address buffer memory 56) in the shadow memory 50. Once this command has been sent, the flush lock is released and the processing units 44 can resume normal processing. The loops around steps 106 and 110 should have time-out protection which triggers fault recovery procedures, in the event of a failure during flushing operations. 
     Note that the flush counters described here may be 1-bit counters and hence can also readily be implemented as part of the status register in the checkpoint memory element. The bits can be set individually by each processor and then automatically reset when the initiator sends the commit command thereby instructing the checkpoint memory element to begin the copy from its buffer to the shadow memory. 
     The buffer memory control 60 needs to distinguish between pre-flush and post-flush data if normal operation is to be allowed while the pre-flush contents of the buffer are being moved into the shadow memory. The buffer memory control can make this distinction, for example, by recording the last address of buffer memory 52 in which data is stored at the end of each synchronized flushing operation. There are other ways to identify such a boundary, for example by counting how much data has been written to buffer memory 52 prior to the commit command. All data stored in buffer memory 52 following the last cache line stored during the previous flush up through the last cache line stored during the current flush is pre-checkpoint data. Any data stored after that is post-checkpoint data which is not copied to the shadow memory element 50 at that time. Any post-checkpoint data can be placed in any area of the buffer memory 52 which is unoccupied or has already been copied to the shadow storage element. 
     These operations ensure the existence of a consistent state in main memory 18 to which the computer system 11 can safely return following a fault. If the fault is transient, the system can simply roll back to the last checkpoint and resume normal operation. If the fault is permanent, the system first reconfigures itself to circumvent the failed element, if possible, e.g., by eliminating a defective microprocessor in a multiprocessor system, or by switching dual-ported I/O devices to circumvent a defective I/O channel. The system then rolls back to the last checkpoint. If the fault affects any portion of the computer system 11 other than the checkpoint memory element 48 itself, the checkpoint memory element 48 contains the state of the entire system in main memory 18 at the point in time following the last completed flush and the system can resume operation from that state following reconfiguration around the failed element. If data was being moved from the buffer memory 52 to the shadow memory element 50 at the time of the fault, this operation has to be completed before normal processing can resume. 
     Copying the contents of the checkpoint memory element to the primary memory can be time consuming in systems having large amounts of memory. If this copying is done during recovery, the recovery time can be considerably prolonged by this activity. If, instead, the checkpoint memory element takes over the role of the primary memory element, then the system is vulnerable to a second fault, since now there is no way of establishing further checkpoints. This vulnerability is necessary if the primary memory has in fact failed. But in the majority of cases, and, in particular, when the fault is transient, the primary memory is still functional and this vulnerability could be avoided. Avoiding this vulnerability to a second fault is, in fact, particularly desirable in the case of a transient fault since such faults often repeat themselves until the malfunctioning component can be identified and isolated. 
     One method for reducing the recovery time involves switching to the checkpoint memory element during recovery, by remapping memory so that accesses go to the checkpoint memory element, and then resynchronizing the primary memory as a background task. This narrows the period in which there is vulnerability to a second fault but does not eliminate this period. If the effect of the background memory synchronization task on performance is to be contained, the resynchronization may, in fact, take an extended period of time. 
     A preferable method for mitigating this problem involves enhancing the control logic in the checkpoint memory element to enable the control logic to copy from the shadow memory to the primary memory only the locations that have been modified since the last checkpoint. Since the buffer memory in the checkpoint memory element contains the address of every location that has been modified since the last checkpoint, and since those locations have not yet been modified in the shadow, this action will restore the primary memory to its state at the last checkpoint. Thus the primary memory can be restored by copying at most the number of lines that could be stored in the buffer memory (typically of the order of 16 megabytes) rather than the number of lines in the entire memory (typically of the order of several hundred megabytes). This reduces copying time to a fraction of a second, allowing it to be done during recovery without unduly prolonging the total recovery time. 
     Since, as part of the flushing operation, each processing unit 44 stores the processing state that existed at the time that the flush was initiated, all running tasks have been saved in a consistent state in main memory 18. The procedure for recovering from a fault is shown in FIG. 7. Following detection of a fault (step 170), the contents of the checkpoint memory element 48 can either be copied to the corresponding primary memory element 46, if it is still operational (steps 172, and 174), or the checkpoint memory element 48 can take over the role of the primary memory element 46 (step 176). In either event, normal processing can resume from that saved state (step 178). 
     If the fault was in the checkpoint memory element 48 itself, then the remainder of the computer system 11 is unaffected. The only consequence is that the computer system 11 no longer has the ability to recover if a second fault should occur before the checkpoint memory element 48 is repaired. 
     Overflow of a buffer memory 52 is also not fatal. The contents of the associated checkpoint memory element 48 can always be restored by copying the contents of its associated primary memory element 46. Since the system may not be able to recover from a fault during this interval, however, it is important that the probability of such an overflow be kept to a minimum. 
     This checkpointing protocol allows data to be written to a primary memory element 46 at any time. Consequently, a single cache line, or portion thereof, can be written to a primary memory element 46 without forcing the entire cache 42 to be flushed, thereby relaxing the requirement for a large, associative cache. Further, data can be passed from cache 42 of one processing unit 44 to cache 42 of another processing unit 44 so long as it is simultaneously updated in the primary memory element 46 and in the buffer memory 52 in the checkpoint memory element 48. Significant performance advantages can be obtained using this protocol in a multiprocessing system in which shared data is frequently passed from the processing element (e.g., 14) to another processing element (e.g., 16). 
     If a standard bus protocol is used to implement this process, a checkpoint memory element 48 remains passive so far as the interconnection mechanism (i.e., bus) 10 is concerned. It simply stores in its buffer memory 52 all data written to its corresponding primary memory element 46. In order for the checkpoint memory element 48 to accept data synchronously with the primary memory element 46, the data input buffer 54 temporarily stores the data because a line may be in the process of being copied from the buffer memory 52 to the shadow memory 50 at the time of the write or a memory refresh may be underway. 
     Some performance advantage can be gained if certain non-standard bus protocols are also implemented. For example, if the bus protocol allows the checkpoint memory element 48 to distinguish between processing elements 14, or at least to identify whether a line being stored has been written by a processing element 14 that has completed its ith flush or is still executing its ith flush, or at least to distinguish pre-flush from post-flush data, a processing element 14 does not have to wait until all other processing elements have completed their flushes before it resumes normal operation. In this case, consistency is maintained in main memory by requiring a processing element 14 to suspend normal operation after completing its ith flush only until all other processing elements 16 have also at least begun (but not necessarily completed) their ith flushes. 
     This relaxed synchronization restriction still ensures the existence of a consistent checkpoint state. That is, it guarantees that a processing element 16 that has not begun its flush does not receive post-flush modified data from another processing element 14 that has completed its flush and resumed normal processing. This less restrictive synchronization protocol can be allowed if the logic associated with the buffer memory 52, perhaps using the bus protocol, can distinguish between data that is being written as part of the flushing operation (and hence must be stored in the part of the buffer memory 52 that is to be stored to the shadow storage element 50 as soon as all processing elements 14 have completed their flushes) and data that is being written by a processing element 14 that has completed its flush (and hence is not to be transferred to shadow memory 50 until the next flush is completed). To implement this kind of cache flushing synchronization, the order and placement of steps 96 and 102 in FIG. 6A may be reversed as shown in FIG. 6B. 
     Other non-standard bus protocol features, while also not necessary to ensure a consistent state in main memory, can be introduced to decrease recovery times following a fault by reducing memory-to-memory copy time. Two such features are the ability to support &#34;dual-write&#34; and &#34;copy&#34; memory access modes. If a line is stored in dual-write mode, the primary memory element 46 stores the line in the normal way and the checkpoint memory element 48 stores the line directly in the shadow memory 50. (Thus, the checkpoint memory element 48 does not store this data in the associated buffer memory 52). In copy mode, the primary memory element 46 sources the addressed line and the checkpoint memory element 48 stores the resulting data to the corresponding location in the shadow memory 50. 
     It may also be useful to provide the capability for a memory element to operate in a &#34;phantom mode&#34; in which it acts like a primary memory element for accesses over some designated range of addresses, but like a checkpoint memory for all other addresses. This mode allows the computer system 11 to operate with some PMEs 46 shadowed and others unshadowed. Such a feature may be useful, for example, when a portion of the primary memory has failed and no replacement is immediately available, but the remainder of primary memory is still functioning normally. 
     In embodiments of the present invention described above, individual elements, including processors, memories, and I/O devices, of computer systems have been described as being interconnected by one or more memory buses. It should be understood that the memory buses may be replaced by other interconnecting mechanisms for transferring data, such as a cross-point switch, to accomplish the same function. 
     One advantage of the present invention over prior checkpointing systems is that checkpoints can be established without placing special requirements on the underlying computer platform. Thus, it is compatible with virtually any standard computer platform and can be incorporated into any such platform with little modification to that platform. Neither application programs nor users need to be involved with, or even be aware of, the checkpointing process. Additionally, this checkpointing system requires only duplication, rather than triplication, of the storage capacity of the primary memory. Very fast recovery is supported and protection against memory failures and other hardware and software faults is provided. Moreover, embodiments of the present invention offer a significant level of fault tolerance by providing a means of recovering from both memory faults and other faults in the system. 
     Given the embodiments of the invention described here, it should be apparent to those skilled in the art that the foregoing is merely illustrative and not limiting, having been presented by way of example only. Numerous modifications and other embodiments are within the scope of one of ordinary skill in the art and are contemplated as falling within the scope of the invention as defined by the appended claims and equivalents thereto.