JP2009508187A - Avoiding locks by executing critical sections transactionally - Google Patents

Avoiding locks by executing critical sections transactionally Download PDF

Info

Publication number
JP2009508187A
JP2009508187A JP2008524994A JP2008524994A JP2009508187A JP 2009508187 A JP2009508187 A JP 2009508187A JP 2008524994 A JP2008524994 A JP 2008524994A JP 2008524994 A JP2008524994 A JP 2008524994A JP 2009508187 A JP2009508187 A JP 2009508187A
Authority
JP
Japan
Prior art keywords
critical section
transactional execution
program
transactionally
lock
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2008524994A
Other languages
Japanese (ja)
Inventor
マーク エス. モイア,
マーク トレンブレイ,
シャイレンダー チョードリー,
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sun Microsystems Inc
Original Assignee
Sun Microsystems Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US11/195,093 external-priority patent/US7398355B1/en
Application filed by Sun Microsystems Inc filed Critical Sun Microsystems Inc
Publication of JP2009508187A publication Critical patent/JP2009508187A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • G06F9/528Mutual exclusion algorithms by using speculative mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3004Arrangements for executing specific machine instructions to perform operations on memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
    • G06F9/30087Synchronisation or serialisation instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3824Operand accessing
    • G06F9/3834Maintaining memory consistency
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3854Instruction completion, e.g. retiring, committing or graduating
    • G06F9/3858Result writeback, i.e. updating the architectural state or memory
    • G06F9/38585Result writeback, i.e. updating the architectural state or memory with result invalidation, e.g. nullification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • G06F9/467Transactional memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/52Binary to binary

Abstract

クリティカルセクションをトランザクション的に実行することでロックを回避するシステムは、以下のようにプログラムを修正する。(1)クリティカルセクションのトランザクション的実行中に、プログラムはまずクリティカルセクションに関連するロックが別の処理によって保持されているか否かを決定し、保持されている場合にはトランザクション的実行を打ち切る。(2)トランザクション的実行が別の処理からの干渉的データアクセスに遭遇することなく完了する場合には、プログラムはトランザクション的実行中に作成された変更をコミットし、クリティカルセクションの後のプログラムの通常の非トランザクション的実行を任意で再開する。(3)トランザクション的実行中に別の処理からの干渉的データアクセスに遭遇する場合には、プログラムはトランザクション的実行中に作成された変更を破棄し、クリティカルセクションの再実行を試みる。A system that avoids locks by executing critical sections transactionally modifies the program as follows. (1) During transactional execution of a critical section, the program first determines whether the lock associated with the critical section is held by another process, and aborts transactional execution if held. (2) If the transactional execution completes without encountering an interfering data access from another process, the program commits the changes made during the transactional execution and the program's normal after the critical section Optionally resume non-transactional execution of. (3) If interfering data access from another process is encountered during transactional execution, the program discards the changes made during transactional execution and attempts to re-execute the critical section.

Description

本発明は、コンピュータシステム内の性能を向上させるための技術に関する。より具体的には、本発明は、コードのクリティカルセクションをトランザクション的に(transactionally)実行することによって、ロックの使用に伴うオーバーヘッドを回避するための方法および装置に関する。   The present invention relates to a technique for improving performance in a computer system. More specifically, the present invention relates to a method and apparatus for avoiding the overhead associated with the use of locks by executing a critical section of code transactionally.

コンピュータシステム設計者は、現在、チップマルチプロセッサ(CMP)の最新世代ならびにより従来型の共有メモリマルチプロセッサ(SMP)の中のマルチスレッディングをサポートする機構を開発している。適切なハードウェアサポートにより、マルチスレッディングは、多くのアプリケーションの性能を劇的に増加させることができる。しかしながら、マイクロプロセッサの性能が増加し続けるにつれて、スレッド(処理)間の同期化に費やす時間が、実行時間全体に大きな割合を占めるようになっている。実際、マルチスレッドのアプリケーションがさらにより多くのスレッドを使用し始めるために、この同期化のオーバーヘッドがアプリケーション性能を制限する支配的な要因となる。   Computer system designers are currently developing mechanisms to support multithreading in the latest generation of chip multiprocessors (CMP) as well as more traditional shared memory multiprocessors (SMPs). With proper hardware support, multithreading can dramatically increase the performance of many applications. However, as microprocessor performance continues to increase, the time spent synchronizing between threads (processes) has become a larger percentage of the overall execution time. In fact, this synchronization overhead becomes the dominant factor limiting application performance as multi-threaded applications begin to use even more threads.

プログラマーの観点から考えると、同期化は通常、ロックを使用して達成される。ロックは、一般的に、スレッドがコードのクリティカルセクションに入る前に獲得され、そのスレッドがクリティカルセクションから出た後に解除される。別のスレッドが、同一のロックによって保護されるクリティカルセクションに入ることを望む場合には、別のスレッドは同一のロックを獲得しなければならない。そのロックを獲得できない場合には、先行するスレッドがロックを入手しているため、そのスレッドは、先行スレッドがロックを解除するまで待機しなければならない(ロックは、原子動作またはセマフォなどの多数の方法で実装され得ることに留意する)。   From the programmer's point of view, synchronization is usually achieved using locks. Locks are generally acquired before a thread enters the critical section of code and are released after the thread exits the critical section. If another thread wants to enter a critical section protected by the same lock, the other thread must acquire the same lock. If the lock cannot be acquired, the preceding thread has acquired the lock, and the thread must wait until the preceding thread releases the lock (the lock can be a number of operations such as atomic operations or semaphores). Note that it can be implemented in a manner).

残念ながら、ロックを獲得する処理およびロックを解除する処理は、現代のマイクロプロセッサでは多大の時間を必要とする。それらは、一般的にロードバッファおよびストアバッファをフラッシュする原子動作を伴い、その結果として、何千とまではいかなくとも何百ものプロセッササイクルを完了させる必要がある。   Unfortunately, the process of acquiring and unlocking locks requires a significant amount of time in modern microprocessors. They generally involve atomic operations that flush the load and store buffers, resulting in the need to complete hundreds, if not thousands, of processor cycles.

さらに、マルチスレッドのアプリケーションはより多くのスレッドを使用するために、より多くのロックが必要となる。例えば、多数のスレッドが共有データ構造にアクセスする必要がある場合には、全データ構造に単一のロックを使用することは、性能的な理由により実用的ではない。代わりに、データ構造の小部分をロックするために多数の細粒度ロックを使用することが好ましい。これにより、多数のスレッドがデータ構造の異なる部分で並行して操作することができる。しかしながら、データ構造の異なる部分にアクセスするために、単一のスレッドが多数のロックを獲得および解除することも必要になる。それはまた、デッドロック回避などの重要なソフトウェア工学上の懸案事項をもたらす。   In addition, multi-threaded applications require more locks in order to use more threads. For example, if a large number of threads need to access a shared data structure, using a single lock for all data structures is impractical for performance reasons. Instead, it is preferable to use multiple fine-grained locks to lock a small portion of the data structure. This allows many threads to operate in parallel on different parts of the data structure. However, a single thread also needs to acquire and release multiple locks to access different parts of the data structure. It also brings important software engineering concerns such as deadlock avoidance.

一部の場合には、ロックが必要でない時にもロックが使用される。例えば、アプリケーションの多くは「スレッドセーフ」なライブラリルーチンを活用し、それはロックを使用して、マルチスレッドのアプリケーションに対して「スレッドセーフ」であることを確実にする。残念ながら、スレッドセーフなライブラリルーチンが単一スレッドのアプリケーションによってコールされる場合であっても、これらのロックを獲得および解除する際に伴うオーバーヘッドが依然として発生する。   In some cases, locks are used even when locks are not needed. For example, many applications make use of “thread-safe” library routines, which use locks to ensure that they are “thread-safe” for multi-threaded applications. Unfortunately, even when thread-safe library routines are called by single-threaded applications, the overhead associated with acquiring and releasing these locks still occurs.

