The present application is related to U.S. patent application Ser. No. 10/244,414, filed on Sep. 17, 2002, to Altman et al., entitled “METHOD AND SYSTEM FOR MULTIPROCESSOR EMULATION ON A MULTIPROCESSOR HOST SYSTEM” having IBM Docket No. YOR920010533US1, to U.S. patent application Ser. No. 10/244,682, filed on Sep. 17, 2002, to Nair et al., entitled “HYBRID MECHANISM FOR MORE EFFICIENT EMULATION AND METHOD THEREFOR” having IBM Docket No. YOR920010534US1, to U.S. patent application Ser. No. 10/244,559, filed on Sep. 17, 2004, to Nair et al., entitled “METHOD AND SYSTEM FOR EFFICIENT EMULATION OF MULTIPROCESSOR ADDRESS TRANSLATION ON A MULTIPROCESSOR HOST” having IBM Docket No. YOR920010535US1, and to U.S. patent application Ser. No. 10/244,564, filed on Sep. 17, 2004. to Nair et al., entitled “METHOD AND SYSTEM FOR TRANSPARENT DYNAMIC OPTIMIZATION IN A MULTIPROCESSING ENVIRONMENT” having IBM Docket No. YOR920020056US1, each assigned to the present assignee, and incorporated herein by reference.
1. Field of the Invention
The present invention generally relates to computer systems, and in particular to a method for emulating the memory sharing behavior of a multiprocessing computer system on another multiprocessing computing system with an intrinsically different memory sharing behavior.
2. Description of the Related Art
A major motivation for emulation, is to allow systems written for a particular architecture, to execute on another architecture, with a minimum loss of performance. Clearly then, the efficiency of the emulation process and the quality of the resulting “host” code sequence are of paramount importance.
Typically, a computing system includes several portions, including the processors, the memory, and the input/output devices. It is often necessary to emulate the behavior of one computing system on another. One of the principal reasons for emulation is to enable programs written for a system (e.g., the “target computing system”), to perform with the same results on another system (e.g., the “host computing system”).
Several conventional techniques have been developed to emulate the instruction set of one processor using the instruction set of another processor (e.g., SIMOS as disclosed by Stephen A. Herrod,“Using Complete Machine Simulation to Understand Computer System Behavior,” Ph.D. Thesis, Stanford University, February 1998; or MIMIC as disclosed in Cathy May, “Mimic: A Fast System/370 Simulator”, Proceedings of the Object Oriented Programming Systems Languages and Applications Conference, (OOPSLA), Orlando, Oct. 4-8, 1987, Special Issue of Sigplan Notices, vol. 22, No. 12, December 1987, vol. 22, No. 7, June 24).
To perform the emulation faithfully, it is necessary also to emulate the behavior of memory in such a system. Typically, the behavior includes more than reading and writing locations in memory with program-specified addresses.
More particularly, when the contents of some location are changed by a processor in a multiprocessing system, the rules governing when the change should be observed by all processors in the system are well-defined in the architecture. In this respect, most systems today behave almost identically when there is only one processor in the system. That is, the systems enforce program order, which simply means that if a statement S1 precedes another statement S2 in the sequence of instructions presented in a program, the processor must behave as though S1 completes its execution before S2 begins its execution. This implies that S2 must know of changes made by S1 to any resource, including registers and memory.
Therefore, if a multiprocessing system is emulated on a uniprocessing system as in the above-mentioned SimOS and SimICS tchniques, and if both the target system and host system obey program order, the memory accesses during emulation can be viewed as a series of epochs 101, each epoch 101 representing a processor in the target system, as shown in
Since there is no simultaneous interaction between the emulated memory accesses of two or more processors during an epoch 101, program order can be guaranteed by simply performing a correct uniprocessor emulation of a target processor on the host processor.
Hence, in
The above interleaving operation is extremely inefficient. However, an advantage is that it is impossible that the “critical section” of one processor is interleaved with a critical section of another processor. That is, a “critical section” is a section which cannot be entered at the same time by two processors.
On a uniprocessor, one does not have to do much (e.g., nothing special) when performing the emulation, since the critical section will never be entered by two processors at the same time. In a sense, the uniprocessor automatically satisfies the condition that the critical section will not be entered by two processors simultaneously. By the same token, the situation changes dramatically when trying to emulate the processors on a multiprocessing system. That is, problems may arise.
For example,
Hence, if a program was implemented which used Dekker's algorithm and it was being run on a multiprocessing machine and emulation was being performed on a uniprocessor, then there would be no problem. However, if the same program using Dekker's algorithm was being run on a target machine and the target machine was being emulated by the multiprocessing system, then there would be a problem. Dekker's algorithm should be viewed as though it were running on processor 201, 202 as the target processor 201, 202.
Specifically, the first processor 201 sets a variable x and then ensures that the other processor 202 has not set its own variable y before getting into the critical section. The second processor 202 sets y and ensures that x is not set before progressing into the critical section. There are several ways in which the entire application can play out when emulated on a uniprocessor, two of which are shown in
However, it is impossible for the critical section of one processor to be interleaved with the critical section of the second processor since this would imply that the host processor sees (x=1; y=0) at one time and (x=0; y=1) at another without a write having occurred in between.
That is, suppose that the target system has a consistency model that ensures that this situation can never happen (e.g., by waiting after stores to memory until an acknowledgment is received from other processors). Examples of such systems include the IBM System/390® and the Intel x86®.
Also suppose that the host system, in an attempt to make its implementation relatively fast, has a more relaxed consistency model and does not guarantee atomic recording of writes to memory. Incorrect behavior may therefore result when the example above is emulated by such a host system.
Systems which have such relaxed consistency models like the PowerPC®, invariably offer special synchronizing instructions, or memory barrier instructions that ensure that results of memory actions before the instruction are guaranteed to have been seen by all processors before seeing the results of later instructions.
Thus, one way to ensure that the simulation is done correctly is to follow every memory instruction with a memory barrier instruction. Unfortunately, such instructions take several cycles to complete. Moreover, memory instructions (e.g., loads and stores from and to memory) are quite frequent (e.g., oftentimes as many as a third of all instructions).
It therefore becomes desirable to find a solution to the above problem. Further, it becomes desirable to minimize the cost of emulating the memory consistency behavior of a multiprocessing system on another multiprocessing system, especially when the host multiprocessing system supports a “weaker” (more relaxed) consistency model compared to the target multiprocessing system (more stringent or “strong”). It is noted that the terms “weaker” (or “relaxed”) and “strong” are believed to be well-known to those of ordinary skill in the art (e.g., see Sarita Adve et al., “Shared Memory Consistency Models: A Tutorial,” IEEE Computer, vol. 29, no. 12, December 1996, pp. 66-76, and L. Lamport, “How to Make a Multiprocessor Computer That Correctly Executes Multiprocess Programs,” IEEE Transactions on Computers, C-28, 9, September 1979, pp. 690-691).
Thus, in the conventional emulation methods and techniques, various levels of translation may be employed to enhance the performance of the host instructions produced by the emulator. However, notwithstanding all the current techniques, there remains much room for improvement.
Hence, in the conventional techniques and prior to the present invention, there has been no method and apparatus for emulating memory consistency of one system on another system, especially when the host is supporting the above-mentioned relaxed consistency model and the target system uses a strong consistency model.
In view of the foregoing and other problems, drawbacks, and disadvantages of the conventional methods and structures, an object of the present invention is to provide a method and structure for effectively emulating the memory consistency behavior of a multiprocessing system on another multiprocessing system when the host multiprocessing system supports a relaxed consistency model, while the target multiprocessing system specifies a strong consistency model.
In a first aspect of the present invention, a method (and system) of emulation in a multiprocessor system, includes performing an emulation in which a host multiprocessing system of the multiprocessor system supports a weak consistency model, and the target multiprocessing system of the multiprocessor system supports a strong consistency model.
In a second aspect of the present invention, in a multiprocessor computing system including an emulator for emulating a behavior of a target multiprocessor computing system, a method for emulating a memory consistency behavior of the target multiprocessor computing system, includes executing, prior to a memory action, a memory barrier instruction, the memory barrier instruction ensuring that results of memory actions performed before execution of the memory barrier instruction have been obtained by all processors in a host computing system, wherein the host computing system of said multiprocessor computing system supports a weak consistency model, and the target multiprocessing system of the multiprocessor system supports a strong consistency model.
In a third aspect of the present invention, a method (and system) of efficient emulation of multiprocessor memory consistency, includes forming a memory barrier instruction which ensures that memory actions that have been performed before execution of the memory barrier instruction, have been registered by all of the processors in a host computing system, wherein the host multiprocessing system supports a relaxed consistency model, and the target multiprocessing system specifies a strong consistency model.
In a fourth aspect of the present invention, a method (and system) of ensuring memory consistency in a multiprocessing system, includes determining whether an instruction is a load or a store, if it is determined that the instruction is a load or a store, then resolving an address of the instruction and determining whether the address is stored in a local look-aside buffer (LLB), if the address is in the LLB, then determining whether the location is in a shared-read state, and if it is determined that the location is in a shared-read state, then determining whether the current address is a write, wherein if the current address is not a write, then performing the emulation of the instruction.
In a fifth aspect of the present invention, a method (and system) of inserting code for maintaining consistency within a group of instructions in a multiprocessor system, includes determining whether the instruction is a load or a store, if it is determined that the instruction is a load or a store, then resolving the address, and determining whether the address is in the local look-aside buffer (LLB), if the address is in the LLB, then determining whether the location is in a shared-read state, if it is determined that the location is in a shared-read state, then determining whether the current accesses is a write, if the current access is determined to be a write, then setting the location to a shared-write and determining whether the current access is a load instruction, if it is determined that the current access is a load, then performing a load and determining whether the load is satisfied from a memory order buffer (MOB) table, and if the load is not satisfied from the MOB table, then inserting a corresponding entry into the MOB table indexed by a memory sequence number.
In a sixth aspect of the present invention, a method (and system) of committing shared writes to memory at an end of group execution of instructions, includes at an end of translation, adding a stub code which checks to ensure that no other processor has changed values to “shared-write” locations accessed by a block.
In a seventh aspect of the present invention, a storage reference table (SRT) for a shared multiprocessor system, includes a table constructed which contains as many entries as a number of store references, and wherein each entry contains a plurality of fields including an address field and an old-value field for storing original values for recovery, wherein the table stores information concerning a shared write status of the entries.
In an eighth aspect of the present invention, a memory order buffer (MOB) for a shared multiprocessor system, includes a table maintained with sharing information about locations currently being referenced, wherein the information includes information distinguishing whether a particular state of an entry comprises a shared write state.
In a ninth aspect of the present invention, a system for emulation in a multiprocessor system, includes an emulator for performing an emulation in which a host multiprocessing system of the multiprocessor system supports a weak consistency model, and the target multiprocessing system of the multiprocessor system supports a strong consistency model.
In a tenth aspect of the present invention, a signal-bearing medium is provided tangibly embodying a program of machine-readable instructions executable by a digital processing apparatus to perform a method of emulation in a multiprocessor system, the method including performing an emulation in which a host multiprocessing system of the multiprocessor system supports a weak consistency model, and the target multiprocessing system of the multiprocessor system supports a strong consistency model.
With the unique and unobvious aspects of the present invention, emulation can be efficiently performed of a critical section by a plurality of processors being emulated on a multiprocessing system. That is, the invention is directed to emulating the processors entering the critical sections when such sections are being emulated at the same time for different processors. Again, in the past, such a problem has not been encountered since emulation has been traditionally performed on a uniprocessor. In this regard, the present inventors were the first to recognize such a problem and come up with a unique and unobvious solution.
To ensure the above-mentioned memory consistency, in a first embodiment, the present invention provides a memory barrier instruction which ensures that memory actions that have been performed before execution of the memory barrier instruction, have been accessed (e.g., registered) by all of the processors in the host. This ensures that memory consistency is achieved, since the processors have had the opportunity to register such memory actions/operations.
It is noted that the present invention is most concerned with the “shared write” state.
The foregoing and other purposes, aspects and advantages will be better understood from the following detailed description of a preferred embodiment of the invention with reference to the drawings, in which:
Referring now to the drawings, and more particularly to
Preferred Embodiment
For purposes of this discussion, it assumed that the target multiprocessing system supports sequential consistency. This is a stronger form of consistency than is supported by most known systems. Sequential consistency was defined by Lamport (L. Lamport, “How to Make a Multiprocessor Computer That Correctly Executes Multiprocess Programs,” IEEE Transactions on Computers, C-28, 9, September 1979, pp. 690-691) to imply that the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in the order specified by its program.
It is also assumed that the host multiprocessing system supports weak consistency (RCsc as defined in the above-mentioned article by Adve et al) but with memory coherence (e.g., memory coherence implies that the order of changes made to a single location is the same when viewed by any processor).
In addition, the existence of a memory barrier instruction, mbar, is assumed which serves to guarantee that all memory operations after the barrier are performed after all memory operations before the barrier as seen (e.g., registered) by all processors.
Sequential consistency can be guaranteed by following every instruction that accesses memory with an mbar instruction. As mentioned earlier, synchronizing instructions typically take multiple cycles, and should be avoided if possible.
A first observation is that not all memory locations are shared between processors. Thus, it would greatly reduce the cost of maintaining sequential consistency if it could be determined with certainty whether a given location is shared or not.
In the case of cached emulation of a system, it is not sufficient to learn the sharing behavior during translation because (a) the address referenced by an instruction may change at each execution of the translation, and (b) an address may change its sharing status during the course of execution. Hereinbelow is described a mechanism that determines the shared nature of the location dynamically.
A table is preferably maintained with sharing information about the locations currently being referenced. To reduce the size of the table, locations are grouped together. One convenient grouping is a page unit, though other, possibly smaller, units can be defined. The page unit is convenient because it is also the unit of protection and mapping information in the page table and in the local lookaside buffer (LLB) as described in the above-mentioned U.S. patent application Ser. No. 10/244,564, incorporated herein by reference and having IBM Docket No. YOR920010535US1. Each page is in one of five states listed below:
Before a page is brought in, or after it is flushed out of the page table, it will be in the “not mapped” state. The page gets brought in when some processor requests it either for reading or for writing. Therefore, the page comes into existence in the page table either as an “exclusive read” or as an “exclusive write.”
Associated with each page table entry is a list of processors that have the page listed in their local lookaside buffer (LLB), as described in the above- mentioned U.S. patent application Ser. No. 10/244,564, incorporated herein by reference and having IBM Docket No. YOR920010535US1.
This information is in the lookaside mask field where, for example, a 1 in the fifth position indicates that the fifth processor has this page in its LLB. This description is modified, as shown in the table 500 of
The table 500 includes a validity/status bit field 510, a process identification field 520, a virtual address field 530, a real address field 540, a protection bit field 550, a look-aside mask field 560, a read/write mask field 570, and a mode of access field 580.
At some later time, if a processor wants to access a page that is not in its LLB, but is mapped in the page table 500, then that processor is added to this list (e.g., at processor ID field 520) and its mode of access (e.g., field 580) is specified.
At this point, the state of the page is changed to “shared read” if all processors accessing the page have access to it only in the read mode. If even one processor has write access to the page, then the page is set to a “shared write” mode. This procedure is described in the flowchart of
Thus, as described above, it is suggested why a page having the “shared write” state is a primary focus which the invention must consider.
Further, as mentioned above, certain exemplary assumptions have been made by the invention such as the target system supports “sequential consistency” (“strong”) and that the host supports “weak” consistency, etc.
However, this is merely exemplary and certainly the invention is not limited thereto. Indeed, it is noted that the invention supports a number of different combinations and permutations of “strong” and “weak” consistencies. However, the inventors have recognized that the hardest case is a “strong” on “weak” scenario, and thus this is discussed primarily herein. The other cases (e.g., “strong” on “strong”, “weak” on “weak”, “strong” on “weak”, etc.) will operate similarly, but more easily.
That is, trying to emulate a system having “strong” consistency on a system which supports “weak” consistency is the most difficult emulation case. To give a simplistic example of why it is the most difficult case, consider a blackboard in which different people are writing into the blackboard. In a “strong” consistency case, when one person is reading, then the person should be able to see everything that everyone else already has written. Similarly, when another person is writing, then that person ensures that everyone else has finished writing before the person begins writing. This is termed “strong” consistency in which a strong order is maintained in the reads and writes to the blackboard.
In a “weak” consistency (or “release” consistency) case, each person is allowed to write and read whenever that person wishes to do so. In this regard, the person need not ensure that other people have already read (or written it) before he changes it. In such a case, it is the responsibility of some “teacher” (e.g., some program in the instant case) to make sure that where the person needs to read it, the person has in fact already read it before another person starts writing it back again (e.g., changing what is written). This is a more chaotic situation as people continue reading and writing. Many conventional processors today employ such a “weak” consistency model since it allows processors to go much faster than when sharing. Thus, from a performance point of view, the “weak” consistency model is a much better model when there is not much sharing.
Hence, some new machines are implementing such a model and mode of operation. In contrast, older conventional machines have implemented a strong consistency where the operations are sequential (step-by-step).
Thus, as can be expected, it is very difficult to take a very orderly mode of operation (“strong”) and apply it to a relatively disorderly operation (e.g., “weak”). In contrast, taking a very disorderly mode of operation (“weak”) and applying it to an orderly operation (e.g., “strong”) is easier because one is simply providing more order.
Thus, the “shared write” state is of most concern. When a page is brought into the system, the system wants to determine what state the page has. When the page has a “shared write” state, then such a state is flagged, as determined and shown in the read/write mask field 570 in table 500. That is, the read/write mask allows one to identify whether the page is a “shared write” or not. It is noted that the mode of access field 580 is not a field which really exists in the table 500 of
Hence, returning to
More specifically, in step 610, it is determined whether the look-aside mask has more than one bit set.
If it is determined that the lookaside mask has more than one bit set (e.g., a “YES”) in step 610, then in step 620 it is determined whether the read/write mask has any bits set.
If it is determined that the read/write mask has bit(s) set (e.g., a “YES”) in step 620, then in step 630, the status is set to a “shared write”.
If it is determined that the read/write mask does not have any bit(s) set (e.g., a “NO”) in step 620, then in step 640, the status is set to a “shared read”.
If, in step 610, it is determined that the lookaside mask does not have more than one bit set (e.g., a “NO”), then in step 650 it is determined whether the read/write mask has any bits set.
If it is determined that the read/write mask has bit(s) set (e.g., a “YES”) in step 650, then in step 660, the status is set to an “exclusive write”.
If it is determined that the read/write mask does not have any bit(s) set (e.g., a “NO”) in step 650, then in step 670, the status is set to an “exclusive read”. Then, the process terminates.
The possible transitions between various shared memory states of a page is depicted in a partial state machine 700 of
Even though “shared write” is of most interest,
As long as locations are not being written to, there is no problem with storage consistency. That is, storage consistency problems arise only when locations change their contents. It is assumed that at any given point in time, the execution of a given target processor is performed at exactly one host processor, although the exact host processor which performs the emulation may be different at different times.
For example, the simultaneous fetch of operands of a target instruction by two separate processors is disallowed. It is also assumed that, as is the case in common multiprogrammed systems, a context switch is associated with an implicit or explicit memory barrier. This ensures that as long as a location is not shared there are no consistency problems even if the actions of a target processor being emulated move from one host processor to another.
The above assumptions limit consistency problems to only those accesses that occur to pages in the “shared write” state. Thus, it suffices to follow every such access by an mbar instruction.
The procedure for ensuring sequential consistency when instructions are emulated one at a time is depicted in the flowchart of
That is,
First, in step 805, it is determined whether the instruction is a load or a store. The invention is not necessarily concerned with other instructions as loads and stores are the primary ones affecting memory.
If it is determined that the instruction is not a load or a store (e.g., a “NO”) in step 805, then the process proceeds to step 840 where the emulation of the instruction is performed, and then the process completes in step 870.
By the same token, if it is determined that the instruction is a load or a store (e.g., a “YES”) in step 805, then the process proceeds to step 810 where the address is resolved. For example, a load/store instruction typically needs to add two quantities specified by the instruction in order to create the address. Both these quantities may either reside in specified registers, or one of the quantities is a field in the instruction itself. Resolution of the address means that the specified registers are ready with their contents, the addition has been performed, and the address translation mechanism has been invoked to convert the resulting sum into a real address. Hence, “resolving the address” would convert the virtual address to the real address (e.g., adding displacement, the virtual address translation, etc.).
In step 815, it is determined whether the address is in the local look-aside buffer (LLB). If the address is not in the LLB (e.g., a “NO”), then in step 820, procedures are initiated for an LLB miss (e.g., going to the global page table, etc.), and then the process loops back to step 815.
If the address is in the LLB (e.g., a “NO”), then in step 825, it is determined whether the location (e.g., the address) is in a shared-read state.
If, in step 825, it is determined that the location (e.g., the address) is in a shared-read state (e.g., a “YES”), then the process continues to step 830 in which it is determined whether the current address is a write. If it is not a write (e.g., a “NO”), then in step 840, the emulation of the instruction is performed and the process ends at step 870.
If, in step 830, the current access is determined to be a write (e.g., a “YES”), then in step 845, the location is set to a shared-write and in step 850 the emulation of the instruction is performed, and in step 860 the mbar instruction is placed thereat. The process then ends at step 870.
By the same token, if, in step 825, it is determined that the location (e.g., the address) is not in a shared-read state (e.g., a “NO”), then the process continues to step 835 in which it is determined whether the location (e.g., current address) is a shared-write.
If, in step 835, the location (address) is determined to be a shared-write state, then the process continues to step 850 where the emulation of the instruction is performed, and in step 860 the mbar instruction is placed thereat. The process then ends at step 870.
Thus, at steps 830/835,
It may be possible, depending on the extent to which reordering is permitted between operations in the target system (relaxation of consistency), to reduce the number of memory barrier instructions further.
For example, in the System/390, it is not required to maintain ordering between the reading of operands of a single instruction. Hence, the mbar inserted between such reads in the emulation of a System/390 may be eliminated, thereby keeping the one after the second read.
In addition, because results written by an instruction are dependent on the operands read by the instruction, an mbar between the reading of operands and writing of results to memory in a 390 instruction can be eliminated, keeping the one after the write.
The discussion above assumes that the program order of emulated memory references is identical to the program order of the memory references that would have been performed by a target system. As discussed in several known examples (e.g., see U.S. Pat. No. 6,031,992, incorporated herein by reference), it is often possible to improve the emulation performance by considering groups of instructions to be translated together, and by performing optimizations on the translated group.
However, such optimizations tend to move instructions and reorder them in an attempt to find a favorable schedule for the group. Such a reordering could violate consistency requirements when executed in a multiprocessor environment, even if each of the emulated references is followed by an mbar instruction.
Referring to
For simplicity, it is assumed that the original sequence of instructions is a sequential stream of instructions with a single entry, but with multiple exits, each exit corresponding to a conditional branch out of the translated sequence.
It is also assumed that each instruction in this sequence is executed at most once (i.e., there are no branches that loop back to another instruction within the translation). Finally, it is assumed that the only memory references in the target instruction set are loads and stores between registers and memory. (This last assumption is not limiting in any way because more complex CISC-style instructions can be broken up into an appropriate sequence of instructions that include such load and store instructions.)
In
Next, each load and each store in the group of instructions are associated with two numbers including (a) the memory sequence number that indicates its position in the sequence of memory references, and (b) the store sequence number that indicates its position in the sequence of store reference subset.
Then, as shown in
The number of entries in the table is equal to the number of memory references in the sequence.
Additionally, as shown in the configuration 1100 of
For example, a problem may arise when someone else wrote something that another person has already read, and what should have been written was something “new” (not something “old”). As a result, all of the computations are wrong. In such a case, it would be helpful to set the values back. Moreover, some of the computations may actually have been stored to memory and it is desirable to reset those locations back to the previous values (e.g., back to their original contents). Hence, using Table 1110 is helpful since it stores addresses and values to fix the problem.
More specifically, the system senses a problem, and now must go back and restore the value to a time when it was correct. It performs such an operation by looping back and going through each of the stores one at a time (e.g., preferably performing the last one first after the last checkpoint and so forth) and determining the location and what the old value was. Then, the old value is inserted thereat.
In the translation of each memory reference, code is included having the form shown in
That is, in the method 1200 of
Specifically, first, in step 1205, it is determined whether the instruction is a load or a store. Again, the invention is not necessarily concerned with other instructions as loads and stores are the primary ones affecting memory.
If it is determined that the instruction is not a load or a store (e.g., a “NO”) in step 1205, then the process proceeds to step 1240 where the emulation of the instruction is performed, and then the process completes in step 1290.
By the same token, if it is determined that the instruction is a load or a store (e.g., a “YES”) in step 1205, then the process proceeds to step 1210 where the address is resolved. This step is similar to step 810 described above with regard to
In step 1215, it is determined whether the address is in the local lookaside buffer (LLB). If the address is not in the LLB (e.g., a “NO”), then in step 1220, procedures are initiated for an LLB miss (e.g., going to the global page table, etc.), and then the process loops back to step 1215.
If the address is in the LLB (e.g., a “NO”), then in step 1225, it is determined whether the location (e.g., the address) is in a shared-read state.
If, in step 1225, it is determined that the location (e.g., the address) is in a shared-read state (e.g., a “YES”), then the process continues to step 1230 in which it is determined whether the current access is a write. If it is not a write (e.g., a “NO”), then in step 1240, the emulation of the instruction is performed and the process ends at step 1290.
If, in step 1230, the current access is determined to be a write (e.g., a “YES”), then in step 1245, the location is set to a shared-write and in step 1250 it is determined whether the current access is a load instruction.
If, in step 1250, it is determined that the current access is a load (e.g., a “YES”), then in step 1255 the load is performed, and it is determined whether the load is satisfied from the MOB (e.g., did the load/address occur earlier in the MOB?). If the load is satisfied, then the operation terminates at step 1270.
If the load is not satisfied from the MOB (e.g., a “NO”) in step 1255, then the process continues to step 1260. In step 1260, the entry is inserted into the MOB indexed by the memory sequence number and the process terminates at step 1290
If, in step 1250, it is determined that the current access is not a load (e.g., a “NO”), then in step 1260 the entry is inserted into the MOB indexed by the memory sequence number and the process terminates at step 1290.
By the same token, returning to step 1235, if it is determined that the location (e.g., the address) is not in a shared-write state (e.g., a “NO”), then the process continues to step 1265 in which it is determined whether the access is a write.
If, in step 1265, the access is not a write (e.g., a “NO”), then the process continues to step 1240 where the emulation of the instruction is performed, and in step 1290 the process ends.
By the same token, if in step 1265, the access is determined to be a write (e.g., a “YES”), then the process continues to step 1270 at which time the old value of the location is read. Then, in step 1275, a store is performed and at step 1280 the old value is inserted into the SRT indexed by the store sequence number. Thereafter, in step 1290 the process terminates.
Thus, as shown in
This stub code indexes the MOB using the sequence number of the memory reference and records (a) whether it is a load or a store, and (b) the address of the reference. If the reference is a store, then it records also the value to be stored. If it is a load, then it performs the load and then records the value loaded.
A special case is made for a load to a shared-write location that has been the target of a previous store in the translation. In this case, the load should receive its contents from the MOB and the load itself is not recorded in the MOB.
If the reference is not to a “shared-write” location and if it is a store, then the old value of the location is read and recorded in the SRT before the store is performed.
It is noted that this stub code can be exposed to optimization and reordered along with the rest of the translation. At the end of the translation, another stub is added which checks to ensure that no other processor has changed values to “shared-write” locations accessed by this block.
This is done as shown in
If a mismatch occurs during the load validation process, the entire execution of the group is cancelled. This is effected by restoring all registers to their old state and by reversing the stores made to non-“shared-write” locations by undoing operations in the SRT. Once the system is brought back to its previously valid state, execution is reattempted. In order to avoid repeated execution-and-cancellation cycles within a group, re-execution may be done one-at-a-time using either the interpretation mode or a simple translation mode.
Hence,
Thus, looking now step-by-step at the process 1300 in
Then, in step 1310, the pointer is set to the first entry in the MOB, and in step 1315 it is determined if the end of the MOB has been reached. It is noted that the left side of the process after step 1315, is directed to the loads, whereas the right side of the process after step 1315, is directed to stores.
If “NO” in step 1315, then in step 1320, it is determined whether the entry in the MOB is empty. (If “YES” in step 1315, then the process proceeds to step 1340.).
Then, in step 1325, it is determined if the entry is a load. If “NO” in step 1325, then in step 1340, the pointer is incremented to the MOB and loops back to step 1315.
By the same token, if in step 1325 it is determined that the entry is a load (e.g., a “YES”), then in step 1330, the entry is reloaded from the address in the entry. In step 1335, it is determined whether the value reloaded matches that in the entry.
If “YES” in step 1335, then in step 1340 the pointer is incremented to the MOB and loops back to step 1315.
In “NO” in step 1335, then the lock is released in step 1345 and then in step 1350 recovery is performed to the beginning of the group by restoring the state and by restoring the non-shared writes using the SRT. At this point, the emulated program counter is reset to the beginning of the group, and the process of execution reattempted.
By the same token, if “YES” in step 1315, then the process goes to step 1355, at which the pointer is set to the first entry in the MOB. In step 1360, it is determined if the end of the MOB has been reached.
If “NO”, then it is determined if the entry in the MOB is empty in step 1365. (If “YES” in step 1365, then the process proceeds to step 1380.).
Then, in step 1370, it is determined whether the entry in the MOB is a store. If the entry is a store (e.g., a “YES”), then the value is written to memory in step 1375 and the pointer is incremented in the MOB in step 1380 and then the process loops back to step 1360.
If a “NO” results in step 1370, then the process continues to step 1380 and then loops back to step 1360. If a “YES” in step 1360, then in step 1385, the lock is released and the process completes in step 1390.
Thus, as described above, the present invention can either go through instructions one-by-one, or can process groups of instructions by using the MOB and the SRT.
The CPUs 1411 are interconnected via a system bus 1412 to a random access memory (RAM) 1414, read-only memory (ROM) 1416, input/output (I/O) adapter 1418 (for connecting peripheral devices such as disk units 1421 and tape drives 1440 to the bus 1412), user interface adapter 1422 (for connecting a keyboard 1424, mouse 1426, speaker 1428, microphone 1432, and/or other user interface device to the bus 1412), a communication adapter 1434 for connecting an information handling system to a data processing network, the Internet, an Intranet, a personal area network (PAN), etc., and a display adapter 1436 for connecting the bus 1412 to a display device 1438 and/or printer 1439 (e.g., a digital printer or the like).
In addition to the hardware/software environment described above, a different aspect of the invention includes a computer-implemented method for performing the above method. As an example, this method may be implemented in the particular environment discussed above.
Such a method may be implemented, for example, by operating a computer, as embodied by a digital data processing apparatus, to execute a sequence of machine-readable instructions. These instructions may reside in various types of signal-bearing media.
Thus, this aspect of the present invention is directed to a programmed product, comprising signal-bearing media tangibly embodying a program of machine-readable instructions executable by a digital data processor incorporating the CPU 1411 and hardware above, to perform the method of the invention.
This signal-bearing media may include, for example, a RAM contained within the CPU 1411, as represented by the fast-access storage for example. Alternatively, the instructions may be contained in another signal-bearing media, such as a magnetic data storage diskette 1500 (
Whether contained in the diskette 1500, the computer/CPU 1411, or elsewhere, the instructions may be stored on a variety of machine-readable data storage media, such as DASD storage (e.g., a conventional “hard drive” or a RAID array), magnetic tape, electronic read-only memory (e.g., ROM, EPROM, or EEPROM), an optical storage device (e.g. CD-ROM, WORM, DVD, digital optical tape, etc.), paper “punch” cards, or other suitable signal-bearing media including transmission media such as digital and analog and communication links and wireless. In an illustrative embodiment of the invention, the machine-readable instructions may comprise software object code, compiled from a language such as “C”, etc.
With the unique and unobvious aspects of the present invention, emulation can be efficiently performed of a critical section by a plurality of processors being emulated on a multiprocessing system. That is, the invention can emulate the processors entering the critical sections when such sections are being emulated at the same time for different processors. Again, in the past, such a problem has not been encountered since emulation has been traditionally performed on a uniprocessor. In this regard, the present inventors were the first to recognize such a problem and come up with a unique and unobvious solution as described above. Further, the invention can ensure the above-mentioned memory consistency.
While the invention has been described in terms of several preferred embodiments, those skilled in the art will recognize that the invention can be practiced with modification within the spirit and scope of the appended claims.
Further, it is noted that, Applicant's intent is to encompass equivalents of all claim elements, even if amended later during prosecution.
Number | Name | Date | Kind |
---|---|---|---|
4392196 | Glenn et al. | Jul 1983 | A |
4564903 | Guyette et al. | Jan 1986 | A |
5055999 | Frank et al. | Oct 1991 | A |
5307477 | Taylor et al. | Apr 1994 | A |
5388215 | Baker et al. | Feb 1995 | A |
5390309 | Onodera | Feb 1995 | A |
5440710 | Richter et al. | Aug 1995 | A |
5481684 | Richter et al. | Jan 1996 | A |
5574878 | Onodera et al. | Nov 1996 | A |
5574922 | James | Nov 1996 | A |
5615327 | Magee et al. | Mar 1997 | A |
5619665 | Emma | Apr 1997 | A |
5668969 | Fitch | Sep 1997 | A |
5675762 | Bodin et al. | Oct 1997 | A |
5678032 | Woods et al. | Oct 1997 | A |
5751982 | Morley | May 1998 | A |
5761734 | Pfeffer et al. | Jun 1998 | A |
5768593 | Walters et al. | Jun 1998 | A |
5832205 | Kelly et al. | Nov 1998 | A |
5905998 | Ebrahim et al. | May 1999 | A |
5983012 | Bianchi et al. | Nov 1999 | A |
6031992 | Cmelik et al. | Feb 2000 | A |
6047323 | Krause | Apr 2000 | A |
6075937 | Scalzi et al. | Jun 2000 | A |
6075938 | Bugnion et al. | Jun 2000 | A |
6091897 | Yates et al. | Jul 2000 | A |
6134515 | Skogby | Oct 2000 | A |
6158049 | Goodwin et al. | Dec 2000 | A |
6189141 | Benitez et al. | Feb 2001 | B1 |
6195676 | Spix et al. | Feb 2001 | B1 |
6240490 | Lyles et al. | May 2001 | B1 |
6289369 | Sundaresan | Sep 2001 | B1 |
6289419 | Takahashi | Sep 2001 | B1 |
6339752 | Mann et al. | Jan 2002 | B1 |
6341371 | Tandri | Jan 2002 | B1 |
6345351 | Holmberg | Feb 2002 | B1 |
6351844 | Bala | Feb 2002 | B1 |
6381682 | Noel et al. | Apr 2002 | B2 |
6430657 | Mittal et al. | Aug 2002 | B1 |
6463582 | Lethin et al. | Oct 2002 | B1 |
6480845 | Egolf et al. | Nov 2002 | B1 |
6529862 | Mann et al. | Mar 2003 | B1 |
6539464 | Getov | Mar 2003 | B1 |
6728950 | Davis et al. | Apr 2004 | B2 |
6738974 | Nageswaran et al. | May 2004 | B1 |
6763328 | Egolf et al. | Jul 2004 | B1 |
6763452 | Hohensee et al. | Jul 2004 | B1 |
6883165 | Blandy et al. | Apr 2005 | B1 |
6915513 | Duesterwald et al. | Jul 2005 | B2 |
6920416 | Swoboda et al. | Jul 2005 | B1 |
6934832 | Van Dyke et al. | Aug 2005 | B1 |
6961806 | Agesen et al. | Nov 2005 | B1 |
6978233 | Burns | Dec 2005 | B1 |
7047394 | Van Dyke et al. | May 2006 | B1 |
7080366 | Kramskoy et al. | Jul 2006 | B2 |
7089539 | Dornan et al. | Aug 2006 | B2 |
7093231 | Nuss | Aug 2006 | B2 |
7134119 | Nevill | Nov 2006 | B2 |
7275028 | Traut | Sep 2007 | B2 |
7735073 | Kosche et al. | Jun 2010 | B1 |
8065504 | Yates et al. | Nov 2011 | B2 |
8121828 | Yates et al. | Feb 2012 | B2 |
8146063 | Lindwer et al. | Mar 2012 | B2 |
20010020224 | Tomita | Sep 2001 | A1 |
20020019969 | Hellestrand et al. | Feb 2002 | A1 |
20020026304 | Deao et al. | Feb 2002 | A1 |
20020066086 | Linden | May 2002 | A1 |
20020082823 | Traut | Jun 2002 | A1 |
20020083278 | Noyes | Jun 2002 | A1 |
20020104075 | Bala et al. | Aug 2002 | A1 |
20020144081 | Willis et al. | Oct 2002 | A1 |
20020147969 | Lethin et al. | Oct 2002 | A1 |
20020199172 | Bunnell | Dec 2002 | A1 |
20030093780 | Freudenberger et al. | May 2003 | A1 |
20030171907 | Gal-On et al. | Sep 2003 | A1 |
20030182653 | Desoli et al. | Sep 2003 | A1 |
20030196142 | Brooks | Oct 2003 | A1 |
20040015888 | Fujii et al. | Jan 2004 | A1 |
20040019886 | Berent et al. | Jan 2004 | A1 |
20090204785 | Yates et al. | Aug 2009 | A1 |
Number | Date | Country |
---|---|---|
63-226740 | Sep 1988 | JP |
07-271738 | Oct 1995 | JP |
08-087424 | Apr 1996 | JP |
08-234981 | Sep 1996 | JP |
08-272686 | Oct 1996 | JP |
08-272686 | Oct 1996 | JP |
11-134307 | May 1999 | JP |
11-259437 | Sep 1999 | JP |
WO 9516967 | Jun 1995 | WO |
WO 9903037 | Jan 1999 | WO |
WO 9944131 | Sep 1999 | WO |
Entry |
---|
Standards Information Network IEEE Press, IEEE 100 The Authoritative Dictionary of IEEE Standards Terms, 7th Ed., 2000, 5 pages. |
Wikipedia entries and revision histories of “Memory coherence”, “Consistency model”, “Weak consistency”, “Emulator”, “Virtual machines”, and “Simulation”, http://en.wikipedia.org, accessed Feb. 21, 2007, 21 pages. |
Department of Defense, “DoD Modeling and Simulation (M&S) Glossary”, Jan. 1998, 175 pages. |
Lee, Jaejin “Hiding the Java Memory Model with Compilers”, 2000, 8 pages. |
Lee et al. “Hiding Relaxed Memory Consistency with a Compiler”, Aug. 2001, IEEE Transactions on Computers, vol. 50, No. 8, pp. 824-833. |
Raina, Sanjay “Emulation of a Virtual Shared Memory Architecture” Sep. 1993, Thesis, 199 pages. |
Turley, J., “Alpha Runs x86 Code with FX!32”, Microprocessor Report, Mar. 5, 1996. |
May, C., “Mimic: A Fast System/370 Simulator”, Proceedings of the Object Oriented Programming Systems Languages and Applications Conference (OOPSLA), Orlando, FL, Oct. 4-8, 1987, special Issue of Sigplan Notices, Dec. 1987, vol. 22, No. 7, Jun. 24. |
Magnusson, P.S., “A Design for Efficient Simulation of a Multiprocessor”, Proceedings of the First International Workshop on Modeling, Analysis, and Simulation of Computer and Telecommunication Systems (MASCOTS), La Jolla, CA Jan. 1993, pp. 69-78. |
Lamport, L., “How to Make a Multiprocessor Computer that Correctly Executes Multiprocess Programs”, IEEE Transactions on Computers, C-28, Sep. 9, 1979, pp. 690-691. |
Adve, S., et al., “Shared Memory Consistency Models: A Tutorial”, IEEE Computer, vol. 29, No. 12, Dec. 1996, pp. 66-76. |
Herrod, S.A., “Using Complete Machine Simulation to Understand Computer System Behavior”, Ph.D. Thesis, Stanford University, Feb. 1998. |
Nichols, B., et al., “Pthreads Programming: A POSIX Standard for Better Multiprocessing” (O'Reilly Nutshell), Sep. 1996. |
“A framework for remote dynamic program optimization”, M. J. Voss and R. Eigenmann, Proceedings of the ACM SIGPLAN workshop on Dynamic and adaptive compilation and optimization table of contents pp. 32-40, 2000, pp. 32-40, ISBN: 1-58113-241-7. |
“Using Annotation to Reduce Dynamic Optimiation Time”, C. Krintz and B. Calder, 2001 ACM ISBN-158113-414-2/01/06, pp. 156-167. |
“Prototype Real-Time Monitor: Design” R. Van Scoy et al., Technical Report CMU/SEI-87-TR-038 ESD-TR-87-201, Nov. 1987. |
Bala, V., et al., “Dynamo: A Transparent Dynamic Optimization System”, Conference on Programming Language Design and Implementation, 2000, pp. 1-12. |
Burke M.G., et al., “The Jalapeno Dynamic Optimizing Compiler for JavaTM”, IBM Thomas J. Watson Research Center Technical Paper, Mar. 1999, 13 pages. (published 1999 ACM Java Grande Conference Proceedings, San Francisco, CA, Jun. 12-14, 1999). |
Ball, T., et al., “Efficient Path Profiling”, IEEE Proceedings of MICRO-29, Dec. 2-4, 1996, pp. 1-12. |
“Java Multihreading” David Nelson-Gal et al., Jun. 1, 1998, Java Developer's Journal, pp. 1-4, http://jdj.sys-con.com/read/35997,htm. |
Japanese Office Action dated Nov. 1, 2005. |
IBM, “Low-Synchronization Translation Lookaside Buffer Consistency Algorithm” (ID NB9011428), IBM Technical Disclosure Bulletin, Nov. 1990 vol. 33 Issue 6B p. 428-433. |
Hoogerbrugge et al., “Pipelined Java Virtual Machine Interpreters”, 2000 (15 pages). |
University of Queensland, “The University of Queensland Binary Translator (UQBT) Framework”, 2001, 326 page (34 pages extracted). Online version can be obtained at <www.experimentalstuff.com/Technologies/uqbt/uqbt.pdf>. |
Julian Brown, “ARMphetamine—A Dynamically Recompiling ARM Emulator”, May 2000, 97 pages (36 pages extracted). Online version can be obtained at <http://armphetamine.sourceforge.net/diss.ps>. |
“Computer Dictionary”, Third Edition, Microsoft Press, 1997, excerpts including p. 467. |
United States Notice of Allowance dated Jun. 25, 2013 in U.S. Appl. No. 13/311,858. |
Ung et al., Machine-adaptable dynamic binary translation, Jan. 2000, 11 pages. |
Cifuentes et al., Experience in the design, implementation and use of a retargetable static binary translation framework, Jan. 2002, 59 pages. |
United States Office Action dated Apr. 9, 2013 in U.S. Appl. No. 13/085,873. |
Rosenburg, Bryan. Low-synchronization translation lookaside buffer consistency in large-scale shared-memory multiprocessors., 1989. ,vol. 23. No. 5., ACM, pp. 137-146. |
Lai et al.; Load balancing in distributed shared memory systems; IPCCC 1997., IEEE International; pp. 152-158. |
Liang et al.; An effective selection policy for load balancing in software DSM; Parallel Processing, 2000. Proceedings.2000 International Conference on Aug. 2000 pp. 105-112. |
Number | Date | Country | |
---|---|---|---|
20040078186 A1 | Apr 2004 | US |