JP2011129024A - Data processing system and data processing method - Google Patents
Data processing system and data processing method Download PDFInfo
- Publication number
- JP2011129024A JP2011129024A JP2009288923A JP2009288923A JP2011129024A JP 2011129024 A JP2011129024 A JP 2011129024A JP 2009288923 A JP2009288923 A JP 2009288923A JP 2009288923 A JP2009288923 A JP 2009288923A JP 2011129024 A JP2011129024 A JP 2011129024A
- Authority
- JP
- Japan
- Prior art keywords
- spin lock
- waiting
- processing unit
- spin
- 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
Links
- 238000003672 processing method Methods 0.000 title claims description 18
- 238000000034 method Methods 0.000 claims description 111
- 230000000717 retained effect Effects 0.000 claims 1
- 241001522296 Erithacus rubecula Species 0.000 abstract description 8
- 230000006870 function Effects 0.000 description 37
- 230000002093 peripheral effect Effects 0.000 description 27
- 238000010586 diagram Methods 0.000 description 11
- 235000003642 hunger Nutrition 0.000 description 3
- 239000004065 semiconductor Substances 0.000 description 3
- 230000037351 starvation Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 229910021421 monocrystalline silicon Inorganic materials 0.000 description 1
- 238000009987 spinning Methods 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
Images
Landscapes
- Multi Processors (AREA)
Abstract
【課題】スピンロックを取得しに行った順番に公平にスピンロックを取得できるデータ処理装置を提供する。
【解決手段】スピンロック変数の予約域をFIFO構成とし、スピンロックを取得しにいった順番をそこに記憶することにより、プロセッシングユニットがスピンロックを取得しに行った順番にスピンロックが渡るようにしたものである。予め決められたプロセッシングユニットの番号に基づいてラウンドロビン順にプロセッシングユニットにスピンロックが行き渡る構成とは異なる。
【選択図】図1A data processing apparatus is provided that can acquire spin locks in the order in which the spin locks were acquired.
The reserved area of the spin lock variable is a FIFO configuration, and the order in which the spin locks are acquired is stored therein, so that the spin locks are transferred in the order in which the processing unit has acquired the spin locks. It is a thing. This is different from the configuration in which the spin locks are distributed to the processing units in the round robin order based on the predetermined processing unit numbers.
[Selection] Figure 1
Description
本発明は、複数のプロセッシングユニットが共有リソースに対して排他制御を行うスピンロック及びアンロックの技術に関し、例えばマルチプロセッサシステムがオンチップされた半導体データ処理装置に適用して有効な技術に関する。 The present invention relates to a spin lock and unlock technique in which a plurality of processing units perform exclusive control on a shared resource, and relates to a technique that is effective when applied to, for example, a semiconductor data processing apparatus in which a multiprocessor system is on-chip.
複数のプロセッシングユニットを備えたマルチプロセッサシステムでは、1つのリソースを複数プロセッシングユニットがアクセスする可能性があるときに、1つのプロセッシングユニットが他のプロセッシングユニットから排他的にリソースをアクセスできる権利を得てからアクセスする。このような排他的アクセス権はロック(lock)の取得により与えられる。ロックはメモリ上のロック変数に対するアトミックなリード・モディファイ・ライトに成功した唯一のプロセッシングユニットが取得する。アトミックなリード・モディファイ・ライトに失敗したプロセッシングユニットは、ロックが解放されてから自分がロックの取得を成功するまでループをスピンしながらロック変数にアトミックなリード・モディファイ・ライトをトライする。このようなロックの実装をスピンロックと言う。複数プロセッシングが同一のスピンロックを取得しようとした場合、特定のプロセッシングユニットだけがスピンロックを取得し、その他のプロセッシングユニットがスピンロックをいつまでも取得できない飢餓状態(starvation)という問題が発生する。即ち、バスアクセス権の取得に所定の優先順位がある場合を想定すると、バスアクセス権に関する優先順位の高いプロセッシングユニットが続けてスピンロックを取得しようとすると、それよりもバスアクセス権の優先順位の低い他のプロセッシングユニットはメモリ上のロック変数に対するアトミックなリード・モディファイ・ライトを行うためのバス権すら取得できず、自分よりバスアクセス権の高いプロセッシングユニットによるバスアクセスが要求さる限り、スピンロックを取得することができない。 In a multiprocessor system having a plurality of processing units, when there is a possibility that one processing resource may access one resource, one processing unit obtains the right to access the resource exclusively from another processing unit. Access from. Such an exclusive access right is given by acquiring a lock. Locks are acquired by the only processing unit that has successfully performed an atomic read-modify-write on a lock variable in memory. A processing unit that fails an atomic read-modify-write tries an atomic read-modify-write to the lock variable while spinning the loop until the lock is successfully acquired after the lock is released. Such a lock implementation is called a spin lock. When multiple processing tries to acquire the same spin lock, only a specific processing unit acquires the spin lock, and the problem of starvation that other processing units cannot acquire the spin lock indefinitely occurs. In other words, assuming that there is a predetermined priority for acquiring the bus access right, if a processing unit with a high priority regarding the bus access right tries to acquire the spin lock continuously, the priority of the bus access right is higher than that. Other low processing units cannot acquire the bus right to perform an atomic read-modify-write on the lock variable in the memory, and spin lock is applied as long as the bus access by a processing unit with a higher bus access right is required. I can't get it.
その飢餓状態を緩和する技術として特許文献1に記載の技術がある。これによれば、スピンロック変数の予約域にスピンロックを待っているプロセッシングユニット(単にコアとも称する)のコア番号をビット位置にエンコードしスピンロック待ち状態を表わす。スピンロックが解放されている状態で偶然最初にスピンロックを取りに行ったコアは問題無くスピンロックを取得できる。一方、既に他のコアがスピンロックを取得済みで自コアが取得できなかった場合は、スピンロック変数の予約域の自コア番号のビット位置に1を立ててスピンロックの解放を待つ。スピンロックを取得済みの他コアがスピンロックを解放する時に、ロック変数の予約域のビット位置をラウンドロビン順に検索し、ビットが立っているコアにロックを取得させる。
There exists a technique of
特許文献1に記載の技術は、ラウンドロビン順でコアがスピンロックを取得できるようにしていることを特徴としている。このため、当該先行技術においてスピンロックがコア間を渡る順番がスピンロックを取得しに行った順ではなく、予め決められた順番にスピンロックが渡る点が問題であり、真にスピンロックを必要とするプロセッシングコアが効率的にスピンロックを取得することができない。
The technique described in
本発明の目的は、スピンロックを取得しに行った順番に公平にスピンロックを取得できるデータ処理装置を提供することにある。 An object of the present invention is to provide a data processing apparatus capable of acquiring spin locks in the order in which the spin locks were acquired.
本発明の別の目的は、スピンロックを取得しに行った順番に公平にスピンロックを取得できるデータ処理方法を提供することにある。 Another object of the present invention is to provide a data processing method capable of acquiring spin locks in the order in which the spin locks were acquired.
本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。 The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.
本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。 The following is a brief description of an outline of typical inventions disclosed in the present application.
すなわち、スピンロック変数の予約域をFIFO構成とし、スピンロックを取得しにいった順番をそこに記憶することにより、プロセッシングユニットがスピンロックを取得しに行った順番にスピンロックが渡るようにしたものである。予め決められたプロセッシングユニットの番号に基づいてラウンドロビン順にプロセッシングユニットにスピンロックが行き渡る構成とは異なる。 In other words, the reserved area of the spin lock variable has a FIFO configuration, and the order in which the spin locks are acquired is stored therein, so that the spin locks are passed in the order in which the processing unit went to acquire the spin locks. Is. This is different from the configuration in which the spin locks are distributed to the processing units in the round robin order based on the predetermined processing unit numbers.
本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記のとおりである。 The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows.
すなわち、複数プロセッシングユニットがスピンロックを取得しに行った順番に公平にスピンロックを取得することができる。 In other words, spinlocks can be acquired fairly in the order in which the plurality of processing units went to acquire the spinlock.
1.実施の形態の概要
先ず、本願において開示される発明の代表的な実施の形態について概要を説明する。代表的な実施の形態についての概要説明で括弧を付して参照する図面中の参照符号はそれが付された構成要素の概念に含まれるものを例示するに過ぎない。
1. First, an outline of a typical embodiment of the invention disclosed in the present application will be described. Reference numerals in the drawings referred to in parentheses in the outline description of the representative embodiments merely exemplify what are included in the concept of the components to which the reference numerals are attached.
〔1〕代表的な実施の形態に係るデータ処理システム(SYS)は、リソース(PRPH)を共有する複数個のプロセッシングユニット(CPU_00〜CPU_11)がスピンロック変数領域(LOCK_FLD、LOCK_FLDS)を操作してスピンロックの取得を行ない、前記スピンロック変数領域はスピンロックへの待ち順の登録領域(BUFF、RING_BUFF)を有し、前記プロセッシングユニットは、スピンロックの取得に失敗したとき失敗した順番で当該プロセッシングユニット名を前記待ち順の登録領域に登録し、登録されている自らの順番が最先の順位に更新されるのを待ってスピンロックを取得し、取得したスピンロックを解放するとき前記待ち順の登録領域に登録されている夫々の待ち順の順位を一つ最先方向にシフトする。 [1] In a data processing system (SYS) according to a typical embodiment, a plurality of processing units (CPU_00 to CPU_11) sharing resources (PRPH) operate spin lock variable areas (LOCK_FLD, LOCK_FLDS). The spin lock is acquired, the spin lock variable area has a registration area (BUFF, RING_BUFF) in the waiting order for the spin lock, and the processing unit performs the processing in the order of failure when acquisition of the spin lock fails. Register the unit name in the registration area of the waiting order, wait for the registered own order to be updated to the earliest order, acquire the spin lock, and release the acquired spin lock The first place in the waiting order of each registered in the registration area To shift to.
上記より、スピンロック変数の予約域である待ち順の登録領域がFIFOとして構成され、スピンロックを取得しにいった順番をそこに登録し、最先に予約登録されたプロセッシングユニットが次にスピンロックを取得することができるから、プロセッシングユニットがスピンロックを取得しに行った順番にスピンロックが渡るようになる。予め決められたプロセッシングユニット番号に基づいてラウンドロビン順にプロセッシングユニットにスピンロックが行き渡るものではないから、複数プロセッシングユニットがスピンロックを取得しに行った順番に公平にスピンロックを取得することができる。 From the above, the registration area of the waiting order, which is the reserved area of the spin lock variable, is configured as a FIFO, the order in which the spin lock was acquired is registered there, and the processing unit that is reserved and registered first is the next spin unit. Since the locks can be acquired, the spin locks are transferred in the order in which the processing unit went to acquire the spin lock. Since the spin locks are not distributed to the processing units in the round robin order based on the predetermined processing unit numbers, the spin locks can be acquired fairly in the order in which the plurality of processing units went to acquire the spin locks.
〔2〕更に具体的な実施の形態に係るデータ処理システム(SYS)は、複数個のプロセッシングユニット(CPU_00〜CPU_11)と、前記複数個のプロセッシングユニットが共有するリソース(PRPH)と、前記複数個のプロセッシングユニットによって操作されるスピンロック変数領域(LOCK_FLD、LOCK_FLDS)とを有する。前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット(LOCK_BIT)、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域(BUFF、RING_BUFF)を有する。前記プロセッシングユニットはリソースを使用するときスピンロック処理(spinlock)とアンロック処理(unlock)を行なう。スピンロック処理は、前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して、それが最先に繰り上げられるのを待ってスピンロック状態を取得する処理である。アンロック処理は、前記スピンロック処理で取得したスピンロック状態を解放するときは待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げ、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する処理である。 [2] A data processing system (SYS) according to a more specific embodiment includes a plurality of processing units (CPU_00 to CPU_11), a resource (PRPH) shared by the plurality of processing units, and the plurality of processing units. And a spin lock variable region (LOCK_FLD, LOCK_FLDS) operated by the processing unit. The spin lock variable area includes a lock bit (LOCK_BIT) for indicating whether or not the resource can be used, and a waiting order registration area (BUFF) for holding the order of processing units waiting for the resource to be used. , RING_BUFF). The processing unit performs a spin lock process (spinlock) and an unlock process (unlock) when using a resource. In the spin lock process, when the lock bit is read to detect that the spin lock state is released, the lock bit is manipulated to acquire the spin lock state, and the lock bit is read and the spin lock has already been performed. When it is detected that the status has been acquired, the processing unit is registered in the waiting-order registration area, and the spinlock status is acquired after waiting for it to be moved up first. In the unlock process, when releasing the spin lock state acquired in the spin lock process, if there is a processing unit registered in the waiting order registration area and waiting, the waiting order is incremented by one. Otherwise, it is a process of releasing the spin lock state by operating the lock bit.
上記より、スピンロック変数の予約域である待ち順の登録領域をFIFOとして構成し、スピンロックを取得しにいった順番をそこに登録し、最先に予約登録されたプロセッシングユニットが次にスピンロックを取得することができるから、プロセッシングユニットがスピンロックを取得しに行った順番にスピンロックが渡るようになる。予め決められたプロセッシングユニット番号に基づいてラウンドロビン順にプロセッシングユニットにスピンロックが行き渡るものではないから、複数プロセッシングユニットがスピンロックを取得しに行った順番に公平にスピンロックを取得することができる。 From the above, the registration area of the waiting order, which is the reserved area of the spin lock variable, is configured as a FIFO, the order in which the spin lock was acquired is registered there, and the processing unit that is reserved and registered first is the next spin unit. Since the locks can be acquired, the spin locks are transferred in the order in which the processing unit went to acquire the spin lock. Since the spin locks are not distributed to the processing units in the round robin order based on the predetermined processing unit numbers, the spin locks can be acquired fairly in the order in which the plurality of processing units went to acquire the spin locks.
〔3〕<スピンロック処理におけるアトミックな処理>
項2のデータ処理システムにおいて、プロセッシングユニットは、前記スピンロック処理において前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録する処理を行なうとき、前記スピンロック変数領域に対するアクセス権を占有する。スピンロックの処理を矛盾なく行うことができる。
[3] <Atomic processing in spin lock processing>
In the data processing system according to
〔4〕<アンロック処理におけるアトミックな処理>
項2のデータ処理システムにおいて、プロセッシングユニットは前記スピンロック変数領域に対するアクセス権を占有して前記アンロック処理を行う。アンロックの処理を矛盾なく行うことができる。
[4] <Atomic processing in unlock processing>
In the data processing system according to
〔5〕<シフトレジスタによるFIFO方式>
項2のデータ処理システムにおいて、前記プロセッシングユニットは、前記待ち順の登録領域に登録されたプロセッシングユニット名を一方向にシフトすることによって待ち順の繰り上げを行う。
[5] <FIFO method with shift register>
In the data processing system according to
〔6〕項3のデータ処理システムにおいて、前記スピンロック変数領域は、スピンロック状態を現在取得しているプロセッシングユニットを示すカレントユニット名保持領域(CURRENT_CPU_ID)を更に有する。このとき、前記スピンロック処理は、前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名をカレントユニット名保持領域に記録し(S12)、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して(S13)、それが最先に繰り上げられるのを待って(S14、S15)スピンロック状態を取得する処理である。前記アンロック処理は、前記スピンロック処理で取得したスピンロック状態を解放するときは待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げて最先のプロセッシングユニット名でカレントユニット名保持領域を書換え(S23)、待っているプロセッシングユニットがなければスピンロック変数領域を初期化して(S22)スピンロック状態を解放する処理である。
[6] In the data processing system according to
〔7〕項5のデータ処理システムにおいて、前記スピンロック変数領域は、前記待ち順の登録領域に登録されて待っているプロセッシングユニットの数を保持する待ち数保持領域(FIFO_LENGTH)をさらに有する。このとき、前記プロセッシングユニットは、待ち数保持領域が保持する数によって、待ち順の登録領域に登録されて待っているプロセッシングユニットの有無を判別する。
[7] In the data processing system according to
〔8〕<リングバッファによるFIFO方式>
項3のデータ処理システムにおいて、前記待ち順の登録領域は前記複数個のプロセッシングユニット(CP_00〜CPU_11)の数に相当する数のエントリ領域(RING_BUFF)を有する。さらに、前記エントリ領域のアドレスを指す第1ポインタ(TOP)と、前記エントリ領域のアドレスを指す第2ポインタ(BOTTOM)と、を有する。このとき、前記スピンロック処理は、前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名を第1ポインタの初期値が指すエントリ領域に格納し(S32)、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは第2ポインタの値を進めて当該第2ポインタの値が指すエントリ領域に当該プロセッシングユニット名を登録して(S33)、それが前記第1ポインタで指されるのを待って(S34、S35)スピンロック状態を取得する処理である。前記アンロック処理は、前記スピンロック処理で取得したスピンロック状態を解放するときは第1ポインタの値が第2ポインタの値に等しくなければ第1ポインタの値を進め(S43)、待っているプロセッシングユニットがなければスピンロック変数領域を初期化して(S42)スピンロック状態を解放する処理である。
[8] <FIFO method with ring buffer>
In the data processing system according to
〔9〕代表的な実施の形態に係るデータ処理方法は、リソースを共有する複数個のプロセッシングユニットがスピンロック変数領域を操作してスピンロックの取得を行なう方法であって、前記スピンロック変数領域に割当てられたスピンロック変数の予約域である待ち順の登録領域に、スピンロックの取得を失敗したとき失敗した順番にプロセッシングユニット名を登録し、最先に予約登録されているプロセッシングユニットに次のスピンロックを取得させる。 [9] A data processing method according to a representative embodiment is a method in which a plurality of processing units that share resources manipulate a spin lock variable area to acquire a spin lock, and the spin lock variable area When the spin lock acquisition fails, the processing unit names are registered in the order of failure in the registration area of the waiting order, which is the reserved area for the spin lock variable assigned to, and next to the processing unit that is reserved first. Get the spinlock of
〔10〕更に具体的な実施の形態に係るデータ処理方法は、リソースを共有する複数個のプロセッシングユニットがスピンロック変数領域を操作してスピンロック処理とアンロック処理とを行なう方法であり、前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域を有する。前記スピンロック処理は、前記プロセッシングユニットが前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して、それが最先に繰り上げられるのを待ってスピンロック状態を取得する処理である。前記アンロック処理は、取得したスピンロック状態を解放するとき待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げ、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する処理である。 [10] A data processing method according to a more specific embodiment is a method in which a plurality of processing units sharing resources perform spin lock processing and unlock processing by operating a spin lock variable area, The spin lock variable area includes a lock bit for indicating whether or not the resource can be used, and a waiting order registration area for holding the order of processing units waiting for the resource. In the spin lock process, when the processing unit reads the lock bit and detects that the spin lock state is released, the spin unit operates the lock bit to acquire the spin lock state and reads the lock bit. When it is detected that the spin lock state has already been acquired, the processing unit is registered in the registration area in the waiting order, and the process of acquiring the spin lock state after waiting for it to be advanced first. is there. In the unlock process, when the acquired spin lock state is released, if there is a waiting processing unit registered in the waiting order registration area, the waiting order is incremented by one, and if there is no waiting processing unit, the lock bit is set. This is a process to release the spin lock state by operating.
〔11〕<スピンロック処理におけるアトミックな処理>
項10のデータ処理方法において、前記スピンロック処理では、前記プロセッシングユニットは前記スピンロック変数領域に対するアクセス権を占有して、前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録する処理を行なう。
[11] <Atomic process in spin lock process>
In the data processing method according to
〔12〕<アンロック処理におけるアトミックな処理>
項11のデータ処理方法において、前記プロセッシングユニットは前記スピンロック変数領域に対するアクセス権を占有して前記アンロック処理を行う。
[12] <Atomic processing in unlock processing>
In the data processing method according to
〔13〕<シフトレジスタによるFIFO方式>
別の具体的な実施の形態に係るデータ処理方法は、リソースを共有する複数個のプロセッシングユニットがスピンロック変数領域を操作してスピンロック処理とアンロック処理とを行なう方法であって、前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域と、スピンロック状態を現在取得しているプロセッシングユニットを示すカレントユニット名保持領域と、を有する。前記スピンロック処理は、前記プロセッシングユニットが前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名をカレントユニット名保持領域に記録し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して、それが最先に繰り上げられるのを待ってスピンロック状態を取得する処理である。前記アンロック処理は、取得したスピンロック状態を解放するときは待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げて最先のプロセッシングユニット名でカレントユニット名保持領域を書換え、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する処理である。
[13] <FIFO method with shift register>
A data processing method according to another specific embodiment is a method in which a plurality of processing units sharing resources perform spin lock processing and unlock processing by operating a spin lock variable area, The lock variable area includes a lock bit for indicating whether or not the resource can be used, a waiting area registration area for holding the order of processing units waiting for the resource, and a spin lock state. A current unit name holding area indicating the acquired processing unit. In the spin lock process, when the processing unit reads the lock bit and detects that the spin lock state is released, the spin lock state is manipulated to acquire the spin lock state, and the processing unit name is changed. When recording the current unit name holding area and detecting that the spin lock state has already been acquired by reading the lock bit, the processing unit is registered in the waiting order registration area, This is a process of acquiring the spin lock state after waiting for the advance. In the unlock process, when the acquired spin lock state is released, if there is a waiting processing unit registered in the waiting order registration area, the waiting unit is incremented by one and the current unit name is the first processing unit name. This process rewrites the holding area and releases the spin lock state by operating the lock bit if there is no processing unit waiting.
〔14〕<リングバッファによるFIFO方式>
更に別の具体的な実施の形態に係るデータ処理方法は、リソースを共有する複数個のプロセッシングユニットがスピンロック変数領域を操作してスピンロック処理とアンロック処理とを行なう方法であって、前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域を有する。前記待ち順の登録領域は前記複数個のプロセッシングユニットの数に相当する数のエントリ領域と、前記エントリ領域のアドレスを指す第1ポインタと、前記エントリ領域のアドレスを指す第2ポインタと、を有する。前記スピンロック処理は、前記プロセッシングユニットが前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名を第1ポインタが指すエントリ領域に格納し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは第2ポインタの値を進めて当該第2ポインタの値が指すエントリ領域に当該プロセッシングユニット名を登録して、それが前記第1ポインタで指されるのを待ってスピンロック状態を取得する処理である。前記アンロック処理は、取得したスピンロック状態を解放するときは第1ポインタの値が第2ポインタの値に等しくなければ第1ポインタの値を進め、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する処理である。
[14] <FIFO method with ring buffer>
A data processing method according to yet another specific embodiment is a method in which a plurality of processing units sharing resources perform spin lock processing and unlock processing by operating a spin lock variable area, The spin lock variable area includes a lock bit for indicating whether or not the resource can be used, and a waiting order registration area for holding the order of processing units waiting for the resource. The waiting-order registration area has a number of entry areas corresponding to the number of the plurality of processing units, a first pointer indicating an address of the entry area, and a second pointer indicating an address of the entry area. . In the spin lock process, when the processing unit reads the lock bit and detects that the spin lock state is released, the spin lock state is manipulated to acquire the spin lock state, and the processing unit name is changed. The entry stored in the entry area pointed to by the first pointer and reading the lock bit and detecting that the spin lock state has already been acquired, advances the value of the second pointer to indicate the entry pointed to by the value of the second pointer The processing unit name is registered in the area and waits for the processing unit name to be pointed by the first pointer to acquire the spin lock state. In the unlock process, when the acquired spin lock state is released, the value of the first pointer is advanced if the value of the first pointer is not equal to the value of the second pointer, and the lock bit is set if there is no processing unit waiting. This is a process to release the spin lock state by operating.
2.実施の形態の詳細
《第1の実施の形態》
図6には第1の実施の形態に係るデータ処理システムが例示される。同図に示されるデータ処理システムは、特に制限されないが、シングルチップ又はマルチチップで構成されたマイクロコンピュータである。シングルチップで構成されたマイクロコンピュータは、特に制限されないが、単結晶シリコンのような1個の半導体基板に相補型MOS集積回路製造技術などによって構成され、マルチチップで構成されたマイクロコンピュータは、特に制限されないが、多層配線基板等に複数個の半導体集積回路が搭載されて構成される。何れの構成においてもデータ処理システムSYSはマルチプロセッサシステムを構成する。
2. Details of Embodiment << First Embodiment >>
FIG. 6 illustrates a data processing system according to the first embodiment. The data processing system shown in the figure is a microcomputer composed of a single chip or a multichip, although not particularly limited. The microcomputer composed of a single chip is not particularly limited, but the microcomputer composed of a single-chip semiconductor substrate such as single crystal silicon by a complementary MOS integrated circuit manufacturing technique, etc. Although not limited, a plurality of semiconductor integrated circuits are mounted on a multilayer wiring board or the like. In any configuration, the data processing system SYS constitutes a multiprocessor system.
データ処理システムSYSは、特に制限されないが、複数個例えば4個のプロセッシングユニットCPU_00〜CPU_11と、前記複数個のプロセッシングユニットCPU_00〜CPU_11が共有するリソース(共有リソース)として代表的に示された周辺回路PRPHと、複数個のプロセッシングユニットCPU_00〜CPU_11によってアクセス可能なRAM(Random Access Memory)等のメモリMRYとがバスBUSに接続されて構成される。 The data processing system SYS is not particularly limited, but a plurality of, for example, four processing units CPU_00 to CPU_11 and peripheral circuits typically shown as resources (shared resources) shared by the plurality of processing units CPU_00 to CPU_11 The PRPH and a memory MRY such as a RAM (Random Access Memory) accessible by a plurality of processing units CPU_00 to CPU_11 are connected to a bus BUS.
夫々のプロセッシングユニットCPU_00〜CPU_11は、特に制限されないが、少なくとも、命令を実行する中央処理装置(Central Processing Unit)を有し、その他、必要に応じて、キャッシュメモリ及びメモリマネージメントユニットなどを備える、プロセッサコアとして構成される。このデータ処理システムにおいて、1つのリソースを複数プロセッシングユニットがアクセスする可能性があるときに、1つのプロセッシングユニットが他のプロセッシングユニットから排他的にリソースをアクセスできる権利を得てからアクセスすることが必要になる。このような排他的アクセス権の取得と解放の制御をスピンロックの取得と解放によって行うために、前記メモリMRYにはプロセッシングユニットCPU_00〜CPU_11によって操作されるスピンロック変数領域LOCK_FLDが割当てられる。ここに示すスピンロック変数領域LOCK_FLDは例えば一つの周辺回路PRPHに関するものを代表的に示している。スピンロック変数領域LOCK_FLDは、特に制限されないが、実際はスピンロックを用いたアクセス制御の対象とされるリソース毎に割当てられるのが望ましい。 Each of the processing units CPU_00 to CPU_11 is not particularly limited, but has at least a central processing unit (Central Processing Unit) for executing instructions, and a processor including a cache memory and a memory management unit as necessary. Configured as a core. In this data processing system, when there is a possibility that multiple processing units may access one resource, it is necessary that one processing unit obtains the right to access the resource exclusively from other processing units before accessing it. become. In order to control the acquisition and release of such exclusive access right by acquiring and releasing the spin lock, the memory MRY is assigned a spin lock variable area LOCK_FLD operated by the processing units CPU_00 to CPU_11. The spin lock variable region LOCK_FLD shown here representatively shows, for example, one related to one peripheral circuit PRPH. The spin lock variable area LOCK_FLD is not particularly limited, but is actually preferably allocated for each resource that is subject to access control using the spin lock.
前記バスBUSには図示を省略するバスアービタ若しくはバスルータが配置され、採用されているバスプロトコルに従って競合するバスアクセス要求を調停し、バス権の付与や信号経路のルーティングの制御などを行う。スピンロック変数領域LOCK_FLDを用いたスピンロックの制御は共有リソースに対するアクセスの競合をアクセス要求主体が自律的に制御するものである。 A bus arbiter or a bus router (not shown) is arranged on the bus BUS, arbitrating bus access requests that compete with each other according to the adopted bus protocol, and assigning bus rights and controlling routing of signal paths. The spin lock control using the spin lock variable region LOCK_FLD is such that the access requesting entity autonomously controls the contention of access to the shared resource.
図1にはスピンロック変数領域LOCK_FLDの詳細な一例が示される。スピンロック変数領域LOCK_FLDは、例えば全部で32ビットの領域を有し、ビットB31−26にFIFO(First In-First Out)バッファBUFF(FIFO_1st〜FIFO_3rd)、ビット25−24にカレントユニット番号CURRENT_CPU_ID、ビットB17−16に待ちエントリ数FIFO_LENGTH、及びビットB0にロックビットLOCK_BITが割当てられる。 FIG. 1 shows a detailed example of the spin lock variable area LOCK_FLD. The spin lock variable area LOCK_FLD has, for example, a 32-bit area in total, a FIFO (First In-First Out) buffer BUFF (FIFO_1st to FIFO_3rd) in bits B31-26, a current unit number CURRENT_CPU_ID, bits in bits 25-24 The number of waiting entries FIFO_LENGTH is assigned to B17-16, and the lock bit LOCK_BIT is assigned to bit B0.
FIFOバッファBUFFは3個のエントリ領域FIFO_1st〜FIFO_3rdを有し、エントリ領域FIFO_1st〜FIFO_3rdにはスピンロックの取得に失敗して待っているプロセッシングユニットのIDが待ち順位で登録される。FIFOエントリ領域FIFO_1stが第1優先順位、FIFOエントリ領域FIFO_2ndが第2優先順位、FIFOエントリ領域FIFO_3rdが第3優先順位のIDを保持する。ここでは、プロセッシングユニットCPU_00のIDは“00”、CPU_01のIDは“01”、CPU_10のIDは“10”、CPU_11のIDは“11”とする。詳細は後で説明するが、FIFOエントリ領域FIFO_1st〜FIFO_3rdに対するFIFO動作は登録IDの高順位側への右シフト動作によって行われる。 The FIFO buffer BUFF has three entry areas FIFO_1st to FIFO_3rd. In the entry areas FIFO_1st to FIFO_3rd, the IDs of the processing units waiting due to the spin lock acquisition are registered in the waiting order. The FIFO entry area FIFO_1st holds the ID of the first priority, the FIFO entry area FIFO_2nd holds the ID of the second priority, and the FIFO entry area FIFO_3rd holds the ID of the third priority. Here, the ID of the processing unit CPU_00 is “00”, the ID of the CPU_01 is “01”, the ID of the CPU_10 is “10”, and the ID of the CPU_11 is “11”. Although details will be described later, the FIFO operation for the FIFO entry areas FIFO_1st to FIFO_3rd is performed by a right shift operation of the registration ID to the higher order side.
カレントユニット番号CURRENT_CPU_IDは現在スピンロックを取得しているプロセッシングユニットのIDを示す。 The current unit number CURRENT_CPU_ID indicates the ID of the processing unit that is currently acquiring the spin lock.
待ちエントリ数FIFO_LENGTHはスピンロックの取得に失敗して以降の取得を待っているプロセッシングユニットの数、即ち、FIFOバッファBUFFが保持するプロセッシングIDの数を示す。FIFOエントリ領域FIFO_1st〜FIFO_3rdが保持する“00”がID“00”であるのか単なる初期値“00”であるのかを区別する意義を有する。 The number of waiting entries FIFO_LENGTH indicates the number of processing units waiting for the subsequent acquisition after failing to acquire the spin lock, that is, the number of processing IDs held in the FIFO buffer BUFF. It has the significance of distinguishing whether "00" held in the FIFO entry areas FIFO_1st to FIFO_3rd is the ID "00" or just the initial value "00".
ロックビットLOCK_BITは “1”でスピンロックの取得状態を示し、“0”で当該ロックの解放状態を示す。 The lock bit LOCK_BIT is “1” indicating the acquisition state of the spin lock, and “0” indicates the release state of the lock.
次に、スピンロック変数領域LOCK_FLDを用いたスピンロックの制御手順について具体例を説明する。 Next, a specific example of the spin lock control procedure using the spin lock variable region LOCK_FLD will be described.
図2には共通リソースである周辺回路PRPHをアクセスするために夫々のプロセッシングユニットCPU_00〜CPU_11が並列に実行するプログラムQが例示される。Line_1のLOOP_0はループ開始アドレスのラベルである。Line_2では関数spinlockを実行する。この関数spinlockの実行はスピンロックを取得するまで完了せず、取得すると完了する。スピンロックの取得とロックの解放は周辺回路PRPHへの排他的アクセス権の取得と解放と同一視する。Line_3では関数printを実行し、例えば周辺回路PRPHに自分のプロセッシングID等を出力してプリンタ等の機器を制御する。この操作は、完了するまで他の3つのプロセッシングユニットが同一アドレスへアトミックなリード・モディファイ・ライトを順番にできる程度に時間がかかるものとする。要するに、プリンタ等の機器を制御している間、一時的にバス権が解放されて、他のプロセッシングユニットがスピンロック変数領域LOCK_FLDをアクセスして関数spinlockを実行できる状態が与えられるということである。Line_4では関数unlockを実行して、取得したロックを解放する。この後、Line_5でループ開始アドレスLOOP_0へ戻る。 FIG. 2 illustrates a program Q executed in parallel by the respective processing units CPU_00 to CPU_11 in order to access the peripheral circuit PRPH which is a common resource. LOOP_0 of Line_1 is a label of the loop start address. Line_2 executes the function spinlock. The execution of this function spinlock is not completed until the spinlock is acquired, and is completed when it is acquired. Acquisition of the spin lock and release of the lock are equated with acquisition and release of the exclusive access right to the peripheral circuit PRPH. In Line_3, the function “print” is executed, and for example, its own processing ID is output to the peripheral circuit PRPH to control devices such as a printer. This operation is time-consuming until the other three processing units can sequentially perform atomic read-modify-write to the same address until completion. In short, while controlling a device such as a printer, the bus right is temporarily released, and a state in which another processing unit can access the spinlock variable area LOCK_FLD and execute the function spinlock is given. . In Line_4, execute the function unlock to release the acquired lock. Thereafter, the process returns to the loop start address LOOP_0 at Line_5.
図3にはスピンロック変数領域LOCK_FLDの初期化フローが例示される。夫々のプロセッシングユニットCPU_00〜CPU_11が図2のプログラムの実行を開始する前に所定のプロセッシングユニットがスピンロック変数領域LOCK_FLDを図6に例示されるように全ビット“0”に初期化する(S1)。 FIG. 3 illustrates an initialization flow of the spin lock variable area LOCK_FLD. Before each processing unit CPU_00 to CPU_11 starts executing the program of FIG. 2, a predetermined processing unit initializes the spin lock variable area LOCK_FLD to all bits “0” as illustrated in FIG. 6 (S1). .
図4には関数spinlockを実行したときのスピンロック処理の制御フローが示される。バス権を獲得したプロセッシングユニットはスピンロック変数領域LOCK_FLDをリードして初期値であるかを判別する。すなわち、ロックビットLOCK_BITが“0”にされている(スピンロック状態が解放されている)か否かを判別する(S11)。スピンロック状態が解放されていることを判別したときは自らのプロセッシングユニットID(自CPU_ID)をカレントユニット番号CURRENT_CPU_IDの領域に記録し且つ前記ロックビットLOCK_BITを“1”に書換えて(S12)、スピンロック状態を取得する。スピンロック状態が解放されていないとき(スピンロックの取得に失敗したとき)は、自らのプロセッシングユニットID(自CPU_ID)をFIFOバッファBUFFの末尾に登録すると共に、待ちエントリ数FIFO_LENGTHに1を加算して更新する(S13)。FIFOバッファBUFFの末尾は、エントリ数FIFO_LENGTHの値に1を加算した値が示す順位のFIFOエントリ領域を選べばよい。例えばFIFOエントリ領域FIFO_1stにCPU_IDが登録されていて待ちエントリ数が1個のときは、エントリ数FIFO_LENGTHの値“1”に1を加算した値“2”が示す第2順位のFIFOエントリ領域FIFO_2ndに自CPU_IDを格納すればよい。即ち、スピンロックの取得に失敗したとき、失敗した順番で当該プロセッシングユニットIDをFIFOバッファBUFFに登録することになる。その後、カレントユニット番号CURRENT_CPU_IDの領域が保有するプロセッシングIDが自らのプロセッシングIDに(自CPU_ID)に更新されるのを待って(S14、S15)、要するに、FIFOバッファBUFFに登録されている自らの順番が最先の順位に更新されるのを待ってスピンロックを取得することができる。尚、カレントユニット番号CURRENT_CPU_IDの更新は、後述するアンロック処理の中で他のプロセッシングユニットが、取得したスピンロックを解放するときに行われる。 FIG. 4 shows a control flow of the spin lock process when the function spinlock is executed. The processing unit that has acquired the bus right reads the spin lock variable area LOCK_FLD to determine whether it is the initial value. That is, it is determined whether or not the lock bit LOCK_BIT is set to “0” (the spin lock state is released) (S11). When it is determined that the spin lock state has been released, its own processing unit ID (own CPU_ID) is recorded in the area of the current unit number CURRENT_CPU_ID, and the lock bit LOCK_BIT is rewritten to “1” (S12). Get lock status. When the spin lock state is not released (when acquisition of the spin lock has failed), its own processing unit ID (own CPU_ID) is registered at the end of the FIFO buffer BUFF, and 1 is added to the number of waiting entries FIFO_LENGTH. (S13). For the end of the FIFO buffer BUFF, a FIFO entry area having a rank indicated by a value obtained by adding 1 to the value of the number of entries FIFO_LENGTH may be selected. For example, when the CPU_ID is registered in the FIFO entry area FIFO_1st and the number of waiting entries is one, the value “2” obtained by adding 1 to the value “1” of the number of entries FIFO_LENGTH is set to the second-order FIFO entry area FIFO_2nd. The own CPU_ID may be stored. That is, when acquisition of the spin lock fails, the processing unit IDs are registered in the FIFO buffer BUFF in the order of failure. After that, it waits for the processing ID held in the area of the current unit number CURRENT_CPU_ID to be updated to its own processing ID (local CPU_ID) (S14, S15). In short, its own order registered in the FIFO buffer BUFF The spinlock can be acquired by waiting for the first to be updated. The current unit number CURRENT_CPU_ID is updated when another processing unit releases the acquired spin lock in the unlock process described later.
前記ステップS11、S12、S13はアトミック処理とされ、当該プロセッシングユニットはステップS11、S12、S13の処理を完了するまでの間、スピンロック変数領域LOCK_FLDに対するアクセス権を他のプロセッシングユニットに渡さない。プロセッシングユニットCPU_00〜CPU_11はそのようなリード・モディファイ・ライトによるアクセスをアトミック処理として実現するために用いることができるロード命令及びストア命令を命令セットに持つ。 Steps S11, S12, and S13 are atomic processes, and the processing unit does not pass the access right to the spinlock variable area LOCK_FLD to other processing units until the processes of steps S11, S12, and S13 are completed. The processing units CPU_00 to CPU_11 have a load instruction and a store instruction in an instruction set that can be used to realize such read, modify, and write access as atomic processing.
図5には関数unlockを実行したときのアンロック処理の制御フローが示される。前記アンロック処理では、エントリ数FIFO_LENGTHの値をリードし、その値が“0”か否かによってFIFOバッファBUFFに登録されて待っているプロセッシングユニットがあるか否かを判別し(S21)、待っているものがなければスピンロック変数領域LOCK_FLDを初期化して(S22)、スピンロックを解放する。待っているプロセッシングユニットがあれば、カレントユニット番号CURRENT_CPU_IDの領域が保有するプロセッシングIDを、エントリ領域FIFO_1stに登録されているプロセッシングIDに更新し、エントリ領域FIFO_1st〜FIFO_3rdが保持する値をシフトして、待ち順を一つ繰り上げ、更に、エントリ数FIFO_LENGTHの値を1減算して更新し、アンロック処理を終る(S23)。ステップS23の処理が何回か行われることによって、スピンロックの取得に失敗したプロセッシングユニットの待ち順の順位が順次先頭の方向に繰り上げられていく。 FIG. 5 shows a control flow of unlock processing when the function unlock is executed. In the unlocking process, the value of the number of entries FIFO_LENGTH is read, and it is determined whether there is a processing unit registered and waiting in the FIFO buffer BUFF depending on whether the value is “0” (S21). If there is none, the spin lock variable area LOCK_FLD is initialized (S22), and the spin lock is released. If there is a waiting processing unit, the processing ID held in the area of the current unit number CURRENT_CPU_ID is updated to the processing ID registered in the entry area FIFO_1st, and the values held in the entry areas FIFO_1st to FIFO_3rd are shifted, The waiting order is incremented by one, and the entry number FIFO_LENGTH is decremented by 1 and updated, and the unlocking process is terminated (S23). By performing the process of step S23 several times, the rank of the waiting order of the processing units that have failed to acquire the spin lock is sequentially raised toward the top.
以上のように、夫々のプロセッシングユニットCPU_00〜CPU_11は、スピンロックの取得に失敗したとき失敗した順番で当該プロセッシングユニットのIDをFIFOバッファBUFFに登録し、登録されている自らの順番が最先の順位に更新されるのを待ってスピンロックを取得し、取得したスピンロックを解放するときFIFOバッファBUFFに登録されている夫々の待ち順の順位を一つ最先方向にシフトして、他のプロセッシングユニットによるスピンロック獲得の機会を提供する。したがって、プロセッシングユニットがスピンロックを取得しに行った順番にスピンロックが渡るようになる。予め決められたプロセッシングユニット番号に基づいてラウンドロビン順にプロセッシングユニットにスピンロックが行き渡るものではないから、複数プロセッシングユニットがスピンロックを取得しに行った順番に公平にスピンロックを取得することができる。 As described above, each of the processing units CPU_00 to CPU_11 registers the IDs of the processing units in the FIFO buffer BUFF in the order of failure when the spin lock acquisition fails, and the registered order of the processing unit CPU_00 to CPU_11 is the earliest. Wait for the rank to be updated and acquire the spin lock. When releasing the acquired spin lock, the rank of each waiting order registered in the FIFO buffer BUFF is shifted one by one to the other direction. Provides an opportunity for processing units to acquire spinlocks. Accordingly, the spin locks are transferred in the order in which the processing unit went to acquire the spin lock. Since the spin locks are not distributed to the processing units in the round robin order based on the predetermined processing unit numbers, the spin locks can be acquired fairly in the order in which the plurality of processing units went to acquire the spin locks.
図7乃至図18を参照しながらプロセッシングユニットCP_00〜CPU_11によるスピンロック処理とアンロック処理による動作を具体的に説明する。 The operations of the spin lock process and the unlock process by the processing units CP_00 to CPU_11 will be specifically described with reference to FIGS.
スピンロック変数領域LOCK_FLDは図6の状態に初期化され、夫々のプロセッシングユニットCPU_00〜CPU_11は図2のプログラムQを並列に実行する。このとき、バスBUSの実装は夫々のプロセッシングユニットCPU_00〜CPU_11に対して公平でない。バス固有の優先順があり、同一アドレスへのアトミックなリード・モディファイ・ライトが複数のプロセッシングユニットCPU_00〜CPU_11の間で競合したときのバス権を獲得する優先順は、例えば、CPU_00、CPU_01、CPU_10、CPU_11の順に高いものとする。この仮定で一般性は失われない。 The spin lock variable area LOCK_FLD is initialized to the state shown in FIG. 6, and the respective processing units CPU_00 to CPU_11 execute the program Q shown in FIG. 2 in parallel. At this time, the implementation of the bus BUS is not fair to the respective processing units CPU_00 to CPU_11. There is a priority order unique to the bus, and the priority order for acquiring the bus right when the atomic read-modify-write to the same address competes among the plurality of processing units CPU_00 to CPU_11 is, for example, CPU_00, CPU_01, CPU_10. , CPU_11 in order. Generality is not lost with this assumption.
この優先順に従いプロセッシングユニットCPU_00がバス権を獲得して関数spinlockを実行し、スピンロック変数領域LOCK_FLDに対し、図7の(a)、(b)の経路でアトミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDは、図7に示されるように、ロックビットLOCK_BITが“0”から“1”に書換えられ、プログラムQのLine_2の関数spinlockの処理を完了する。次いで、プロセッシングユニットCPU_00は周辺回路PRPHへの排他的アクセス権を取得して、プログラムQのLine_3の関数printを実行し、自らのプロセッシングID(自CPU_ID)を経路(c)で周辺回路PRPHに出力する。 In accordance with this priority order, the processing unit CPU_00 acquires the bus right and executes the function spinlock, and executes atomic read / modify / write to the spin lock variable area LOCK_FLD through the paths (a) and (b) of FIG. To do. As a result, in the spin lock variable area LOCK_FLD, as shown in FIG. 7, the lock bit LOCK_BIT is rewritten from “0” to “1”, and the processing of the function spinlock of the Line_2 of the program Q is completed. Next, the processing unit CPU_00 acquires the exclusive access right to the peripheral circuit PRPH, executes the function print of the Line_3 of the program Q, and outputs its own processing ID (own CPU_ID) to the peripheral circuit PRPH via the path (c). To do.
プロセッシングユニットCPU_00がプログラムQのLine_3における関数printを実行するとき前述の如く時間が掛かり、その間に、他の3つのプロセッシングユニットCPU_01、CPU_10、CPU_11はプログラムの関数spinlockを実行している。プロセッシングユニットCPU_01、CPU_10、CPU_11のうち、優先順が最も高いCPU_01がバス権を取得するが、スピンロックの取得に失敗するので図4のステップS13を実行して、図8の(d)、(e)の経路でアトミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDの内容は図8の如く変更される。即ち、FIFOバッファBUFFにおける第1番目のエントリ領域FIFO_1stにプロセッシングユニットCPU_01のID“01”が登録され、待ちエントリ数FIFO_LENGTHが01(1個)になる。その後プロセッシングユニットCPU_01はスピンロック変数領域LOCK_FLDを図8の経路(f)で読むが、スピンロック変数領域LOCK_FLDのカレントユニット番号CURRENT_CPU_IDが“00”であり自CPU_IDの“01”と等しくないので、図4のステップS14、S15を通るループを回る(スピンする)。プロセッシングユニットCPU_00はループを回ってカレントユニット番号CURRENT_CPU_IDが自CPU_IDの“01”に等しくなるのを待っている。 When the processing unit CPU_00 executes the function print in the Line_3 of the program Q, it takes time as described above, and during that time, the other three processing units CPU_01, CPU_10, and CPU_11 execute the function spinlock of the program. Among the processing units CPU_01, CPU_10, and CPU_11, the CPU_01 having the highest priority order acquires the bus right, but because the acquisition of the spin lock fails, step S13 in FIG. 4 is executed, and (d) and (d) in FIG. Atomic read-modify-write is executed in the path e). As a result, the contents of the spin lock variable area LOCK_FLD are changed as shown in FIG. That is, the ID “01” of the processing unit CPU_01 is registered in the first entry area FIFO_1st in the FIFO buffer BUFF, and the number of waiting entries FIFO_LENGTH becomes 01 (one). Thereafter, the processing unit CPU_01 reads the spin lock variable area LOCK_FLD through the path (f) in FIG. 8, but the current unit number CURRENT_CPU_ID of the spin lock variable area LOCK_FLD is “00” and is not equal to “01” of the own CPU_ID. A loop passing through steps S14 and S15 of 4 is performed (spin). The processing unit CPU_00 goes around the loop and waits for the current unit number CURRENT_CPU_ID to be equal to “01” of its own CPU_ID.
プロセッシングユニットCPU_10、CPU_11はプログラムQの関数spinlockを実行中であり、そのうち、優先順の高いプロセッシングユニットCPU_10がアトミックなリード・モディファイ・ライトを実行するバス権を取得し、図4のステップS13を実行し、図9の(g)、(h)の経路でアトミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDの内容は図9に示されるように、第2番目のエントリ領域FIFO_2ndにプロセッシングユニットCPU_10のID“10”が登録され、待ちエントリ数FIFO_LENGTHが10(2個)になる。その後プロセッシングユニットCPU_10はスピンロック変数領域LOCK_FLDを図9の経路(i)で読むが、カレントユニット番号CURRENT_CPU_IDが“00”であり、自CPU_IDの“10”に等しくないので、図4のステップS14、S15のループを回る(スピンする)。プロセッシングユニットCPU_10はループを回ってカレントユニット番号CURRENT_CPU_IDが自CPU_IDの“10”に等しくなるのを待っている。 The processing units CPU_10 and CPU_11 are executing the function spinlock of the program Q. Among them, the processing unit CPU_10 having a higher priority order acquires the bus right to execute the atomic read-modify-write, and executes step S13 in FIG. Then, atomic read-modify-write is executed along the paths (g) and (h) in FIG. As a result, as shown in FIG. 9, the content of the spin lock variable area LOCK_FLD is registered with the ID “10” of the processing unit CPU_10 in the second entry area FIFO_2nd and the number of waiting entries FIFO_LENGTH is 10 (two). Become. Thereafter, the processing unit CPU_10 reads the spin lock variable area LOCK_FLD through the path (i) in FIG. 9, but the current unit number CURRENT_CPU_ID is “00” and is not equal to “10” of its own CPU_ID. Rotate (spin) the loop of S15. The processing unit CPU_10 goes around the loop and waits for the current unit number CURRENT_CPU_ID to be equal to “10” of its own CPU_ID.
最後に残ったプロセッシングユニットCPU_11はプログラムQの関数spinlockを実行中であり、そのうち、アトミックなリード・モディファイ・ライトを実行するバス権を取得し、図4のステップS13を実行し、図10の(j)、(k)の経路でアトミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDの内容は図10に示されるように、第3番目のエントリ領域FIFO_3rdにプロセッシングユニットCPU_11のID“11”が登録され、待ちエントリ数FIFO_LENGTHが11(3個)になる。その後プロセッシングユニットCPU_11はスピンロック変数領域LOCK_FLDを図10の経路(m)で読むが、カレントユニット番号CURRENT_CPU_IDが“00”であり、自CPU_IDの“11”に等しくないので、図4のステップS14、S15のループを回る(スピンする)。プロセッシングユニットCPU_11はループを回ってカレントユニット番号CURRENT_CPU_IDが自CPU_IDの“11”に等しくなるのを待っている。 The last remaining processing unit CPU_11 is executing the function spinlock of the program Q. Among them, the bus right for executing the atomic read-modify-write is acquired, and step S13 in FIG. j) Atomic read-modify-write is executed along the path (k). As a result, as shown in FIG. 10, the contents of the spin lock variable area LOCK_FLD are registered with the ID “11” of the processing unit CPU_11 in the third entry area FIFO_3rd, and the waiting entry number FIFO_LENGTH is 11 (three). Become. Thereafter, the processing unit CPU_11 reads the spin lock variable area LOCK_FLD through the path (m) in FIG. 10, but the current unit number CURRENT_CPU_ID is “00” and is not equal to “11” of its own CPU_ID. Rotate (spin) the loop of S15. The processing unit CPU_11 goes around the loop and waits for the current unit number CURRENT_CPU_ID to be equal to “11” of its own CPU_ID.
プロセッシングユニットCPU_00はプログラムQのLine_3の関数printの実行を完了すると、Line_4の関数unlockのアンロック処理を実行し、周辺回路PRPHへの排他的アクセス権を解放、即ちスピンロックを解放する。プロセッシングユニットCPU_00は関数unlockの処理において待ちエントリ数FIFO_LENGTHが“0”でないので図5のステップS23を実行し、図11の(n)、(o)の経路でアドミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDの内容は図11のように書換えられる。即ち、カレントユニット番号CURRENT_CPU_IDに第1番目のエントリ領域FIFO_1stの値である“01”が転送され、FIFOバッファBUFFにおける待ち順を1つずつ繰り上げて、第2番目のエントリ領域FIFO_2ndの値“10”が第1番目のエントリ領域FIFO_1stにシフトされ、第3番目のエントリ領域FIFO_3rdの値“11”が第2番目のエントリ領域FIFO_2ndにシフトされ、最後に待ちエントリ数FIFO_LENGTHの値“11”から1を引いて“10”にする。第3番目のエントリ領域FIFO_3rdは空きとされる。 When the processing unit CPU_00 completes the execution of the function print of the Line_3 of the program Q, the processing unit CPU_00 executes the unlock processing of the function unlock of the Line_4, and releases the exclusive access right to the peripheral circuit PRPH, that is, releases the spin lock. The processing unit CPU_00 executes the step S23 of FIG. 5 because the number of waiting entries FIFO_LENGTH is not “0” in the process of the function unlock, and executes the admic read-modify-write through the paths (n) and (o) of FIG. To do. As a result, the contents of the spin lock variable area LOCK_FLD are rewritten as shown in FIG. That is, “01” which is the value of the first entry area FIFO_1st is transferred to the current unit number CURRENT_CPU_ID, the waiting order in the FIFO buffer BUFF is incremented by one, and the value “10” of the second entry area FIFO_2nd is transferred. Is shifted to the first entry area FIFO_1st, the value “11” of the third entry area FIFO_3rd is shifted to the second entry area FIFO_2nd, and finally the waiting entry number FIFO_LENGTH value “11” is set to 1. Pull to “10”. The third entry area FIFO_3rd is empty.
このとき、プロセッシングユニットCPU_01はスピンロック処理で図4のループの処理(ステップS14、S15)を行っているが、図11の処理により、カレントユニット番号CURRENT_CPU_IDがプロセッシングユニットCPU_01の自CPU_IDである“01”になったので、経路(f)によるスピンロック変数領域LOCK_FLDのリードによってそれを検出することにより、当該プロセッシングユニットCPU_01はスピンロック処理を完了してスピンロックを取得する。これによってプロセッシングユニットCPU_01は周辺回路PRPHへの排他的アクセス権を取得し、プログラムQのLine_3の処理を開始して、図12の経路(p)で周辺回路PRPHへ自CPU_IDの出力などを行う。 At this time, the processing unit CPU_01 performs the processing of the loop of FIG. 4 (steps S14 and S15) by the spin lock processing, but the current unit number CURRENT_CPU_ID is “01” which is the own CPU_ID of the processing unit CPU_01 by the processing of FIG. Therefore, the processing unit CPU_01 completes the spin lock process and acquires the spin lock by detecting it by reading the spin lock variable area LOCK_FLD through the path (f). As a result, the processing unit CPU_01 obtains the exclusive access right to the peripheral circuit PRPH, starts the processing of Line_3 of the program Q, and outputs its own CPU_ID to the peripheral circuit PRPH through the path (p) of FIG.
プロセッシングユニットCPU_10は経路(i)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“01”であり、自CPU_IDの“10”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。同じく、プロセッシングユニットCPU_11は経路(m)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“01”であり、自CPU_IDの“11”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。 The processing unit CPU_10 reads the spin lock variable area LOCK_FLD through the path (i), but the value of the current unit number CURRENT_CPU_ID is “01”, which is different from “10” of its own CPU_ID. The process (steps S14 and S15) is continued. Similarly, the processing unit CPU_11 reads the spin lock variable area LOCK_FLD through the path (m), but the value of the current unit number CURRENT_CPU_ID is “01”, which is different from “11” of its own CPU_ID. The loop processing (steps S14 and S15) is continued.
プロセッシングユニットCPU_00は前ステップに引き続きプログラムQのLine_5を実行し、Line_1のラベルLOOP_0へ戻り、Line_2の関数spinlockのスピンロック処理を実行する。スピンロック変数領域LOCK_FLDは初期値0x0000でないから、図4のステップS13の処理として、図12の経路(q)、(r)でアドミックなリード・モディファイ・ライトを実行し、それによって、スピンロック変数領域LOCK_FLDは図12のように書換えられる。即ち、第3番目のエントリ領域FIFO_3rdにに自CPU_IDの“00”が登録され、待ちエントリ数FIFO_LENGTHに1が加算されて“11”にされる。その後、プロセッシングユニットCPU_00は、ステップS14、S15のループを回る。 The processing unit CPU_00 executes Line_5 of the program Q following the previous step, returns to the label LOOP_0 of Line_1, and executes the spinlock process of the function spinlock of Line_2. Since the spin lock variable area LOCK_FLD is not the initial value 0x0000, the admic read-modify-write is executed in the paths (q) and (r) of FIG. 12 as the process of step S13 of FIG. The area LOCK_FLD is rewritten as shown in FIG. That is, “00” of its own CPU_ID is registered in the third entry area FIFO_3rd, and 1 is added to the waiting entry number FIFO_LENGTH to make “11”. Thereafter, the processing unit CPU_00 goes through the loop of steps S14 and S15.
プロセッシングユニットCPU_01はプログラムQのLine_3の関数printの実行を完了すると、Line_4の関数unlockのアンロック処理を実行し、周辺回路PRPHへの排他的アクセス権を解放、即ちスピンロックを解放する。プロセッシングユニットCPU_01は関数unlockの処理において待ちエントリ数FIFO_LENGTHが“0”でないので図5のステップS23を実行し、図13の(t)、(u)の経路でアドミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDの内容は図13のように書換えられる。即ち、カレントユニット番号CURRENT_CPU_IDに第1番目のエントリ領域FIFO_1stの値である“10”が転送され、FIFOバッファBUFFにおける待ち順を1つずつ繰り上げて、第2番目のエントリ領域FIFO_2ndの値“11”が第1番目のエントリ領域FIFO_1stにシフトされ、第3番目のエントリ領域FIFO_3rdの値“00”が第2番目のエントリ領域FIFO_2ndにシフトされ、最後に待ちエントリ数FIFO_LENGTHの値“11”から1を引いて“10”にする。第3番目のエントリ領域FIFO_3rdは空きとされる。 When the processing unit CPU_01 completes the execution of the function print of the Line_3 of the program Q, the processing unit CPU_01 executes the unlock processing of the function unlock of the Line_4 and releases the exclusive access right to the peripheral circuit PRPH, that is, releases the spin lock. The processing unit CPU_01 executes the step S23 of FIG. 5 because the number of waiting entries FIFO_LENGTH is not “0” in the process of the function unlock, and executes the admic read-modify-write through the paths (t) and (u) of FIG. To do. As a result, the contents of the spin lock variable area LOCK_FLD are rewritten as shown in FIG. That is, “10”, which is the value of the first entry area FIFO_1st, is transferred to the current unit number CURRENT_CPU_ID, the waiting order in the FIFO buffer BUFF is incremented by one, and the value “11” of the second entry area FIFO_2nd is transferred. Is shifted to the first entry area FIFO_1st, the value “00” of the third entry area FIFO_3rd is shifted to the second entry area FIFO_2nd, and finally the waiting entry number FIFO_LENGTH value “11” is set to 1. Pull to “10”. The third entry area FIFO_3rd is empty.
このとき、プロセッシングユニットCPU_10はスピンロック処理で図4のループの処理(ステップS14、S15)を行っているが、図13の処理により、カレントユニット番号CURRENT_CPU_IDがプロセッシングユニットCPU_10の自CPU_IDである“10”になったので、当該プロセッシングユニットCPU_10はスピンロック処理を完了してスピンロックを取得する。これによってプロセッシングユニットCPU_10は周辺回路PRPHへの排他的アクセス権を取得し、プログラムQのLine_3の処理を開始して、図14の経路(v)で周辺回路PRPHへ自CPU_IDの出力などを行う。 At this time, the processing unit CPU_10 performs the processing of the loop of FIG. 4 (steps S14 and S15) by the spin lock processing, but the current unit number CURRENT_CPU_ID is “10” which is the own CPU_ID of the processing unit CPU_10 by the processing of FIG. Therefore, the processing unit CPU_10 completes the spin lock process and acquires the spin lock. As a result, the processing unit CPU_10 acquires the exclusive access right to the peripheral circuit PRPH, starts the processing of Line_3 of the program Q, and outputs its own CPU_ID to the peripheral circuit PRPH through the path (v) of FIG.
プロセッシングユニットCPU_11は経路(m)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“10”であり、自CPU_IDの“11”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。同じく、プロセッシングユニットCPU_00は経路(s)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“10”であり、自CPU_IDの“00”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。 The processing unit CPU_11 reads the spin lock variable area LOCK_FLD through the path (m), but the value of the current unit number CURRENT_CPU_ID is “10”, which is different from “11” of its own CPU_ID. The process (steps S14 and S15) is continued. Similarly, the processing unit CPU_00 is reading the spin lock variable area LOCK_FLD in the path (s), but the value of the current unit number CURRENT_CPU_ID is “10”, which is different from “00” of its own CPU_ID. The loop processing (steps S14 and S15) is continued.
プロセッシングユニットCPU_01は前ステップに引き続きプログラムQのLine_5を実行し、Line_1のラベルLOOP_0へ戻り、Line_2の関数spinlockのスピンロック処理を実行する。スピンロック変数領域LOCK_FLDは初期値0x0000でないから、図4のステップS13の処理として、図14の経路(w)、(x)でアドミックなリード・モディファイ・ライトを実行し、それによって、スピンロック変数領域LOCK_FLDは図14のように書換えられる。即ち、第3番目のエントリ領域FIFO_3rdに自CPU_IDの“01”が登録され、待ちエントリ数FIFO_LENGTHに1が加算されて“11”にされる。その後、プロセッシングユニットCPU_01は、ステップS14、S15のループを回る。 The processing unit CPU_01 executes Line_5 of the program Q following the previous step, returns to the label LOOP_0 of Line_1, and executes the spinlock process of the function spinlock of Line_2. Since the spin lock variable area LOCK_FLD is not the initial value 0x0000, the admic read-modify-write is executed in the paths (w) and (x) of FIG. 14 as the process of step S13 of FIG. The area LOCK_FLD is rewritten as shown in FIG. That is, “01” of its own CPU_ID is registered in the third entry area FIFO_3rd, and 1 is added to the number of waiting entries FIFO_LENGTH to make “11”. Thereafter, the processing unit CPU_01 goes through the loop of steps S14 and S15.
プロセッシングユニットCPU_10はプログラムQのLine_3の関数printの実行を完了すると、Line_4の関数unlockのアンロック処理を実行し、周辺回路PRPHへの排他的アクセス権を解放、即ちスピンロックを解放する。プロセッシングユニットCPU_10は関数unlockの処理において待ちエントリ数FIFO_LENGTHが“0”でないので図5のステップS23を実行し、図15の(z)、(aa)の経路でアドミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDの内容は図15のように書換えられる。即ち、カレントユニット番号CURRENT_CPU_IDに第1番目のエントリ領域FIFO_1stの値である“11”が転送され、FIFOバッファBUFFにおける待ち順を1つずつ繰り上げて、第2番目のエントリ領域FIFO_2ndの値“00”が第1番目のエントリ領域FIFO_1stにシフトされ、第3番目のエントリ領域FIFO_3rdの値“01”が第2番目のエントリ領域FIFO_2ndにシフトされ、最後に待ちエントリ数FIFO_LENGTHの値“11”から1を引いて“10”にする。第3番目のエントリ領域FIFO_3rdは空きとされる。 When the processing unit CPU_10 completes the execution of the function print of the Line_3 of the program Q, the processing unit CPU_10 executes the unlock process of the function unlock of the Line_4, and releases the exclusive access right to the peripheral circuit PRPH, that is, releases the spin lock. The processing unit CPU_10 executes the step S23 of FIG. 5 because the number of waiting entries FIFO_LENGTH is not “0” in the process of the function unlock, and executes the admic read-modify-write along the paths (z) and (aa) of FIG. To do. As a result, the contents of the spin lock variable area LOCK_FLD are rewritten as shown in FIG. That is, “11”, which is the value of the first entry area FIFO_1st, is transferred to the current unit number CURRENT_CPU_ID, the waiting order in the FIFO buffer BUFF is incremented by one, and the value “00” of the second entry area FIFO_2nd Is shifted to the first entry area FIFO_1st, the value “01” of the third entry area FIFO_3rd is shifted to the second entry area FIFO_2nd, and finally, the value “11” from the value “11” of the waiting entry number FIFO_LENGTH is changed. Pull to “10”. The third entry area FIFO_3rd is empty.
このとき、プロセッシングユニットCPU_11はスピンロック処理で図4のループの処理(ステップS14、S15)を行っているが、図15の処理により、カレントユニット番号CURRENT_CPU_IDがプロセッシングユニットCPU_11の自CPU_IDである“11”になったので、当該プロセッシングユニットCPU_11はスピンロック処理を完了してスピンロックを取得する。これによってプロセッシングユニットCPU_11は周辺回路PRPHへの排他的アクセス権を取得し、プログラムQのLine_3の処理を開始して、図16の経路(ab)で周辺回路PRPHへ自CPU_IDの出力などを行う。 At this time, the processing unit CPU_11 performs the processing of the loop of FIG. 4 (steps S14 and S15) by the spin lock processing, but the current unit number CURRENT_CPU_ID is “11” which is the own CPU_ID of the processing unit CPU_11 by the processing of FIG. Therefore, the processing unit CPU_11 completes the spin lock process and acquires the spin lock. As a result, the processing unit CPU_11 acquires the exclusive access right to the peripheral circuit PRPH, starts the processing of Line_3 of the program Q, and outputs its own CPU_ID to the peripheral circuit PRPH through the path (ab) in FIG.
プロセッシングユニットCPU_00は経路(s)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“11”であり、自CPU_IDの“00”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。同じく、プロセッシングユニットCPU_01は経路(y)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“11”であり、自CPU_IDの“01”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。 The processing unit CPU_00 reads the spin lock variable area LOCK_FLD through the path (s), but the value of the current unit number CURRENT_CPU_ID is “11”, which is different from “00” of the own CPU_ID. The process (steps S14 and S15) is continued. Similarly, the processing unit CPU_01 reads the spin lock variable area LOCK_FLD through the path (y), but the value of the current unit number CURRENT_CPU_ID is “11”, which is different from “01” of the own CPU_ID. The loop processing (steps S14 and S15) is continued.
プロセッシングユニットCPU_10は前ステップに引き続きプログラムQのLine_5を実行し、Line_1のラベルLOOP_0へ戻り、Line_2の関数spinlockのスピンロック処理を実行する。スピンロック変数領域LOCK_FLDは初期値0x0000でないから、図4のステップS13の処理として、図16の経路(ac)、(ad)でアドミックなリード・モディファイ・ライトを実行し、それによって、スピンロック変数領域LOCK_FLDは図16のように書換えられる。即ち、第3番目のエントリ領域FIFO_3rdに自CPU_IDの“10”が登録され、待ちエントリ数FIFO_LENGTHに1が加算されて“11”にされる。その後、プロセッシングユニットCPU_10は、ステップS14、S15のループを回る。 The processing unit CPU_10 executes Line_5 of the program Q following the previous step, returns to the label LOOP_0 of Line_1, and executes spinlock processing of the function spinlock of Line_2. Since the spin lock variable area LOCK_FLD is not the initial value 0x0000, the admic read-modify-write is executed in the paths (ac) and (ad) of FIG. 16 as the process of step S13 of FIG. The area LOCK_FLD is rewritten as shown in FIG. That is, “10” of its own CPU_ID is registered in the third entry area FIFO_3rd, and 1 is added to the number of waiting entries FIFO_LENGTH to make “11”. Thereafter, the processing unit CPU_10 goes through a loop of steps S14 and S15.
プロセッシングユニットCPU_11はプログラムQのLine_3の関数printの実行を完了すると、Line_4の関数unlockのアンロック処理を実行し、周辺回路PRPHへの排他的アクセス権を解放、即ちスピンロックを解放する。プロセッシングユニットCPU_11は関数unlockの処理において待ちエントリ数FIFO_LENGTHが“0”でないので図5のステップS23を実行し、図17の(af)、(ag)の経路でアドミックなリード・モディファイ・ライトを実行する。その結果、スピンロック変数領域LOCK_FLDの内容は図17のように書換えられる。即ち、カレントユニット番号CURRENT_CPU_IDに第1番目のエントリ領域FIFO_1stの値である“00”が転送され、FIFOバッファBUFFにおける待ち順を1つずつ繰り上げて、第2番目のエントリ領域FIFO_2ndの値“01”が第1番目のエントリ領域FIFO_1stにシフトされ、第3番目のエントリ領域FIFO_3rdの値“10”が第2番目のエントリ領域FIFO_2ndにシフトされ、最後に待ちエントリ数FIFO_LENGTHの値“11”から1を引いて“10”にする。第3番目のエントリ領域FIFO_3rdは空きとされる。 When the processing unit CPU_11 completes the execution of the function print of the Line_3 of the program Q, the processing unit CPU_11 executes the unlock process of the function unlock of the Line_4, and releases the exclusive access right to the peripheral circuit PRPH, that is, releases the spin lock. The processing unit CPU_11 executes the step S23 of FIG. 5 because the number of waiting entries FIFO_LENGTH is not “0” in the process of the function unlock, and executes the admic read-modify-write along the paths (af) and (ag) of FIG. To do. As a result, the contents of the spin lock variable area LOCK_FLD are rewritten as shown in FIG. That is, “00”, which is the value of the first entry area FIFO_1st, is transferred to the current unit number CURRENT_CPU_ID, the waiting order in the FIFO buffer BUFF is incremented by one, and the value “01” of the second entry area FIFO_2nd Is shifted to the first entry area FIFO_1st, the value “10” of the third entry area FIFO_3rd is shifted to the second entry area FIFO_2nd, and finally the waiting entry number FIFO_LENGTH value “11” is set to 1. Pull to “10”. The third entry area FIFO_3rd is empty.
このとき、プロセッシングユニットCPU_00はスピンロック処理で図4のループの処理(ステップS14、S15)を行っているが、図17の処理により、カレントユニット番号CURRENT_CPU_IDがプロセッシングユニットCPU_00の自CPU_IDである“00”になったので、当該プロセッシングユニットCPU_00はスピンロック処理を完了してスピンロックを取得する。これによってプロセッシングユニットCPU_00は周辺回路PRPHへの排他的アクセス権を取得し、プログラムQのLine_3の処理を開始して、図18の経路(ah)で周辺回路PRPHへ自CPU_IDの出力などを行う。 At this time, the processing unit CPU_00 performs the processing of the loop of FIG. 4 (steps S14 and S15) by the spin lock processing, but the current unit number CURRENT_CPU_ID is “00” which is the own CPU_ID of the processing unit CPU_00 by the processing of FIG. Therefore, the processing unit CPU_00 completes the spin lock process and acquires the spin lock. As a result, the processing unit CPU_00 acquires the exclusive access right to the peripheral circuit PRPH, starts the processing of Line_3 of the program Q, and outputs its own CPU_ID to the peripheral circuit PRPH through the path (ah) in FIG.
プロセッシングユニットCPU_01は経路(y)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“00”であり、自CPU_IDの“01”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。同じく、プロセッシングユニットCPU_10は経路(ae)でスピンロック変数領域LOCK_FLDをリードしているがカレントユニット番号CURRENT_CPU_IDの値は“00”であり、自CPU_IDの“10”とは異なるので、その後も図4のループの処理(ステップS14、S15)を継続する。 The processing unit CPU_01 reads the spin lock variable area LOCK_FLD through the path (y), but the value of the current unit number CURRENT_CPU_ID is “00”, which is different from “01” of the own CPU_ID. The process (steps S14 and S15) is continued. Similarly, the processing unit CPU_10 reads the spin lock variable area LOCK_FLD through the path (ae), but the value of the current unit number CURRENT_CPU_ID is “00”, which is different from “10” of the own CPU_ID. The loop processing (steps S14 and S15) is continued.
プロセッシングユニットCPU_11は前ステップに引き続きプログラムQのLine_5を実行し、Line_1のラベルLOOP_0へ戻り、Line_2の関数spinlockのスピンロック処理を実行する。スピンロック変数領域LOCK_FLDは初期値0x0000でないから、図4のステップS13の処理として、図18の経路(ai)、(aj)でアドミックなリード・モディファイ・ライトを実行し、それによって、スピンロック変数領域LOCK_FLDは図18のように書換えられる。即ち、第3番目のエントリ領域FIFO_3rdに自CPU_IDの“11”が登録され、待ちエントリ数FIFO_LENGTHに1が加算されて“11”にされる。その後、プロセッシングユニットCPU_10は、ステップS14、S15のループを回る。 The processing unit CPU_11 executes Line_5 of the program Q following the previous step, returns to the label LOOP_0 of Line_1, and executes the spinlock processing of the function spinlock of Line_2. Since the spin lock variable area LOCK_FLD is not the initial value 0x0000, the admic read-modify-write is executed in the paths (ai) and (aj) in FIG. 18 as the processing of step S13 in FIG. The area LOCK_FLD is rewritten as shown in FIG. That is, “11” of its own CPU_ID is registered in the third entry area FIFO_3rd, and 1 is added to the number of waiting entries FIFO_LENGTH to make “11”. Thereafter, the processing unit CPU_10 goes through a loop of steps S14 and S15.
以下同様の処理が繰り返され、図7で説明したようにプロセッシングユニットCPU_00が周辺回路PRPHへの排他的アクセス権を取得し、図12で説明したようにプロセッシングユニットCPU_01が周辺回路PRPHへの排他的アクセス権を取得し、図14で説明したようにプロセッシングユニットCPU_10が周辺回路PRPHへの排他的アクセス権を取得し、図16で説明したようにプロセッシングユニットCPU_11が周辺回路PRPHへの排他的アクセス権を取得し、図18で説明したようにプロセッシングユニットCPU_00が周辺回路PRPHへの排他的アクセス権を取得するというように、プロセッシングユニットがスピンロックを取得しに行った順番にスピンロックが渡るようになる。飢餓状態(starvation)の問題は完全に解消され、予め決められたプロセッシングコア番号に基づいてラウンドロビン順にスピンロックが行き渡るものではないから、複数プロセッシングユニットがスピンロックを取得しに行った順番に公平にスピンロックを取得することができる。 Thereafter, the same processing is repeated, so that the processing unit CPU_00 acquires the exclusive access right to the peripheral circuit PRPH as described in FIG. 7, and the processing unit CPU_01 is exclusive to the peripheral circuit PRPH as described in FIG. The access right is acquired, the processing unit CPU_10 acquires the exclusive access right to the peripheral circuit PRPH as described in FIG. 14, and the processing unit CPU_11 as the exclusive access right to the peripheral circuit PRPH as described in FIG. 18 so that the processing unit CPU_00 acquires the exclusive access right to the peripheral circuit PRPH as described in FIG. 18, so that the spin locks are transferred in the order in which the processing unit went to acquire the spin lock. Become. The starvation problem is completely eliminated and spinlocks are not distributed in round-robin order based on a predetermined processing core number, so fairness is the order in which multiple processing units went to acquire spinlocks. Spin lock can be acquired.
《第2の実施の形態》
第2の実施の形態に係るデータ処理システムは、第1の実施の形態に係るデータ処理システムに対して、スピンロック変数領域LOCK_FLDの構成と、これを用いたスピンロック処理及びアンロック処理の手順とが相違される。以下その相違点を中心に説明する。
<< Second Embodiment >>
The data processing system according to the second embodiment is different from the data processing system according to the first embodiment in the configuration of the spin lock variable region LOCK_FLD and the procedure of spin lock processing and unlock processing using the same. Is different. Hereinafter, the difference will be mainly described.
図19には第2の実施の形態に係るデータ処理システムに用いられるスピンロック変数領域LOCK_FLDSが例示される。スピンロック変数領域LOCK_FLDSは上記同様にメモリMRYに形成され、例えば4個のプロセッシングユニットCPU_00〜CPU_11によって操作される。 FIG. 19 illustrates a spin lock variable area LOCK_FLDS used in the data processing system according to the second embodiment. The spin lock variable area LOCK_FLDS is formed in the memory MRY as described above, and is operated by, for example, four processing units CPU_00 to CPU_11.
スピンロック変数領域LOCK_FLDSは、例えば全部で32ビットの領域を有し、ビットB31−24にリングバッファRING_BUFF(RING_BUFF[0]〜RING_BUFF[3])、ビット17−16にボトムカウンタBOTTOM、ビットB9−8にトップカウンタTOP、及びビットB0にロックビットLOCK_BITが割当てられる。 The spin lock variable area LOCK_FLDS has, for example, a 32-bit area in total, the ring buffer RING_BUFF (RING_BUFF [0] to RING_BUFF [3]) in bits B31-24, the bottom counter BOTTOM, and bits B9− in bits 17-16. A top counter TOP is assigned to 8, and a lock bit LOCK_BIT is assigned to bit B0.
ロックビットLOCK_BITは “1”でスピンロックの取得状態を示し、“0”で当該ロックの解放状態を示す。 The lock bit LOCK_BIT is “1” indicating the acquisition state of the spin lock, and “0” indicates the release state of the lock.
リングバッファRING_BUFFは、4個のFIFOステージRING_BUFF[0]〜RING_BUFF[3]を有し、キューイングバッファとして利用される。トップカウンタTOPとボトムカウンタBOTTOMはリングバッファRING_BUFFをキューイングバッファとして機能させるためのFIFOステージのポインタである。特に制限されないが、トップカウンタTOP及びボトムカウンタBOTOMの初期値は“0”であり、“0”から“3”の間をラップアラウンドされる。トップカウンタTOPはリングバッファRING_BUFFにおけるキューイングの先頭のFIFOステージ(実際にはその番号0〜3)を指し、ボトムカウンタBOTTOMはリングバッファRING_BUFFにおけるキューイングの末尾のFIFOステージ(実際にはその番号0〜3)を指す。リングバッファRING_BUFFのキューイング動作については後で詳細に説明するが、初期値は共に“0”であり、ロック解放状態で最初にスピンロックが取得されたときスピンロックを取得したプロセッシングユニットの自CPU_IDを先頭のFIFOステージRING_BUFF[0]に格納し、その後に他のプロセッシングユニットがスピンロックの獲得に失敗したときは1インクリメントしたボトムカウンタBOTTOMの値が指すFIFOステージに当該他のプロセッシングユニットのCPU_IDを格納し、ロックを解放するときにリングバッファRING_BUFFにスピンロックを待っているプロセッシングユニットがあれば(TOPとBOTTOMが等しくなければ)トップカウンタTOPの値を1インクリメントし、ロックの獲得を待っているプロセッシングユニットはトップカウンタTOPが指すCPU_IDが自らのCPU_IDに一致したことをもってスピンロックを獲得する。インクリメントの演算手法は、特に制限されないが、元のカウンタの値を4で除算したときの余りとする。即ち、TOP=[(TOP+1)mod4]、BOTTOM=[(BOTTOM+1)mod4]とされ、例えばTOP=0のとき次のTOPは1になり、TOP=1のとき次のTOPは2になり、TOP=2のとき次のTOPは3になり、TOP=3のとき次のTOPは0になる。
The ring buffer RING_BUFF has four FIFO stages RING_BUFF [0] to RING_BUFF [3], and is used as a queuing buffer. The top counter TOP and the bottom counter BOTTOM are FIFO stage pointers for causing the ring buffer RING_BUFF to function as a queuing buffer. Although not particularly limited, the initial values of the top counter TOP and the bottom counter BOTOM are “0”, and “0” to “3” are wrapped around. The top counter TOP indicates the first queuing FIFO stage in the ring buffer RING_BUFF (actually its
次に、スピンロック変数領域LOCK_FLDSを用いたスピンロックの制御手順について具体例を説明する。図2で説明したのと同様に、共通リソースである周辺回路PRPHをアクセスするために夫々のプロセッシングユニットCPU_00〜CPU_11はプログラムQを並列に実行する。スピンロック変数領域LOCK_FLDSの初期化フローは図3で説明したのと同様であり、全ビット“0”に初期化される。 Next, a specific example of the spin lock control procedure using the spin lock variable region LOCK_FLDS will be described. As described with reference to FIG. 2, the respective processing units CPU_00 to CPU_11 execute the program Q in parallel in order to access the peripheral circuit PRPH which is a common resource. The initialization flow of the spin lock variable area LOCK_FLDS is the same as that described with reference to FIG. 3, and all bits are initialized to “0”.
図20には関数spinlockを実行したときのスピンロック処理の制御フローが示される。バス権を獲得したプロセッシングユニットはスピンロック変数領域LOCK_FLDSをリードして初期値であるかを判別する。すなわち、ロックビットLOCK_BITが“0”にされている(スピンロック状態が解放されている)か否かを判別する(S31)。スピンロック状態が解放されていることを判別したときは自らのプロセッシングユニットID(自CPU_ID)を初段のFIFOステージRING_BUFF[0]に格納し、且つ、前記ロックビットLOCK_BITを“1”に書換えて(S32)、スピンロック状態を取得する。スピンロック状態が解放されていないとき(スピンロックの取得に失敗したとき)は、1インクリメントしたボトムカウンタBOTTOMの値が指すFIFOステージに自らのプロセッシングユニットID(自CPU_ID)を格納する(S33)。このように、リングバッファRING_BUFFには最初にスピンロックを獲得したCPU_IDを先頭に、その後、スピンロックの獲得に失敗した順にそのプロセッシングユニットIDがキューイングされることになる。その後、スピンロックの獲得に失敗したプロセッシングユニットはトップカウンタTOPが指すFIFOステージのプロセッシングIDが自らのプロセッシングIDに一致されるのを待って(S34、S35)、要するに、リングバッファRING_BUFFに登録されている自らの順番が最先の順位に更新されるのを待ってスピンロックを取得することができる。 FIG. 20 shows a control flow of the spin lock process when the function spinlock is executed. The processing unit that has acquired the bus right reads the spin lock variable area LOCK_FLDS to determine whether it is the initial value. That is, it is determined whether or not the lock bit LOCK_BIT is set to “0” (the spin lock state is released) (S31). When it is determined that the spin lock state is released, its own processing unit ID (own CPU_ID) is stored in the first FIFO stage RING_BUFF [0], and the lock bit LOCK_BIT is rewritten to “1” ( S32), the spin lock state is acquired. When the spin lock state is not released (when acquisition of the spin lock has failed), its own processing unit ID (own CPU_ID) is stored in the FIFO stage indicated by the value of the bottom counter BOTTOM incremented by 1 (S33). Thus, the CPU_ID that first acquired the spin lock is queued in the ring buffer RING_BUFF, and then the processing unit IDs are queued in the order in which the spin lock acquisition failed. Thereafter, the processing unit that has failed to acquire the spin lock waits for the processing ID of the FIFO stage pointed to by the top counter TOP to be matched with its own processing ID (S34, S35). In short, it is registered in the ring buffer RING_BUFF. It is possible to acquire the spin lock after waiting for the order of the person who is present to be updated to the highest order.
前記ステップS31、S32、S33はアトミック処理とされ、当該プロセッシングユニットはステップS31、S32、S33の処理を完了するまでの間、スピンロック変数領域LOCK_FLDSに対するアクセス権を他のプロセッシングユニットに渡さない。プロセッシングユニットCPU_00〜CPU_11はそのようなリード・モディファイ・ライトによるアクセスをアトミック処理として実現するために用いることができるロード命令及びストア命令を命令セットに持つ。 Steps S31, S32, and S33 are atomic processes, and the processing unit does not pass the access right to the spin lock variable area LOCK_FLDS to other processing units until the processes of steps S31, S32, and S33 are completed. The processing units CPU_00 to CPU_11 have a load instruction and a store instruction in an instruction set that can be used to realize such read, modify, and write access as atomic processing.
図21には関数unlockを実行したときのアンロック処理の制御フローが示される。前記アンロック処理では、トップカウンタTOPの値とボトムカウンタBOTTOMの値をリードし、両者の値が一致するか否かによってスピンロックの獲得を待っているプロセッシングユニットがあるか否かを判別し(S41)、待っているものがなければスピンロック変数領域LOCK_FLDSを初期化して(S42)、スピンロックを解放する。待っているプロセッシングユニットがあれば、トップカウンタTOPの値を1インクリメントし、待ち順を一つ繰り上げ、アンロック処理を終る(S43)。ステップS43の処理が何回か行われることによって、スピンロックの取得に失敗したプロセッシングユニットの待ち順の順位の方向にトップカウンタTOPの値が繰り上げられていく。ステップS34で説明したように、スピンロックの獲得を待っているプロセッシングユニットはトップカウンタTOPが指すCPU_IDが自らのCPU_IDに一致したことをもってスピンロックを獲得することができる。 FIG. 21 shows a control flow of unlock processing when the function unlock is executed. In the unlocking process, the value of the top counter TOP and the value of the bottom counter BOTTOM are read, and it is determined whether or not there is a processing unit waiting for the acquisition of the spin lock depending on whether the two values match ( If there is nothing waiting, the spin lock variable area LOCK_FLDS is initialized (S42), and the spin lock is released. If there is a waiting processing unit, the value of the top counter TOP is incremented by 1, the waiting order is incremented by 1, and the unlocking process is terminated (S43). By performing the processing in step S43 several times, the value of the top counter TOP is incremented in the direction of the waiting order of the processing units that have failed to acquire the spin lock. As described in step S34, the processing unit waiting for the acquisition of the spin lock can acquire the spin lock when the CPU_ID pointed to by the top counter TOP matches its own CPU_ID.
以上のように、夫々のプロセッシングユニットCPU_00〜CPU_11は、スピンロックの取得に失敗したとき失敗した順番で当該プロセッシングユニットのIDをリングバッファRING_BUFFにキューイングし、キューイングされている自らの順番がトップカウンタTOPの更新(S43)により最先の順位にされるのを待ってスピンロックを取得し、取得したスピンロックを解放するときリングバッファRING_BUFFにキューイングされている夫々の待ち順の順位をトップカウンタTOPの更新(S43)により一つ最先方向にシフトして、他のプロセッシングユニットによるスピンロック獲得の機会を提供する。したがって、プロセッシングユニットがスピンロックを取得しに行った順番にスピンロックが渡るようになる。予め決められたプロセッシングユニット番号に基づいてラウンドロビン順にプロセッシングユニットにスピンロックが行き渡るものではないから、複数プロセッシングユニットがスピンロックを取得しに行った順番に公平にスピンロックを取得することができる。 As described above, each of the processing units CPU_00 to CPU_11 queues the IDs of the processing units in the ring buffer RING_BUFF in the order of failure when the spin lock acquisition fails, and the queued order of the processing units CPU_00 to CPU_11 is top. The spin lock is acquired after waiting for the counter TOP to be updated (S43) and the acquired spin lock is released. When releasing the acquired spin lock, the top ranks of the respective waiting orders queued in the ring buffer RING_BUFF are topped. By updating the counter TOP (S43), one shifts in the earliest direction to provide an opportunity for acquiring the spin lock by another processing unit. Accordingly, the spin locks are transferred in the order in which the processing unit went to acquire the spin lock. Since the spin locks are not distributed to the processing units in the round robin order based on the predetermined processing unit numbers, the spin locks can be acquired fairly in the order in which the plurality of processing units went to acquire the spin locks.
以上本発明者によってなされた発明を実施形態に基づいて具体的に説明したが、本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能であることは言うまでもない。 Although the invention made by the present inventor has been specifically described based on the embodiments, it is needless to say that the present invention is not limited thereto and can be variously modified without departing from the gist thereof.
例えば、図20のステップ31においてロックビットLOCK_BITが解放状態であるかを判別し、図20のステップS32において自CPU_IDの登録先をトップポインタTOPの値に従って行い、図21のステップ43においてスピンロック変数領域に対する初期化対象をロックビットLOCK_BITだけにしてもよい。また、プロセッシングユニットの数は4個に限定されず適宜の複数個であればよい。スピンロック変数領域のビット数及びロックビットなどのビット配置は適宜変更可能である。共有リソースの種類は何ら限定されず、メモリなどであってもよい。
For example, it is determined in
SYS データ処理装置
CPU_00〜CPU_11 プロセッシングユニット
PRPH リソース(共有リソース)としての周辺回路
MRY メモリ
LOCK_FLD スピンロック変数領域
BUFF FIFOバッファ
FIFO_1st〜FIFO_3rd エントリ領域
CURRENT_CPU_ID カレントユニット番号
FIFO_LENGTH 待ちエントリ数
LOCK_BIT ロックビット
LOCK_FLDS スピンロック変数領域
RING_BUFF リングバッファ
RING_BUFF[0]〜RING_BUFF[3] FIFOステージ
BOTTOM ボトムカウンタ
TOP トップカウンタ
SYS data processing device CPU_00 to CPU_11 Processing unit PRPH Peripheral circuit as a resource (shared resource) MRY memory LOCK_FLD Spin lock variable area BUFF FIFO buffer FIFO_1st to FIFO_3rd entry area CURRENT_CPU_ID Current unit number FIFO_LENTHCK LOCK_LENDLOCK TH CK RING_BUFF ring buffer RING_BUFF [0] to RING_BUFF [3] FIFO stage BOTTOM bottom counter TOP top counter
Claims (14)
前記スピンロック変数領域はスピンロックへの待ち順の登録領域を有し、
前記プロセッシングユニットは、スピンロックの取得を失敗したとき失敗した順番で当該プロセッシングユニット名を前記待ち順の登録領域に登録し、登録されている自らの順番が最先の順位に更新されるのを待ってスピンロックを取得し、取得したスピンロックを解放するとき前記待ち順の登録領域に登録されている夫々の待ち順の順位を一つ最先方向にシフトする、データ処理装置。 A data processing apparatus in which a plurality of processing units that share resources manipulate a spinlock variable area to acquire a spinlock,
The spin lock variable area has a registration area for waiting for spin lock,
The processing unit registers the processing unit names in the waiting order registration area in the order of failure when the spin lock acquisition fails, and the registered order of the processing unit is updated to the first order. A data processing apparatus that waits to acquire a spin lock, and shifts the order of each waiting order registered in the waiting order registration area in the earliest direction when releasing the acquired spin lock.
前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域を有し、
前記プロセッシングユニットは、前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して、それが最先に繰り上げられるのを待ってスピンロック状態を取得する、スピンロック処理と、前記スピンロック処理で取得したスピンロック状態を解放するときは待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げ、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する、アンロック処理と、を行なうデータ処理システム。 A data processing system having a plurality of processing units, a resource shared by the plurality of processing units, and a spin lock variable area operated by the plurality of processing units,
The spin lock variable area has a lock bit for indicating whether or not the resource can be used, and a waiting area registration area for holding the order of processing units waiting for the resource,
When the processing unit reads the lock bit and detects that the spin lock state is released, the processing unit operates the lock bit to acquire the spin lock state, and reads the lock bit to already spin lock. When it is detected that the state is acquired, the processing unit is registered in the registration area in the waiting order, and the spin lock state is acquired after waiting for it to be advanced first, When releasing the spin lock state acquired by spin lock processing, if there is a processing unit registered in the waiting order registration area and waiting, the waiting order is incremented by one, and if there is no waiting processing unit, the lock bit is operated. Data processing to release the spin lock state and unlock processing Stem.
前記スピンロック処理は、前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名をカレントユニット名保持領域に記録し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して、それが最先に繰り上げられるのを待ってスピンロック状態を取得する処理であり、
前記アンロック処理は、前記スピンロック処理で取得したスピンロック状態を解放するときは待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げて最先のプロセッシングユニット名でカレントユニット名保持領域を書換え、待っているプロセッシングユニットがなければスピンロック変数領域を初期化してスピンロック状態を解放する処理である、請求項3記載のデータ処理システム。 The spin lock variable area further includes a current unit name holding area indicating a processing unit that is currently acquiring the spin lock state,
In the spin lock process, when the lock bit is read and it is detected that the spin lock state is released, the spin lock state is obtained by operating the lock bit, and the current processing unit name is retained. When it is detected that the spin lock state has already been acquired by reading the lock bit and registering the processing unit in the waiting order registration area, It is a process to wait and acquire the spin lock state,
In the unlock process, when the spin lock state acquired in the spin lock process is released, if there is a processing unit that is registered and waiting in the registration area of the waiting order, the waiting process is incremented by one and the earliest processing unit 4. The data processing system according to claim 3, wherein the current unit name holding area is rewritten with a name, and if there is no waiting processing unit, the spin lock variable area is initialized and the spin lock state is released.
前記プロセッシングユニットは、待ち数保持領域が保持する数によって、待ち順の登録領域に登録されて待っているプロセッシングユニットの有無を判別する、請求項5記載のデータ処理システム。 The spin lock variable area further includes a wait number holding area for holding the number of processing units registered and waiting in the waiting order registration area,
The data processing system according to claim 5, wherein the processing unit determines whether there is a processing unit that is registered in the waiting registration area and is waiting based on the number held in the waiting number holding area.
前記スピンロック処理は、前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名を第1ポインタが指すエントリ領域に格納し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは第2ポインタの値を進めて当該第2ポインタの値が指すエントリ領域に当該プロセッシングユニット名を登録して、それが前記第1ポインタで指されるのを待ってスピンロック状態を取得する処理であり、
前記アンロック処理は、前記スピンロック処理で取得したスピンロック状態を解放するときは第1ポインタの値が第2ポインタの値に等しくなければ第1ポインタの値を進め、待っているプロセッシングユニットがなければスピンロック変数領域を初期化してスピンロック状態を解放する処理である、請求項3記載のデータ処理システム。 The waiting-order registration area has a number of entry areas corresponding to the number of the plurality of processing units, a first pointer indicating the address of the entry area, and a second pointer indicating the address of the entry area. And
In the spin lock process, when it is detected that the spin lock state is released by reading the lock bit, the spin lock state is obtained by operating the lock bit, and the name of the processing unit is indicated by the first pointer. When the lock bit is read and it is detected that the spin lock state has already been acquired by reading the lock bit, the value of the second pointer is advanced to the entry area pointed to by the value of the second pointer. A process of registering a unit name, waiting for it to be pointed by the first pointer, and acquiring a spin lock state;
The unlock process advances the value of the first pointer if the value of the first pointer is not equal to the value of the second pointer when releasing the spin lock state acquired in the spin lock process, and the processing unit waiting 4. The data processing system according to claim 3, which is a process for initializing a spin lock variable area and releasing a spin lock state if there is not.
前記スピンロック変数領域はスピンロック変数の予約域である待ち順の登録領域を有し、
スピンロックの取得を失敗したとき失敗した順番にプロセッシングユニット名を前記待ち順の登録領域に登録し、最先に予約登録されているプロセッシングユニットに次のスピンロックを取得させる、データ処理方法。 A data processing method in which a plurality of processing units sharing a resource manipulate a spinlock variable area to acquire a spinlock,
The spinlock variable area has a waiting-order registration area that is a reserved area for spinlock variables;
A data processing method for registering processing unit names in the waiting order registration area in the order of failure when acquisition of a spin lock fails, and causing a processing unit registered for reservation first to acquire the next spin lock.
前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域を有し、
前記スピンロック処理は、前記プロセッシングユニットが前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して、それが最先に繰り上げられるのを待ってスピンロック状態を取得する処理であり、
前記アンロック処理は、取得したスピンロック状態を解放するとき待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げ、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する処理である、データ処理方法。 A data processing method in which a plurality of processing units sharing a resource operate a spin lock variable area to perform spin lock processing and unlock processing,
The spin lock variable area has a lock bit for indicating whether or not the resource can be used, and a waiting area registration area for holding the order of processing units waiting for the resource,
In the spin lock process, when the processing unit reads the lock bit and detects that the spin lock state is released, the spin unit operates the lock bit to acquire the spin lock state and reads the lock bit. When it is detected that the spin lock state has already been acquired, the processing unit is registered in the registration area in the waiting order, and the process of acquiring the spin lock state after waiting for it to be advanced first. Yes,
In the unlock process, when the acquired spin lock state is released, if there is a waiting processing unit registered in the waiting order registration area, the waiting order is incremented by one, and if there is no waiting processing unit, the lock bit is set. A data processing method that is a process of operating to release a spin lock state.
前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域と、スピンロック状態を現在取得しているプロセッシングユニットを示すカレントユニット名保持領域と、を有し、
前記スピンロック処理は、前記プロセッシングユニットが前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名をカレントユニット名保持領域に記録し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは当該プロセッシングユニットを待ち順の登録領域に登録して、それが最先に繰り上げられるのを待ってスピンロック状態を取得する処理であり、
前記アンロック処理は、取得したスピンロック状態を解放するときは待ち順の登録領域に登録されて待っているプロセッシングユニットがあれば待ち順を一つ繰り上げて最先のプロセッシングユニット名でカレントユニット名保持領域を書換え、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する処理である、データ処理方法。 A data processing method in which a plurality of processing units sharing a resource operate a spin lock variable area to perform spin lock processing and unlock processing,
The spin lock variable area includes a lock bit for indicating whether or not the resource can be used, a registration area in a waiting order for holding an order of processing units waiting for the resource, and a spin lock state. A current unit name holding area indicating the processing unit currently acquiring
In the spin lock process, when the processing unit reads the lock bit and detects that the spin lock state is released, the spin lock state is manipulated to acquire the spin lock state, and the processing unit name is changed. When recording the current unit name holding area and detecting that the spin lock state has already been acquired by reading the lock bit, the processing unit is registered in the waiting order registration area, It is a process to acquire the spin lock state after waiting for it to be raised,
In the unlock process, when the acquired spin lock state is released, if there is a waiting processing unit registered in the waiting order registration area, the waiting unit is incremented by one and the current unit name is the first processing unit name. A data processing method, which is a process of rewriting a holding area and operating a lock bit to release a spin lock state if there is no processing unit waiting.
前記スピンロック変数領域は、前記リソースの利用が可能か否かを示すためのロックビット、前記リソースの利用を待っているプロセッシングユニットの順番を保持するための待ち順の登録領域を有し、
前記待ち順の登録領域は前記複数個のプロセッシングユニットの数に相当する数のエントリ領域と、前記エントリ領域のアドレスを指す第1ポインタと、前記エントリ領域のアドレスを指す第2ポインタと、を有し、
前記スピンロック処理は、前記プロセッシングユニットが前記ロックビットをリードしてスピンロック状態が解放されていることを検出したときは前記ロックビットを操作してスピンロック状態を取得し且つ当該プロセッシングユニット名を第1ポインタが指すエントリ領域に格納し、前記ロックビットをリードして既にスピンロック状態が取得されていることを検知したときは第2ポインタの値を進めて当該第2ポインタの値が指すエントリ領域に当該プロセッシングユニット名を登録して、それが前記第1ポインタで指されるのを待ってスピンロック状態を取得する処理であり、
前記アンロック処理は、取得したスピンロック状態を解放するときは第1ポインタの値が第2ポインタの値に等しくなければ第1ポインタの値を進め、待っているプロセッシングユニットがなければロックビットを操作してスピンロック状態を解放する処理である、データ処理方法。 A data processing method in which a plurality of processing units sharing a resource operate a spin lock variable area to perform spin lock processing and unlock processing,
The spin lock variable area has a lock bit for indicating whether or not the resource can be used, and a waiting area registration area for holding the order of processing units waiting for the resource,
The waiting-order registration area has a number of entry areas corresponding to the number of the plurality of processing units, a first pointer indicating the address of the entry area, and a second pointer indicating the address of the entry area. And
In the spin lock process, when the processing unit reads the lock bit and detects that the spin lock state is released, the spin lock state is manipulated to acquire the spin lock state, and the processing unit name is changed. The entry stored in the entry area pointed to by the first pointer and reading the lock bit and detecting that the spin lock state has already been acquired, advances the value of the second pointer to indicate the entry pointed to by the value of the second pointer Registering the processing unit name in the area, waiting for it to be pointed by the first pointer, and obtaining a spin lock state;
In the unlock process, when the acquired spin lock state is released, the value of the first pointer is advanced if the value of the first pointer is not equal to the value of the second pointer, and the lock bit is set if there is no processing unit waiting. A data processing method that is a process of operating to release a spin lock state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009288923A JP2011129024A (en) | 2009-12-21 | 2009-12-21 | Data processing system and data processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009288923A JP2011129024A (en) | 2009-12-21 | 2009-12-21 | Data processing system and data processing method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2011129024A true JP2011129024A (en) | 2011-06-30 |
Family
ID=44291526
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009288923A Pending JP2011129024A (en) | 2009-12-21 | 2009-12-21 | Data processing system and data processing method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2011129024A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015022626A (en) * | 2013-07-22 | 2015-02-02 | 富士通株式会社 | Processing order control device, processing order control method, and processing order control program |
JP2016502212A (en) * | 2012-12-20 | 2016-01-21 | オラクル・インターナショナル・コーポレイション | System and method for implementing a NUMA aware statistics counter |
CN112188610A (en) * | 2020-08-18 | 2021-01-05 | 天津七所精密机电技术有限公司 | Burst intensive data fusion processing and high-precision synchronization device and method |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0355656A (en) * | 1989-07-24 | 1991-03-11 | Nec Corp | Spin lock control system |
JPH064322A (en) * | 1992-03-31 | 1994-01-14 | Internatl Business Mach Corp <Ibm> | Method for serializing interruption of process- level programming |
JPH0612394A (en) * | 1992-06-25 | 1994-01-21 | Hitachi Ltd | Process schedule method |
JPH07319716A (en) * | 1994-05-23 | 1995-12-08 | Hitachi Ltd | Exclusive control method of computer system resources |
JPH11259430A (en) * | 1998-03-13 | 1999-09-24 | Hitachi Ltd | Multiprocessor exclusive control method and control device |
JP2001084235A (en) * | 1999-09-10 | 2001-03-30 | Nec Corp | Exclusive control method using lock particle size satistical information and computer-readable recording medium with program recorded therein |
JP2002149480A (en) * | 2000-11-16 | 2002-05-24 | Matsushita Electric Ind Co Ltd | Exclusive control method |
US20030221071A1 (en) * | 2002-05-21 | 2003-11-27 | Mckenney Paul E. | Spinlock for shared memory |
-
2009
- 2009-12-21 JP JP2009288923A patent/JP2011129024A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0355656A (en) * | 1989-07-24 | 1991-03-11 | Nec Corp | Spin lock control system |
JPH064322A (en) * | 1992-03-31 | 1994-01-14 | Internatl Business Mach Corp <Ibm> | Method for serializing interruption of process- level programming |
JPH0612394A (en) * | 1992-06-25 | 1994-01-21 | Hitachi Ltd | Process schedule method |
JPH07319716A (en) * | 1994-05-23 | 1995-12-08 | Hitachi Ltd | Exclusive control method of computer system resources |
JPH11259430A (en) * | 1998-03-13 | 1999-09-24 | Hitachi Ltd | Multiprocessor exclusive control method and control device |
JP2001084235A (en) * | 1999-09-10 | 2001-03-30 | Nec Corp | Exclusive control method using lock particle size satistical information and computer-readable recording medium with program recorded therein |
JP2002149480A (en) * | 2000-11-16 | 2002-05-24 | Matsushita Electric Ind Co Ltd | Exclusive control method |
US20030221071A1 (en) * | 2002-05-21 | 2003-11-27 | Mckenney Paul E. | Spinlock for shared memory |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016502212A (en) * | 2012-12-20 | 2016-01-21 | オラクル・インターナショナル・コーポレイション | System and method for implementing a NUMA aware statistics counter |
CN105190560B (en) * | 2012-12-20 | 2018-12-11 | 甲骨文国际公司 | System and method for implementing NUMA aware statistics counters |
JP2015022626A (en) * | 2013-07-22 | 2015-02-02 | 富士通株式会社 | Processing order control device, processing order control method, and processing order control program |
CN112188610A (en) * | 2020-08-18 | 2021-01-05 | 天津七所精密机电技术有限公司 | Burst intensive data fusion processing and high-precision synchronization device and method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2511588B2 (en) | Data processing network, method for acquiring lock and serialization device | |
US7802032B2 (en) | Concurrent, non-blocking, lock-free queue and method, apparatus, and computer program product for implementing same | |
US8595729B2 (en) | Managing sequenced lock requests | |
US8375390B2 (en) | Scheduling method and scheduling apparatus | |
US20100325327A1 (en) | Programmable arbitration device and method therefor | |
US10331500B2 (en) | Managing fairness for lock and unlock operations using operation prioritization | |
TW201227521A (en) | Non-blocking wait-free data-parallel scheduler | |
JP2002007116A (en) | High priority superscalar microprocessor priority tracking method and apparatus in out-of-order instruction shelf | |
JP4248661B2 (en) | Bus bridge | |
JP2011129024A (en) | Data processing system and data processing method | |
JP2007299128A (en) | Interrupt control circuit and interruption control method | |
JP4814653B2 (en) | Reordering device | |
JP4206653B2 (en) | Task scheduling system and method, program | |
US7257681B2 (en) | Maintaining entity order with gate managers | |
JP7346649B2 (en) | Synchronous control system and method | |
WO2000033175A2 (en) | Method for increasing efficiency of multiprocessing systems | |
JP5553685B2 (en) | Information processing apparatus and information processing method | |
JP2011028343A (en) | Processor and data transfer method | |
CN101739341A (en) | System having processor and i/o controller | |
Chang et al. | On deadlock problem of on-chip buses supporting out-of-order transactions | |
EP1262870A1 (en) | Use of an atomic swap instruction for a shared queue | |
JP5240619B2 (en) | Semiconductor integrated circuit and data transfer control method in semiconductor integrated circuit | |
JPH04507019A (en) | Non-busy standby resource control | |
JP2011248469A (en) | Information processing apparatus and information processing method | |
JP2004038767A (en) | Bus arbitration device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20120808 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130904 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130912 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20131024 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20140313 |