アプリケーションは、一般的に、コードのクリティカルセクション内の相互排他を確実にするためにロックを使用する。しかしながら、多くの場合、クリティカルセクションを同時に実行可能な場合にも、スレッドは相互に干渉しない。これらの場合において、相互排他は、スレッドが実際に相互に干渉するというあり得ないケースを阻止するために使用される。したがって、これらの場合には、ロックを獲得および解除する際に伴うオーバーヘッドは、その多くが無駄になる。   Applications typically use locks to ensure mutual exclusion within critical sections of code. However, in many cases, threads do not interfere with each other even when critical sections can be executed simultaneously. In these cases, mutual exclusion is used to prevent the unlikely case that threads actually interfere with each other. Therefore, in these cases, much of the overhead associated with acquiring and releasing locks is wasted.

したがって、クリティカルセクションにアクセスするときのロック操作に伴うオーバーヘッドを軽減する方法および装置が必要とされている。   Therefore, there is a need for a method and apparatus that reduces the overhead associated with locking operations when accessing critical sections.

本発明の一実施形態は、トランザクション的にクリティカルセクションを実行することによってロックを回避するシステムを提供する。操作中、システムは、ロックによって保護される一つ以上のクリティカルセクションを含むプログラムを受信する。次いで、システムは、クリティカルセクションと関連するロックを獲得することなく、ロックによって保護されるクリティカルセクションがトランザクション的に実行されるように、プログラムを修正する。   One embodiment of the present invention provides a system that avoids locks by executing a critical section transactionally. During operation, the system receives a program that includes one or more critical sections that are protected by locks. The system then modifies the program so that the critical section protected by the lock is executed transactionally without acquiring the lock associated with the critical section.

より具体的には、プログラムは以下のように修正される。すなわち、(1)クリティカルセクションのトランザクション的実行中に、プログラムはまず、クリティカルセクションと関連するロックが別の処理によって保持されているか否かを決定し、保持されている場合には、トランザクション的実行を打ち切る。(2)クリティカルセクションのトランザクション的実行が、別の処理からの干渉的データアクセスに遭遇することなく完了する場合には、プログラムはトランザクション的実行中に作成された変更をコミットし、クリティカルセクションの後のプログラムの通常の非トランザクション的実行を(任意で)再開する(システムは、多数の小さいトランザクションを大きいトランザクションに統合することも可能であり、その場合には、システムは、小さいトランザクションに関連するクリティカルセクションの後の、非トランザクション的実行を即時再開しなくてもよいことに、留意する)。(3)クリティカルセクションのトランザクション的実行中に、別の処理からの干渉的データアクセスに遭遇する場合には、プログラムはトランザクション的実行中に作成された変更を破棄し、クリティカルセクションの再実行をゼロ以上の回数試みる。   More specifically, the program is modified as follows. (1) During transactional execution of a critical section, the program first determines whether the lock associated with the critical section is held by another process, and if so, is executed transactionally. Abort. (2) If the transactional execution of the critical section completes without encountering interfering data access from another process, the program commits the changes made during the transactional execution and follows the critical section. (Optionally) resuming normal non-transactional execution of the program (the system can also consolidate many small transactions into large transactions, in which case the system Note that non-transactional execution after the section need not be resumed immediately). (3) During transactional execution of a critical section, if an interfering data access from another process is encountered, the program discards the changes made during transactional execution and zeros the critical section re-execution. Try more times.

トランザクション中にロック状態を確認するステップ(上記ステップ(1))によって、クリティカルセクションを非トランザクション的に実行する前に、ロックを実際に獲得するその他の処理と共に、トランザクションの正常な機能が可能となることに留意する。これは、場合により性能が低下する恐れのある全体的な適用ではなく、有用と考えられる場合に技術を選択的に適用可能とすることから有利である。   The step of checking the lock state during a transaction (step (1) above) allows the normal functioning of the transaction, along with other processing that actually acquires the lock before executing the critical section non-transactionally. Note that. This is advantageous because it allows the technology to be selectively applied when deemed useful, rather than an overall application where performance may be degraded in some cases.

また、コード修正処理は手動で実行され得ることに留意する。例えば、プログラマーは、頻繁に使用されるクリティカルセクションを特定し得、対応するロック獲得およびロック解除のコールを、ロックを獲得しないでクリティカルセクションがトランザクション的に実行されるようにする特別なコールと手動で置き換え得る。   Note also that the code modification process can be performed manually. For example, programmers can identify frequently used critical sections, and make corresponding lock acquisition and unlock calls special calls and manuals that allow critical sections to be executed transactionally without acquiring locks. Can be replaced with

本実施形態の変形例において、プログラムを修正するステップは、プログラムを修正するためにコンパイラを使用するステップ、プログラムを修正するためにバイナリ修正ツールを使用するステップ、またはプログラムによってアクセスされるライブラリを置き換えるステップ、を含み得る。   In a variation of this embodiment, the step of modifying the program replaces the step of using a compiler to modify the program, the step of using a binary modification tool to modify the program, or a library accessed by the program. Steps.

本実施形態の変形例において、クリティカルセクションのトランザクション的実行中に、他の処理からのデータアクセスを進めることが許容される。   In the modification of this embodiment, it is allowed to proceed with data access from other processes during the transactional execution of the critical section.

本実施形態の変形例において、クリティカルセクションを再実行するように試みるステップは、クリティカルセクションをトランザクション的に再実行するように試みるステップを含む。   In a variation of this embodiment, attempting to re-execute the critical section includes attempting to re-execute the critical section transactionally.

本実施形態の変形例において、トランザクション的実行の一つ以上の試みの後にクリティカルセクションが成功裡に完了しない場合には、プログラムがクリティカルセクションと関連するロックを獲得し、クリティカルセクションを非トランザクション的に実行し、クリティカルセクションに関連するロックを解除するように、プログラムは修正される。   In a variation of this embodiment, if the critical section does not complete successfully after one or more attempts of transactional execution, the program acquires a lock associated with the critical section and makes the critical section non-transactional. The program is modified to execute and release the lock associated with the critical section.

本実施形態の変形例において、干渉的データアクセスは、トランザクション的実行中にロードされた場所への別の処理によるストア、トランザクション的実行中にストアされた場所への別の処理によるロード、またはトランザクション的実行中にストアされた場所への別の処理によるストア、を含み得る。   In a variation of this embodiment, the interfering data access can be stored by another process to a location loaded during transactional execution, loaded by another process to a location loaded during transactional execution, or transaction A store by another process to a location stored during a typical execution.

本実施形態の変形例において、クリティカルセクションのトランザクション的実行を開始するステップは、レジスタ値およびその他の状態情報をチェックポイントするためのチェックポインティング操作を実行するステップを含む。   In a variation of this embodiment, initiating transactional execution of the critical section includes performing a checkpointing operation to checkpoint register values and other state information.

以下の説明は、任意の当業者が本発明を作製および使用可能なように提示され、特定の用途およびその要件に照らして提供される。開示される実施形態へのさまざまな修正が当業者には容易に明白であり、本明細書に規定される一般的原理は、本発明の精神および範囲を逸脱することなくその他の実施形態および用途に適用され得る。したがって、本発明は、示される実施形態に限定されることを意図せず、本明細書で開示される原理および特徴と一致する最広義の範囲が与えられるべきである。   The following description is presented to enable any person skilled in the art to make and use the invention and is provided in the context of a particular application and its requirements. Various modifications to the disclosed embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be used in other embodiments and applications without departing from the spirit and scope of the invention. Can be applied to. Accordingly, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.

本詳細説明に記載されるデータ構造およびコードは、一般的に、コンピュータ読み取り可能な記憶媒体に保存され、それは、コンピュータシステムが使用するコードおよび/またはデータを保存可能な、任意のデバイスまたは媒体であり得る。これは、ディスクドライブ、磁気テープ、CD(コンパクトディスク)、およびDVD(デジタル多用途ディスクまたはデジタルビデオディスク)などの磁気および光学式記憶デバイス、ならびに伝送媒体において具現化されるコンピュータ命令信号(信号が変調される搬送波の有無に関わらず)を含むが、それだけに限定されない。例えば、伝送媒体はインターネットなどの通信ネットワークを含み得る。   The data structures and codes described in this detailed description are generally stored on a computer-readable storage medium, which can be any device or medium capable of storing code and / or data used by a computer system. possible. This includes computer instruction signals (signals) embodied in magnetic and optical storage devices such as disk drives, magnetic tape, CDs (compact discs), and DVDs (digital versatile discs or digital video discs), and transmission media. Including but not limited to a carrier to be modulated). For example, the transmission medium may include a communication network such as the Internet.

(コンピュータシステム)
図1は、本発明の実施形態に従ったコンピュータシステム100を示す。コンピュータシステム100は、通常、任意の種類のコンピュータシステムをも含み得、マイクロプロセッサベースのコンピュータシステム、メインフレームコンピュータ、デジタルシグナルプロセッサ、携帯型コンピュータデバイス、個人用整理手帳、デバイスコントローラ、および電気製品の計算エンジンを含むが、それだけに限定されない。図1に示されるように、コンピュータシステム100は、プロセッサ101およびメインメモリ(図示せず)に接続されるレベル2(L2)キャッシュ120を含む。プロセッサ102は、構造がプロセッサ101と同様であるために、プロセッサ101のみが以下に説明される。
(Computer system)
FIG. 1 illustrates a computer system 100 according to an embodiment of the present invention. Computer system 100 may typically include any type of computer system, including a microprocessor-based computer system, a mainframe computer, a digital signal processor, a portable computing device, a personal organizer, a device controller, and an appliance. Including but not limited to the calculation engine. As shown in FIG. 1, the computer system 100 includes a level 2 (L2) cache 120 connected to a processor 101 and main memory (not shown). Since the processor 102 is similar in structure to the processor 101, only the processor 101 will be described below.

プロセッサ101は、二つのレジスタファイル103および104を有し、そのうちの一つは、「アクティブレジスタファイル」であり、他方は、バックアップ「シャドウレジスタファイル」である。本発明の一実施形態において、プロセッサ101は、レジスタファイル103からレジスタファイル104への全ての値を即時にコピーするフラッシュコピー操作を提供する。これは、急速なレジスタのチェックポインティング操作を助長し、トランザクション的実行をサポートする。   The processor 101 has two register files 103 and 104, one of which is an “active register file” and the other is a backup “shadow register file”. In one embodiment of the present invention, processor 101 provides a flash copy operation that immediately copies all values from register file 103 to register file 104. This facilitates rapid register checkpointing operations and supports transactional execution.

また、プロセッサ101は、加算器107および乗算器108などのような、一つ以上の機能ユニットをも含む。これらの機能ユニットは、レジスタファイル103または104から取り出されるオペランドを伴うコンピュータ操作を実行する際に使用される。従来のプロセッサのように、ロードおよびストア操作は、ロードバッファ111およびストアバッファ112を通過する。   The processor 101 also includes one or more functional units, such as an adder 107 and a multiplier 108. These functional units are used in performing computer operations with operands retrieved from register file 103 or 104. Like conventional processors, load and store operations pass through load buffer 111 and store buffer 112.

さらに、プロセッサ101は、レベル1(Ll)データキャッシュ115を含み、プロセッサ101によって使用される可能性の高いデータ項目を保存する。Llデータキャッシュ115におけるラインは、トランザクション的実行中にラインからデータ値がロードされたことを示す、ロードマーキングビット116を含むことに留意する。このロードマーキングビット116は、図3〜図8を参照して以下に説明されるように、トランザクション的実行中に任意の干渉メモリ参照が発生するか否かを決定するために使用される。また、プロセッサ101は、Ll命令キャッシュ(図示せず)をも含む。   In addition, the processor 101 includes a level 1 (Ll) data cache 115 that stores data items that are likely to be used by the processor 101. Note that the line in the Ll data cache 115 includes a load marking bit 116 that indicates that a data value was loaded from the line during transactional execution. This load marking bit 116 is used to determine whether any interfering memory references occur during transactional execution, as will be described below with reference to FIGS. The processor 101 also includes an Ll instruction cache (not shown).

ロードマーキングは、必ずしもLlデータキャッシュ115で発生する必要がないことに留意する。通常、ロードマーキングは、L2キャッシュ120などの任意のレベルのキャッシュでも、または独立した構造においてさえも発生可能である。しかしながら、性能上の理由により、ロードマーキングはプロセッサにできるだけ近いキャッシュレベルで発生する可能性が高く、それは、この場合にはLlデータキャッシュ115である。そうでない場合には、ロードは、Llヒット上であってもL2キャッシュ120に向かわなくてはならない。   Note that load marking does not necessarily have to occur in the Ll data cache 115. Typically, load marking can occur at any level of cache, such as L2 cache 120, or even in an independent structure. However, for performance reasons, load marking is likely to occur at a cache level as close as possible to the processor, which in this case is the Ll data cache 115. Otherwise, the load must go to the L2 cache 120 even on an L1 hit.

L2キャッシュ120は、プロセッサ101において、Llデータキャッシュ115(および対応するLl命令キャッシュ)と連携して動作し、プロセッサ102において、Llデータキャッシュ117(および対応するLl命令キャッシュ)と連携して動作する。L2キャッシュ120は、発明者Shailender ChaudhryおよびMarc Tremblay(公開番号US−2002−0199066−A1)によって2002年6月26日に出願された、名称が「Method and Apparatus for Facilitating Speculative Loads in a Multiprocessor System」である米国特許出願第10/186,118号に記載される逆ディレクトリ構造などの、コヒーレンス機構122と関連していることに留意する。このコヒーレンス機構122は、キャッシュライン毎に「コピーバック情報」121を保持する。このコピーバック情報121は、キャッシュラインを別のプロセッサに送信しなければならない場合に、L2キャッシュ120から要求するプロセッサへのキャッシュラインの送信を助長する。   The L2 cache 120 operates in cooperation with the Ll data cache 115 (and corresponding Ll instruction cache) in the processor 101, and operates in cooperation with the Ll data cache 117 (and corresponding Ll instruction cache) in the processor 102. . The L2 cache 120 was filed on June 26, 2002 by the inventors Shaylender Chaudhry and Mark Trembray (publication number US-2002-0199066-A1). Note that it is associated with a coherence mechanism 122, such as the inverted directory structure described in US patent application Ser. No. 10 / 186,118. The coherence mechanism 122 holds “copy back information” 121 for each cache line. This copyback information 121 facilitates transmission of the cache line from the L2 cache 120 to the requesting processor when the cache line must be transmitted to another processor.

L2キャッシュ120における各ラインは「ストアマーキングビット」を含み、それは、トランザクション的実行中にデータ値がラインに保存されたことを示す。このストアマーキングビットは、図3〜図8を参照して以下に説明されるように、トランザクション的実行中に干渉メモリ参照が発生するか否かを決定するために使用される。ストアマーキングは、必ずしもL2キャッシュ120で発生する必要がないことに留意する。   Each line in the L2 cache 120 includes a “store marking bit”, which indicates that a data value was stored in the line during transactional execution. This store marking bit is used to determine whether an interfering memory reference occurs during transactional execution, as described below with reference to FIGS. Note that store marking does not necessarily have to occur in the L2 cache 120.

理想的には、ストアマーキングは、キャッシュラインがコヒーレントであるプロセッサに最も近いキャッシュレベルにおいて発生する。ライトスルーLlデータキャッシュについては、書き込みはL2キャッシュ120に自動的に伝播する。しかしながら、Llデータキャッシュがライトバックキャッシュである場合には、ストアマーキングはLlデータキャッシュで実行される(キャッシュコヒーレンスプロトコルにより、同一のキャッシュラインを後に修正する任意の他のプロセッサが、L1キャッシュからキャッシュラインを取り出し、ストアマークを認識することとなることに留意する)。   Ideally, store marking occurs at the cache level closest to the processor where the cache line is coherent. For the write-through Ll data cache, writes are automatically propagated to the L2 cache 120. However, if the Ll data cache is a write-back cache, store marking is performed on the Ll data cache (any other processor that later modifies the same cache line by the cache coherence protocol can be cached from the L1 cache. Note that the line will be taken out and the store mark will be recognized).

(クリティカルセクションの実行)
図2Aは、本発明の実施形態に従って、如何にクリティカルセクションが実行されるかを示す。図2Aの左側で示されるように、クリティカルセクションを実行するスレッドは、一般的に、クリティカルセクションに入る前に、クリティカルセクションと関連するロックを獲得する。別のスレッドがロックを獲得している場合には、スレッドは、他方のスレッドがロックを解除するまで待機しなければならない。クリティカルセクションを出ると、スレッドはロックを解除する(用語の「スレッド」および「処理」は、本明細書においては互換的に使用されることに留意する)。
(Critical section execution)
FIG. 2A illustrates how a critical section is executed in accordance with an embodiment of the present invention. As shown on the left side of FIG. 2A, a thread executing a critical section generally acquires a lock associated with the critical section before entering the critical section. If another thread has acquired the lock, the thread must wait until the other thread releases the lock. Upon exiting the critical section, the thread releases the lock (note that the terms “thread” and “processing” are used interchangeably herein).

ロックは共有データ構造と関連付けられ得る。例えば、共有データ構造にアクセスする前に、スレッドは共有データ構造上でロックを獲得し得る。次に、スレッドは、共有データ構造にアクセスするコードのクリティカルセクションを実行し得る。スレッドが共有データ構造へのアクセスを完了すると、スレッドはロックを解除する。   Locks can be associated with shared data structures. For example, before accessing a shared data structure, a thread may acquire a lock on the shared data structure. The thread may then execute a critical section of code that accesses the shared data structure. When the thread completes access to the shared data structure, the thread releases the lock.

対照的に、本発明においては、スレッドはロックを獲得せず、その代わりに、クリティカルセクションに入る前に、開始トランザクション的実行(STE)命令を実行する。他のスレッドから干渉されずにクリティカルセクションが成功裡に完了する場合には、スレッドはコミット操作を実行して、トランザクション実行中に作成された変更をコミットする。この一連の事象は、図3〜図8を参照して以下にさらに詳しく説明する。   In contrast, in the present invention, a thread does not acquire a lock, but instead executes a start transactional execution (STE) instruction before entering a critical section. If the critical section completes successfully without interference from other threads, the thread performs a commit operation to commit the changes made during the transaction execution. This series of events will be described in more detail below with reference to FIGS.

本発明の一実施形態において、コンパイラは、ロック獲得命令をSTE命令と置き換え、また、対応するロック解除命令をコミット命令と置き換えることに留意する。置き換えられた命令の間に一対一の対応がなくてもよいことに留意する。例えば、複数の命令から成る単一のロック獲得操作は、単一のSTE命令によって置き換えられ得る。   Note that in one embodiment of the invention, the compiler replaces the lock acquisition instruction with an STE instruction and the corresponding unlock instruction with a commit instruction. Note that there may not be a one-to-one correspondence between replaced instructions. For example, a single lock acquisition operation consisting of multiple instructions can be replaced by a single STE instruction.

何らかの理由により進行できない場合には、多くの場合、ロックに頼る能力を保持することを必要とすることに留意する。また、ソフトウェア工学の観点から、共通パスのみにおいてコードを変換し、非共有パスにおいてロックコードをそのままの状態にしておくことが、しばしば望まれる。これを助長するために、トランザクション的実行のためにクリティカルセクションを変換する際に、ロック獲得はSTE命令で置き換えられ得、その後に、ロック状態をトランザクション的に読み取りかつロックが保持されていないことを確認するコードが続く(図2B参照)。   Note that if for some reason it is not possible to proceed, it is often necessary to retain the ability to rely on locks. Also, from the viewpoint of software engineering, it is often desirable to convert the code only in the common path and leave the lock code as it is in the non-shared path. To facilitate this, when converting a critical section for transactional execution, lock acquisition can be replaced with an STE instruction, after which the lock state is read transactionally and the lock is not held. The code to confirm follows (see FIG. 2B).

上記の説明は、プロセッサの命令セットが、STE命令およびコミット命令を含むように拡大されたことを想定する。これらの命令は、図3〜図9を参照して以下により詳しく記載される。   The above description assumes that the processor instruction set has been expanded to include STE and commit instructions. These instructions are described in more detail below with reference to FIGS.

(トランザクション的実行処理)
図3は、本発明の実施形態に従って、如何にトランザクション的実行が発生するかを示すフローチャートである。スレッドは、まず、コードのクリティカルセクションに入る前にSTE命令を実行する(ステップ302)。次に、システムは、クリティカルセクション内でコードをトランザクション的に実行するが、トランザクション的実行の結果をコミットしない(ステップ304)。
(Transactional execution processing)
FIG. 3 is a flowchart illustrating how transactional execution occurs in accordance with an embodiment of the present invention. The thread first executes the STE instruction before entering the critical section of code (step 302). The system then executes the code transactionally within the critical section, but does not commit the result of the transactional execution (step 304).

クリティカルセクションのトランザクション的実行の開始時に、プログラムは、クリティカルセクションと関連するロック状態をトランザクション的に読み取り、ロックが保持されていないことを確認する。ロックが保持されている場合には、システムは、トランザクション的実行を打ち切る(ステップ303)。クリティカルセクションのトランザクション的実行中に別の処理がロックを獲得している場合には、ロック状態のトランザクション的な読み取りがロック獲得操作によって「干渉される」ために、クリティカルセクションのトランザクション的実行は打ち切られることに留意する。   At the beginning of the transactional execution of the critical section, the program reads the lock state associated with the critical section transactionally to ensure that no lock is held. If the lock is held, the system aborts transactional execution (step 303). If another process has acquired the lock during the critical section transactional execution, the transactional execution of the critical section is aborted because the transactional read of the lock state is “interfered” by the lock acquisition operation. Keep in mind that

このトランザクション的実行中、システムは、その他のスレッドによるデータ参照を継続的に監視し、干渉的データアクセス(またはその他の種類の障害)がトランザクション的実行中に発生するか否かを決定する。発生しない場合には、システムはトランザクション的実行中に作成された全ての変更を自動的にコミットし(ステップ308)、次に、クリティカルセクションの後のプログラムの通常の非トランザクション的実行を任意で再開する(ステップ310)。   During this transactional execution, the system continuously monitors data references by other threads to determine whether interfering data accesses (or other types of failures) occur during transactional execution. If not, the system automatically commits all changes made during transactional execution (step 308) and then optionally resumes normal non-transactional execution of the program after the critical section. (Step 310).

反対に、干渉的データアクセスが検知される場合には、システムはトランザクション的実行中に作成された変更を破棄し(ステップ312)、クリティカルセクションの再実行を試みる(ステップ314)。   Conversely, if interfering data access is detected, the system discards changes made during transactional execution (step 312) and attempts to re-execute the critical section (step 314).

本発明の一実施形態において、システムは、ゼロ回、一回、二回、またはそれ以上に、クリティカルセクションをトランザクション的に再実行することを試みる。これらの試みが成功しない場合には、システムは、通常の実行モードで代替のコードブロックを実行する。この代替のコードは、トランザクションの実行を付加的に試み得、かつ、クリティカルセクションに入る前にクリティカルセクションのロックを獲得しクリティカルセクションを出た後にロックを解除する、従来の技術に戻る能力を有し得る。   In one embodiment of the invention, the system attempts to re-execute the critical section transactionally zero times, once, twice, or more. If these attempts are not successful, the system executes the alternate code block in normal execution mode. This alternative code can make additional attempts to execute the transaction and has the ability to revert to conventional techniques to acquire a critical section lock before entering the critical section and release the lock after leaving the critical section. Can do.

干渉的データアクセスは、スレッドによってロードマークされたキャッシュラインへの、別のスレッドによるストアを含み得ることに留意する。それはまた、スレッドによってストアマークされたキャッシュラインへの、別のスレッドによるロードまたはストアをも含み得る。   Note that an interfering data access may include a store by another thread to a cache line that has been load-marked by the thread. It may also include a load or store by another thread to a cache line that is store-marked by the thread.

また、干渉的データアクセスを検知する回路網が、従来のキャッシュコヒーレンス回路網を若干修正することによって容易に実装され得ることに、留意する。この従来のキャッシュコヒーレンス回路網は、現在は、所与のキャッシュラインが別のプロセッサにアクセスされたか否かを示す信号を生成する。したがって、これらの信号が、干渉的データアクセスが発生したか否かを決定するために使用され得る。   It is also noted that circuitry that detects interfering data accesses can be easily implemented by slightly modifying the conventional cache coherence circuitry. This conventional cache coherence network currently generates a signal that indicates whether a given cache line has been accessed by another processor. Thus, these signals can be used to determine whether an interfering data access has occurred.

(トランザクション的実行の開始)
図4は、本発明の実施形態に従った、開始トランザクション的実行(STE)操作を示すフローチャートである。本フローチャートは、図3のフローチャートのステップ302の中で何が発生するかを示す。システムは、レジスタファイルをチェックポイントすることによって開始する(ステップ402)。これは、レジスタファイル103からレジスタファイル104へのフラッシュコピー操作を実行することを含む(図1参照)。レジスタ値をチェックポイントすることに加えて、このフラッシュコピーは、実行中のスレッドに関連するさまざまな状態のレジスタをもチェックポイントし得る。通常、フラッシュコピー操作は、対応するスレッドを再開することができる状態にまでチェックポイントする。
(Start transactional execution)
FIG. 4 is a flowchart illustrating a start transactional execution (STE) operation according to an embodiment of the present invention. This flowchart shows what happens in step 302 of the flowchart of FIG. The system begins by checkpointing the register file (step 402). This includes performing a flash copy operation from the register file 103 to the register file 104 (see FIG. 1). In addition to checkpointing register values, this flash copy may also checkpoint various state registers associated with the executing thread. Normally, a flash copy operation checkpoints to a state where the corresponding thread can be resumed.

同時に、レジスタファイルがチェックポイントされ、また、STE操作が、ストアバッファ112を「ゲート」状態にさせる(ステップ404)。これにより、ストアバッファにおける既存の入力が、メモリサブシステムに伝播可能となる(したがって、プロセッサのアーキテクチャ状態にコミットされる)が、しかし、トランザクション的実行中に生成される新しいストアバッファの入力がそのように伝播されることは阻止される。   At the same time, the register file is checkpointed and the STE operation causes the store buffer 112 to be in a “gate” state (step 404). This allows existing input in the store buffer to be propagated to the memory subsystem (and therefore committed to the processor architectural state), but new store buffer input generated during transactional execution Propagation is prevented.

次いで、システムは、キャッシュラインのロードマーキングおよびストアマーキングを含むトランザクション的実行を開始し(ステップ406)、必要な場合には、干渉的参照を検知するためにデータ参照を監視する。   The system then initiates transactional execution including cache line load marking and store marking (step 406) and monitors data references to detect interfering references, if necessary.

(ロードマーキング処理)
図5は、本発明の実施形態に従ったトランザクション的実行中に、如何にロードマーキングが実行されるかを示すフローチャートである。クリティカルセクションのトランザクション的実行中に、システムはロード操作を実行する。このロード操作の実行に際して、ロード操作がロードマークする必要のあるロード操作として特定された場合には、システムは、まず、Llデータキャッシュ115からデータ項目のロードを試みる(ステップ502)。ロードによりキャッシュヒットが発生する場合には、システムは、Llデータキャッシュ115における対応するキャッシュラインを「ロードマーク」する(ステップ506)。これは、キャッシュラインに対するロードマーキングビットの設定を含む。あるいは、ロードによりキャッシュミスが発生する場合には、システムは、さらなるレベルの記憶階層からキャッシュラインを取り出し(ステップ508)、ステップ506に進んで、Llデータキャッシュ115におけるキャッシュラインをロードマークする。
(Road marking process)
FIG. 5 is a flowchart illustrating how load marking is performed during transactional execution in accordance with an embodiment of the present invention. During the transactional execution of a critical section, the system performs a load operation. When performing this load operation, if the load operation is identified as a load operation that needs to be load marked, the system first attempts to load a data item from the Ll data cache 115 (step 502). If a cache hit occurs due to the load, the system “load marks” the corresponding cache line in the Ll data cache 115 (step 506). This includes setting the load marking bit for the cache line. Alternatively, if the load causes a cache miss, the system retrieves the cache line from the further level of storage hierarchy (step 508) and proceeds to step 506 to load mark the cache line in the Ll data cache 115.

(ストアマーキング処理)
図6は、本発明の実施形態に従ったトランザクション的実行中に、如何にストアマーキングが実行されるかを示すフローチャートである。クリティカルセクションのトランザクション的実行中に、システムはストア操作を実行する。このストア操作がストアマークする必要のあるストア操作として特定された場合には、システムは先ず、専用の対応するキャッシュラインをプリフェッチする(ステップ602)。ラインが既にキャッシュに位置し、既に専用状態にある場合には、このプリフェッチ操作は何も行なわないことに留意する。
(Store marking process)
FIG. 6 is a flowchart illustrating how store marking is performed during transactional execution according to an embodiment of the present invention. During transactional execution of critical sections, the system performs store operations. If this store operation is identified as a store operation that needs to be store marked, the system first prefetches a dedicated corresponding cache line (step 602). Note that this prefetch operation does nothing if the line is already in the cache and already in a dedicated state.

本実施例において、Llデータキャッシュ115はライトスルーキャッシュであり、ストア操作はLlデータキャッシュ115からL2キャッシュ120に伝播する。次に、システムは、L2データキャッシュ115におけるストア操作に対応するキャッシュラインのロックを試みる(ステップ604)。対応するラインがL2キャッシュ120にある場合(キャッシュヒット)には、システムは、L2キャッシュ120の中のその対応するキャッシュラインを「ストアマーク」する(ステップ610)。これは、キャッシュラインに対するストアマーキングビットの設定を含む。あるいは、対応するラインがL2キャッシュ120にない場合(キャッシュミス)には、システムは、さらなるレベルの記憶階層からキャッシュラインを取り出し(ステップ608)、次にステップ610に進んで、L2キャッシュ120におけるキャッシュラインをストアマークする。   In this embodiment, the Ll data cache 115 is a write-through cache, and the store operation is propagated from the Ll data cache 115 to the L2 cache 120. Next, the system attempts to lock the cache line corresponding to the store operation in the L2 data cache 115 (step 604). If the corresponding line is in the L2 cache 120 (cache hit), the system “store marks” that corresponding cache line in the L2 cache 120 (step 610). This includes setting the store marking bit for the cache line. Alternatively, if the corresponding line is not in the L2 cache 120 (cache miss), the system retrieves the cache line from the further level storage hierarchy (step 608) and then proceeds to step 610 to cache in the L2 cache 120. Store mark the line.

次いで、ステップ610でキャッシュラインがストアマークされると、システムは、ストアバッファ112の入力にストアデータを入力する(ステップ612)。このストアデータは、後続のコミット操作が発生するまで、またはトランザクション的実行中の変更が破棄されるまで、ストアバッファ112に留まることに留意する。   Next, when the cache line is store-marked in step 610, the system inputs store data to the input of the store buffer 112 (step 612). Note that this store data remains in the store buffer 112 until a subsequent commit operation occurs or until the transactionally executing change is discarded.

所与のスレッドによってストアマークされるキャッシュラインは、その他のスレッドによって読み取られ得ることに留意する。これにより、所与のスレッドが失敗し、その一方で他のスレッドが継続し得ることに、留意する。   Note that cache lines that are storemarked by a given thread can be read by other threads. Note that this may cause a given thread to fail while other threads can continue.

(コミット操作)
図7は、本発明の実施形態に従って、トランザクション的実行が成功裡に完了した後に、如何にコミット操作が実行されるかを示すフローチャートである。本フローチャートは、図3のフローチャートのステップ308の中で何が発生するかを示す。
(Commit operation)
FIG. 7 is a flowchart illustrating how a commit operation is performed after a transactional execution has been successfully completed in accordance with an embodiment of the present invention. This flowchart shows what happens in step 308 of the flowchart of FIG.

システムは、ストアマークされたキャッシュラインを、ロックされたもののように処理することによって開始する(ステップ702)。これは、ストアマークされたラインを要求するその他のスレッドが、ラインがロックされなくなるまで待機してから、ラインにアクセス可能になることを意味する。これは、従来のキャッシュでラインがロックされる方法に類似している。   The system begins by processing store-marked cache lines as if they were locked (step 702). This means that other threads requesting the store-marked line will wait until the line is no longer locked before it can access the line. This is similar to the way lines are locked in a conventional cache.

次いで、システムは、Llデータキャッシュ115からロードマークを消去する(ステップ704)。   The system then deletes the load mark from the Ll data cache 115 (step 704).

次に、システムは、マークする必要があると特定されるストアのために、トランザクション的実行中に生成された、ストアバッファ112からの入力を記憶階層にコミットする(ステップ706)。各入力がコミットされると、L2キャッシュ120における対応するラインはロック解除される。   Next, the system commits the input from the store buffer 112 generated during transactional execution to the storage hierarchy for the store identified as needing to be marked (step 706). As each input is committed, the corresponding line in the L2 cache 120 is unlocked.

また、システムは、レジスタファイルの変更をもコミットする(ステップ708)。例えば、これは、図1に示されたシステムにおけるレジスタファイル103とレジスタファイル104との間のフラッシュコピーを機能的に実行することを含み得る。   The system also commits register file changes (step 708). For example, this may include functionally performing a flash copy between register file 103 and register file 104 in the system shown in FIG.

(変更破棄)
図8は、本発明の実施形態に従って、トランザクション的実行が不成功に完了した後に、如何に変更が破棄されるかを示すフローチャートである。本フローチャートは、図3のフローチャートのステップ312の中で何が発生するかを示す。システムは、まず、トランザクション的実行中に作成されたレジスタファイルの変更を破棄する(ステップ802)。これは、トランザクション的実行中に作成されたレジスタファイルの変更を消去するか、または単に無視することを含み得る。これは、トランザクション的実行の開始前に古いレジスタ値がチェックポイントされているために、容易に達成される。また、システムは、Llデータキャッシュ115におけるキャッシュラインからロードマークをも消去し(ステップ804)、トランザクション的実行中に生成されたストアバッファの入力を、記憶階層にコミットせずにドレインする(ステップ806)。同時に、システムは、対応するL2キャッシュラインのマークを解除する。最後に、本発明の一実施形態において、システムはSTE命令によって特定される目標位置に分岐する(ステップ808)。本目標位置においてコードは、クリティカルセクションの再実行を任意で試みる(図1のステップ314を参照して上述されたように)か、または、コンテンション軽減のためのバックオフなどの、障害に応じたその他のアクションを取る。
(Discard changes)
FIG. 8 is a flowchart illustrating how changes are discarded after a transactional execution has been unsuccessfully completed in accordance with an embodiment of the present invention. This flowchart shows what happens in step 312 of the flowchart of FIG. The system first discards the register file changes created during transactional execution (step 802). This may include erasing or simply ignoring register file changes made during transactional execution. This is easily accomplished because the old register values are checkpointed before the start of transactional execution. The system also deletes the load mark from the cache line in the Ll data cache 115 (step 804) and drains the store buffer input generated during transactional execution without committing to the storage hierarchy (step 806). ). At the same time, the system unmarks the corresponding L2 cache line. Finally, in one embodiment of the invention, the system branches to the target location specified by the STE instruction (step 808). At this target location, the code optionally attempts to re-execute the critical section (as described above with reference to step 314 in FIG. 1), or in response to a failure, such as a backoff to reduce contention. Take other actions.

本発明の実施形態の上述の説明は、図示および説明のためのみ提示されている。それらは、余すことなく述べることを意図せず、あるいは本発明を開示される形態に限定することを意図していない。したがって、多くの修正および変形が、当業者にとっては明白である。さらに、上記の開示は本発明を限定することを意図していない。本発明の範囲は、添付の特許請求の範囲によって定義される。   The foregoing descriptions of embodiments of the present invention have been presented only for purposes of illustration and description. They are not intended to be exhaustive or intended to limit the invention to the form disclosed. Accordingly, many modifications and variations will be apparent to practitioners skilled in this art. Furthermore, the above disclosure is not intended to limit the present invention. The scope of the present invention is defined by the appended claims.

図1は、本発明の実施形態に従ったコンピュータシステムを示す。FIG. 1 illustrates a computer system according to an embodiment of the present invention. 図2Aは、本発明の実施形態に従って、如何にクリティカルセクションが実行されるかを示す。FIG. 2A illustrates how a critical section is executed in accordance with an embodiment of the present invention. 図2Bは、本発明の実施形態に従って、如何にクリティカルセクションが実行されるかの別の例を示す。FIG. 2B shows another example of how a critical section is executed according to an embodiment of the present invention. 図3は、本発明の実施形態に従った、トランザクション的実行処理を示すフローチャートである。FIG. 3 is a flowchart illustrating transactional execution processing according to an embodiment of the present invention. 図4は、本発明の実施形態に従った、開始トランザクション的実行(STE)操作を示すフローチャートである。FIG. 4 is a flowchart illustrating a start transactional execution (STE) operation according to an embodiment of the present invention. 図5は、本発明の実施形態に従ったトランザクション的実行中に、如何にロードマーキングが実行されるかを示すフローチャートである。FIG. 5 is a flowchart illustrating how load marking is performed during transactional execution in accordance with an embodiment of the present invention. 図6は、本発明の実施形態に従ったトランザクション的実行中に、如何にストアマーキングが実行されるかを示すフローチャートである。FIG. 6 is a flowchart illustrating how store marking is performed during transactional execution according to an embodiment of the present invention. 図7は、本発明の実施形態に従った、如何にコミット操作が実行されるかを示すフローチャートである。FIG. 7 is a flowchart illustrating how a commit operation is performed according to an embodiment of the present invention. 図8は、本発明の実施形態に従った、トランザクション的実行が不成功に完了した後に、如何に変更が破棄されるかを示すフローチャートである。FIG. 8 is a flowchart illustrating how changes are discarded after a transactional execution has been unsuccessfully completed, in accordance with an embodiment of the present invention.

Claims (20)

クリティカルセクションをトランザクション的に実行することによってロックを回避するようにプログラムを修正するための方法であって、該方法は、
ロックによって保護される一つ以上のクリティカルセクションを含むプログラムを受信するステップと、
該クリティカルセクションと関連するロックを獲得することなく、ロックによって保護される該クリティカルセクションがトランザクション的に実行されるように、該プログラムを修正するステップと、
を包含し、
該プログラムは、
クリティカルセクションのトランザクション的実行中に、該プログラムはまず、該クリティカルセクションと関連するロックが別の処理によって保持されているか否かを決定し、保持されている場合には、該トランザクション的実行を打ち切り、
該クリティカルセクションの該トランザクション的実行が、別の処理からの干渉的データアクセスに遭遇せずに完了する場合には、該プログラムは、該トランザクション的実行中に作成された変更をコミットし、該クリティカルセクションの後の該プログラムの通常の非トランザクション的実行を任意で再開し、
該クリティカルセクションの該トランザクション的実行中に、別の処理からの干渉的データアクセスに遭遇する場合には、該プログラムは、該トランザクション的実行中に作成された変更を破棄し、該クリティカルセクションを再実行するようにゼロ以上の回数試みる、
ように修正される、
方法。
A method for modifying a program to avoid locks by executing a critical section transactionally, the method comprising:
Receiving a program including one or more critical sections protected by a lock;
Modifying the program such that the critical section protected by a lock is executed transactionally without acquiring a lock associated with the critical section;
Including
The program
During transactional execution of a critical section, the program first determines whether the lock associated with the critical section is held by another process and, if so, aborts the transactional execution. ,
If the transactional execution of the critical section completes without encountering interfering data access from another process, the program commits the changes made during the transactional execution and Optionally resume normal non-transactional execution of the program after the section;
If, during the transactional execution of the critical section, an interfering data access from another process is encountered, the program discards the changes made during the transactional execution and re-executes the critical section. Try zero or more times to run,
To be corrected,
Method.
前記プログラムを修正するステップは、
該プログラムを修正するためにコンパイラを使用するステップ、
該プログラムを修正するためにバイナリ修正ツールを使用するステップ、
または、該プログラムによってアクセスされるライブラリを置き換えるステップ、
を含む、
請求項1に記載の方法。
The step of modifying the program includes
Using a compiler to modify the program;
Using a binary modification tool to modify the program;
Or replacing a library accessed by the program;
including,
The method of claim 1.
前記クリティカルセクションの前記トランザクション的実行中に、他の処理からのデータアクセスを進めることが許容される、請求項1に記載の方法。   The method of claim 1, wherein data access from other processes is allowed to proceed during the transactional execution of the critical section. 前記クリティカルセクションを再実行するように試みるステップは、該クリティカルセクションをトランザクション的に再実行するように試みるステップを含む、請求項1に記載の方法。   The method of claim 1, wherein attempting to re-execute the critical section comprises attempting to re-execute the critical section transactionally. トランザクション的実行の一つ以上の試みの後に、前記クリティカルセクションが成功裡に完了しない場合には、前記プログラムが、
該クリティカルセクションと関連するロックを獲得し、
該クリティカルセクションを非トランザクション的に実行し、
該クリティカルセクションと関連する該ロックを解除するように、
該プログラムは修正される、
請求項4に記載の方法。
If the critical section does not complete successfully after one or more attempts of transactional execution, the program
Acquire a lock associated with the critical section;
Execute the critical section non-transactionally;
To release the lock associated with the critical section,
The program is modified,
The method of claim 4.
前記干渉的データアクセスは、
トランザクション的実行中にロードされた場所への別の処理によるストアと、
トランザクション的実行中にストアされた場所への別の処理によるロードと、
トランザクション的実行中にストアされた場所への別の処理によるストアと、
を含み得る、
請求項1に記載の方法。
The interfering data access is
A store with separate processing to the location loaded during transactional execution;
Load by another process to the location stored during transactional execution;
Store by another process to the location stored during transactional execution,
Can include,
The method of claim 1.
クリティカルセクションのトランザクション的実行を開始するステップは、レジスタ値およびその他の状態情報をチェックポイントするためのチェックポインティング操作を実行するステップを含む、請求項1に記載の方法。   The method of claim 1, wherein initiating the transactional execution of a critical section comprises performing a checkpointing operation to checkpoint register values and other state information. コードのクリティカルセクションをトランザクション的に実行することによってロックを回避するための方法であって、該方法は、
該クリティカルセクションと関連するロックを獲得することなく、プログラム内のコードのクリティカルセクションをトランザクション的に実行するための処理を許容するステップを包含し、
該クリティカルセクションをトランザクション的に実行するステップは、まず、該クリティカルセクションと関連する該ロックが別の処理に保持されているか否かを決定するステップと、保持されている場合には該トランザクション的実行を打ち切るステップと、を含み、
該処理が、別の処理からの干渉的データアクセスに遭遇せずに該クリティカルセクションを完了する場合には、該方法は、
該トランザクション的実行中に作成された変更をコミットするステップと、
該クリティカルセクションの後の、該プログラムの通常の非トランザクション的実行を任意で再開するステップと、をさらに包含し、
該クリティカルセクションのトランザクション的実行中に別の処理からの干渉的データアクセスに遭遇する場合には、該方法は、
該トランザクション実行中に作成された変更を破棄するステップと、
該クリティカルセクションをゼロ以上の回数再実行するように試みるステップと、をさらに包含する、
方法。
A method for avoiding a lock by executing a critical section of code transactionally, the method comprising:
Allowing a process to transactionally execute a critical section of code in a program without acquiring a lock associated with the critical section;
Executing the critical section transactionally includes first determining whether the lock associated with the critical section is held in another process and, if held, the transactional execution. Cutting off, and
If the process completes the critical section without encountering interfering data access from another process, the method includes:
Committing changes made during the transactional execution;
Optionally resuming normal non-transactional execution of the program after the critical section; and
When encountering interfering data access from another process during transactional execution of the critical section, the method includes:
Discarding changes made during execution of the transaction;
Further attempting to re-execute the critical section zero or more times;
Method.
請求項8に記載の方法であって、前記プログラムを実行する前に、ロックによって保護されるクリティカルセクションがトランザクション的に実行されるように、該プログラムを修正するステップをさらに包含する、方法。   9. The method of claim 8, further comprising modifying the program such that a critical section protected by a lock is executed transactionally prior to executing the program. 前記プログラムを修正するステップは、
該プログラムを修正するためにコンパイラを使用するステップ、
該プログラムを修正するためにバイナリ修正ツールを使用するステップ、
または、該プログラムによってアクセスされるライブラリを置き換えるステップ、
を含む、
請求項9に記載の方法。
The step of modifying the program includes
Using a compiler to modify the program;
Using a binary modification tool to modify the program;
Or replacing a library accessed by the program;
including,
The method of claim 9.
前記クリティカルセクションの前記トランザクション的実行中に、他の処理からのデータアクセスを進めることが許容される、請求項8に記載の方法。   9. The method of claim 8, wherein data access from other processes is allowed during the transactional execution of the critical section. 前記クリティカルセクションを再実行するように試みるステップは、該クリティカルセクションをトランザクション的に再実行するように試みるステップを含む、請求項8に記載の方法。   The method of claim 8, wherein attempting to re-execute the critical section comprises attempting to re-execute the critical section transactionally. トランザクション的実行の一つ以上の試みの後に、前記クリティカルセクションが成功裡に完了しない場合には、
該クリティカルセクションと関連するロックを獲得するステップと、
該クリティカルセクションを非トランザクション的に実行ステップと、
該クリティカルセクションと関連する該ロックを解除するステップと、
をさらに包含する、
請求項12に記載の方法。
If the critical section does not complete successfully after one or more attempts of transactional execution,
Obtaining a lock associated with the critical section;
Executing the critical section non-transactionally;
Releasing the lock associated with the critical section;
Further including,
The method of claim 12.
クリティカルセクションのトランザクション的実行を開始するステップは、レジスタ値およびその他の状態情報をチェックポイントするためのチェックポインティング操作を実行するステップを含む、請求項8に記載の方法。   9. The method of claim 8, wherein initiating transactional execution of a critical section includes performing a checkpointing operation to checkpoint register values and other state information. 前記干渉的データアクセスは、
トランザクション的実行中に前記処理がロードされた場所への別の処理によるストアと、
トランザクション的実行中に該処理がストアされた場所への別の処理によるロードと、
トランザクション的実行中に該処理がストアされた場所への別の処理によるストアと、
を含み得る、
請求項8に記載の方法。
The interfering data access is
Store by another process to where the process was loaded during transactional execution;
Loading by another process to the location where the process was stored during transactional execution;
Store by another process to where it was stored during transactional execution;
Can include,
The method of claim 8.
クリティカルセクションをトランザクション的に実行することによってロックを回避するためにプログラムを修正する装置であって、該装置は、
該クリティカルセクションと関連するロックを獲得することなく、ロックによって保護されるクリティカルセクションがトランザクション的に実行されるように、該プログラムを修正するように構成される、修正機構を備え、
該修正機構は、該プログラムを、
クリティカルセクションのトランザクション的実行中に、該プログラムは、まず、該クリティカルセクションと関連するロックが別の処理によって保持されているか否かを決定し、保持されている場合には、該トランザクション的実行を打ち切り、
該クリティカルセクションの該トランザクション的実行が、別の処理からの干渉的データアクセスに遭遇せずに完了する場合には、該プログラムは、該トランザクション的実行中に作成された変更をコミットし、該クリティカルセクションの後の該プログラムの通常の非トランザクション的実行を任意で再開し、
該クリティカルセクションのトランザクション的実行中に、別の処理からの干渉的データアクセスに遭遇する場合には、該プログラムは、該トランザクション的実行中に作成された変更を破棄し、該クリティカルセクションの再実行をゼロ以上の回数試みるように、
修正するように構成される、
装置。
An apparatus for modifying a program to avoid a lock by executing a critical section transactionally, the apparatus comprising:
A modification mechanism configured to modify the program such that a critical section protected by a lock is executed transactionally without acquiring a lock associated with the critical section;
The correction mechanism
During transactional execution of a critical section, the program first determines whether the lock associated with the critical section is held by another process and, if held, performs the transactional execution. Censored,
If the transactional execution of the critical section completes without encountering interfering data access from another process, the program commits the changes made during the transactional execution and Optionally resume normal non-transactional execution of the program after the section;
If interfering data access from another process is encountered during the transactional execution of the critical section, the program discards the changes made during the transactional execution and re-executes the critical section. To try zero or more times,
Configured to modify,
apparatus.
前記修正機構は、
コンパイラ、
バイナリ修正ツール、
または、前記プログラムによってアクセスされるライブラリを置き変える機構、
である、
請求項16に記載の装置。
The correction mechanism is:
compiler,
Binary correction tools,
Or a mechanism to replace a library accessed by the program,
Is,
The apparatus of claim 16.
前記クリティカルセクションの前記トランザクション的実行中に、他の処理からのデータアクセスを進めることが許容される、請求項16に記載の装置。   The apparatus of claim 16, wherein data access from other processes is allowed to proceed during the transactional execution of the critical section. 前記クリティカルセクションを再実行するように試みるステップは、前記クリティカルセクションをトランザクション的に再実行するように試みるステップを含む、請求項16に記載の装置。   The apparatus of claim 16, wherein attempting to re-execute the critical section comprises attempting to re-execute the critical section transactionally. トランザクション的実行の一つ以上の試みの後に、前記クリティカルセクションが成功裡に完了しない場合には、前記プログラムが、
該クリティカルセクションと関連するロックを獲得し、
該クリティカルセクションを非トランザクション的に実行し、
該クリティカルセクションと関連する該ロックを解除するように、
該プログラムは修正される、
請求項19に記載の装置。
If the critical section does not complete successfully after one or more attempts of transactional execution, the program
Acquire a lock associated with the critical section;
Execute the critical section non-transactionally;
To release the lock associated with the critical section,
The program is modified,
The apparatus of claim 19.
JP2008524994A 2005-08-01 2006-07-21 Avoiding locks by executing critical sections transactionally Pending JP2009508187A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US11/195,093 US7398355B1 (en) 2003-02-13 2005-08-01 Avoiding locks by transactionally executing critical sections
PCT/US2006/028152 WO2007015925A1 (en) 2005-08-01 2006-07-21 Avoiding locks by transactionally executing critical sections

Publications (1)

Publication Number Publication Date
JP2009508187A true JP2009508187A (en) 2009-02-26

Family

ID=37309335

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008524994A Pending JP2009508187A (en) 2005-08-01 2006-07-21 Avoiding locks by executing critical sections transactionally

Country Status (3)

Country Link
EP (1) EP1913473A1 (en)
JP (1) JP2009508187A (en)
WO (1) WO2007015925A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010244544A (en) * 2009-04-08 2010-10-28 Intel Corp Register checkpointing mechanism for multithreading
JP2013537334A (en) * 2010-09-25 2013-09-30 インテル コーポレイション Apparatus, method and system for dynamically optimizing code utilizing adjustable transaction size based on hardware limitations
JP2015523651A (en) * 2012-06-15 2015-08-13 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Method, system, and program for executing machine instructions in a computing environment (transaction start / end instructions)
JP2015526790A (en) * 2012-06-15 2015-09-10 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Saving / restoring selected registers in transaction processing
US9250980B2 (en) 2009-12-18 2016-02-02 International Business Machines Corporation System, method, program, and code generation unit
JP2017509083A (en) * 2014-03-27 2017-03-30 インテル コーポレイション Lock Elegance with Binary Transaction Based Processor

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8627014B2 (en) * 2008-12-30 2014-01-07 Intel Corporation Memory model for hardware attributes within a transactional memory system
US8682877B2 (en) 2012-06-15 2014-03-25 International Business Machines Corporation Constrained transaction execution
US8688661B2 (en) 2012-06-15 2014-04-01 International Business Machines Corporation Transactional processing
US20130339680A1 (en) 2012-06-15 2013-12-19 International Business Machines Corporation Nontransactional store instruction
US9740549B2 (en) 2012-06-15 2017-08-22 International Business Machines Corporation Facilitating transaction completion subsequent to repeated aborts of the transaction
US9384004B2 (en) 2012-06-15 2016-07-05 International Business Machines Corporation Randomized testing within transactional execution
US9772854B2 (en) 2012-06-15 2017-09-26 International Business Machines Corporation Selectively controlling instruction execution in transactional processing
US9448796B2 (en) 2012-06-15 2016-09-20 International Business Machines Corporation Restricted instructions in transactional execution
US10437602B2 (en) 2012-06-15 2019-10-08 International Business Machines Corporation Program interruption filtering in transactional execution
US9436477B2 (en) 2012-06-15 2016-09-06 International Business Machines Corporation Transaction abort instruction
CN107239415B (en) * 2016-03-28 2020-02-14 华为技术有限公司 Method and device for executing critical section operation

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040162967A1 (en) * 2003-02-13 2004-08-19 Marc Tremblay Start transactional execution (STE) instruction to support transactional program execution
WO2004075054A1 (en) * 2003-02-13 2004-09-02 Sun Microsystems Inc. Fail instruction to support transactional during program execution
US20040187123A1 (en) * 2003-02-13 2004-09-23 Marc Tremblay Selectively unmarking load-marked cache lines during transactional program execution

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040162967A1 (en) * 2003-02-13 2004-08-19 Marc Tremblay Start transactional execution (STE) instruction to support transactional program execution
WO2004075054A1 (en) * 2003-02-13 2004-09-02 Sun Microsystems Inc. Fail instruction to support transactional during program execution
US20040187123A1 (en) * 2003-02-13 2004-09-23 Marc Tremblay Selectively unmarking load-marked cache lines during transactional program execution

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN7011004294; Moir,Mark: 'Hybrid Transactional Memory' Sun Microsystems Laboratories Paper , 200507 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010244544A (en) * 2009-04-08 2010-10-28 Intel Corp Register checkpointing mechanism for multithreading
US9940138B2 (en) 2009-04-08 2018-04-10 Intel Corporation Utilization of register checkpointing mechanism with pointer swapping to resolve multithreading mis-speculations
US9250980B2 (en) 2009-12-18 2016-02-02 International Business Machines Corporation System, method, program, and code generation unit
US9904581B2 (en) 2009-12-18 2018-02-27 International Business Machines Corporation System, method, program, and code generation unit
US10169092B2 (en) 2009-12-18 2019-01-01 International Business Machines Corporation System, method, program, and code generation unit
JP2013537334A (en) * 2010-09-25 2013-09-30 インテル コーポレイション Apparatus, method and system for dynamically optimizing code utilizing adjustable transaction size based on hardware limitations
JP2015523651A (en) * 2012-06-15 2015-08-13 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Method, system, and program for executing machine instructions in a computing environment (transaction start / end instructions)
JP2015526790A (en) * 2012-06-15 2015-09-10 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Saving / restoring selected registers in transaction processing
JP2017509083A (en) * 2014-03-27 2017-03-30 インテル コーポレイション Lock Elegance with Binary Transaction Based Processor

Also Published As

Publication number Publication date
WO2007015925A1 (en) 2007-02-08
EP1913473A1 (en) 2008-04-23

Similar Documents

Publication Publication Date Title
US7398355B1 (en) Avoiding locks by transactionally executing critical sections
JP2009508187A (en) Avoiding locks by executing critical sections transactionally
US7389383B2 (en) Selectively unmarking load-marked cache lines during transactional program execution
US7818510B2 (en) Selectively monitoring stores to support transactional program execution
US7904664B2 (en) Selectively monitoring loads to support transactional program execution
US7206903B1 (en) Method and apparatus for releasing memory locations during transactional execution
US6938130B2 (en) Method and apparatus for delaying interfering accesses from other threads during transactional program execution
US7500086B2 (en) Start transactional execution (STE) instruction to support transactional program execution
US7930695B2 (en) Method and apparatus for synchronizing threads on a processor that supports transactional memory
JP4558714B2 (en) Method and apparatus for avoiding locks by speculatively executing critical regions
US7617421B2 (en) Method and apparatus for reporting failure conditions during transactional execution
US20040163082A1 (en) Commit instruction to support transactional program execution
US7418577B2 (en) Fail instruction to support transactional program execution
US8065670B2 (en) Method and apparatus for enabling optimistic program execution

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090511

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100427

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20111125

A601 Written request for extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A601

Effective date: 20120224

A602 Written permission of extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A602

Effective date: 20120302

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120322

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120411

A601 Written request for extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A601

Effective date: 20120710

A602 Written permission of extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A602

Effective date: 20120718

A601 Written request for extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A601

Effective date: 20120810

A602 Written permission of extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A602

Effective date: 20120817

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20121101