JP2952896B2 - Shared memory access method in multitask multiprocessor system - Google Patents

Shared memory access method in multitask multiprocessor system

Info

Publication number
JP2952896B2
JP2952896B2 JP19176189A JP19176189A JP2952896B2 JP 2952896 B2 JP2952896 B2 JP 2952896B2 JP 19176189 A JP19176189 A JP 19176189A JP 19176189 A JP19176189 A JP 19176189A JP 2952896 B2 JP2952896 B2 JP 2952896B2
Authority
JP
Japan
Prior art keywords
processor
shared memory
circuit
task
lock flag
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.)
Expired - Fee Related
Application number
JP19176189A
Other languages
Japanese (ja)
Other versions
JPH0355657A (en
Inventor
英二 鬼頭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
Nippon Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP19176189A priority Critical patent/JP2952896B2/en
Publication of JPH0355657A publication Critical patent/JPH0355657A/en
Application granted granted Critical
Publication of JP2952896B2 publication Critical patent/JP2952896B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、マルチタスク・マルチプロセッサシステム
における共有メモリアクセス方式に関するものである。
Description: BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a shared memory access method in a multitask multiprocessor system.

〔従来の技術〕[Conventional technology]

システム全体の処理能力を高める為に、システムを同
レベルの複数のプロセッサで構成し且つ各々のプロセッ
サ上で複数のタスクを並行して動作させるようにしたマ
ルチタスク・マルチプロセッサシステムにおいては、一
般的に共有メモリを備えており、各プロセッサは共通バ
スを介してその共有メモリをアクセスすることができる
ように構成されている。そして、複数のプロセッサによ
る共有メモリ上の同一データに対する同時更新等による
矛盾を回避する為の共有メモリアクセス方式としては、
従来、ロックフラグを使用した以下のような方式を採用
していた。
In order to increase the processing capacity of the entire system, a multi-task multi-processor system in which the system is constituted by a plurality of processors of the same level and a plurality of tasks are operated in parallel on each processor, is generally used. Are provided with a shared memory, and each processor is configured to be able to access the shared memory via a common bus. Then, as a shared memory access method for avoiding inconsistency due to simultaneous updating of the same data on the shared memory by a plurality of processors,
Conventionally, the following method using a lock flag has been adopted.

先ず、或るプロセッサ上で動作するタスクが共有メモ
リ上のデータの更新等を行おうとする場合、そのプロセ
ッサは共通バスを介して例えば共有メモリ上に設けられ
たロックフラグの値を読み出し、それがそのデータの非
占有中を示すオフ値であれば共通バスを介してそのロッ
クフラグに占有中を示すオン値を書き込んでから即ちロ
ックを取得してからデータへのアクセスを行い、このア
クセス終了後に共通バスを介してそのロックフラグをア
クセスしてオフ値に書き戻す。他方、ロックフラグの値
を読み出したときそれがオン値であれば、他のプロセッ
サがその共有メモリ上のデータのアクセスを行っている
ので、そのプロセッサは、(1)ロックフラグのスキャ
ン動作即ちロックフラグの値を連続して読み出す動作
を、ロックフラグがオフ値になるまで続けるか、或い
は、(2)或る定められた一定時間だけウェイトした後
にロックフラグの値を読み出す動作を、ロックフラグが
オフ値になるまで繰り返す。そして、これら(1),
(2)の動作にてロックフラグがオフ値になったことを
検出すると、それをオン値に置き換えて共有メモリに対
してアクセスを行う。
First, when a task operating on a certain processor attempts to update data on the shared memory or the like, the processor reads the value of a lock flag provided on the shared memory via the common bus, and reads the value of the lock flag. If it is an off value indicating that the data is not occupied, access to the data is performed after writing an on value indicating that the data is occupied to the lock flag via the common bus, that is, acquiring the lock, and after the access is completed, The lock flag is accessed via the common bus and written back to the off value. On the other hand, if the value of the lock flag is ON when the value is read, the other processor is accessing the data on the shared memory. The operation of continuously reading the value of the flag is continued until the lock flag becomes an off value, or (2) the operation of reading the value of the lock flag after waiting for a certain fixed time is performed by the lock flag. Repeat until off value. And these (1),
When detecting that the lock flag has become an off value in the operation (2), the lock flag is replaced with an on value to access the shared memory.

〔発明が解決しようとする課題〕[Problems to be solved by the invention]

上述した従来の共有メモリアクセス方式は、共有メモ
リ上のデータに対する同時更新等を防止する面では問題
はなかったが、システムの処理能力の面では次のような
問題があった。
The conventional shared memory access method described above has no problem in preventing simultaneous updating of data in the shared memory, but has the following problem in terms of system processing capability.

ロックフラグがオンされていた場合に、ロックフラ
グをスキャンする方式(1)では、プロセッサの能力が
スキャンに占有されてしまい、マルチタスクとしての能
力を活かし切れない。
In the method (1) of scanning the lock flag when the lock flag is ON, the capability of the processor is occupied by the scan, and the capability as a multitask cannot be fully utilized.

同様にロックフラグがオンされていた場合に、一定
時間ウェイトして再度トライする方式(2)では、いく
ら速くても、ウェイトしている時間内にロックを取得す
ることはできず、速やかにロックを取得してデータへの
アクセスを行うことが困難になる。
Similarly, when the lock flag is on, the system waits for a certain time and tries again (2). And it is difficult to access the data.

そこで本発明の目的は、ロックフラグがオンされてい
た場合、プロセッサの処理能力を低下させることなく、
最短時間でロックを取得して共有メモリ上のデータに対
するアクセスを行うことができるようにすることにあ
る。
Therefore, an object of the present invention is to reduce the processing capability of the processor when the lock flag is on,
An object of the present invention is to acquire a lock in a shortest time and access data on a shared memory.

〔課題を解決するための手段〕 本発明は上記の目的を達成するために、各々複数のタ
スクが稼動する複数のプロセッサと、これら複数のプロ
セッサに共通バスを介して接続された共有メモリとを含
み、この共有メモリ上のデータに対する排他制御を前記
共通バスを介して各プロセッサよりアクセス可能なロッ
クフラグを用いて行うマルチタスク・マルチプロセッサ
システムにおいて、プロセッサから設定されたデータを
保持するラッチ回路と、このラッチ回路に保持されたデ
ータと前記共通バス上の書込み時のアドレスとを比較す
る比較回路と、この比較回路から一致信号が出力された
ときプロセッサに割込を発生すると共に前記ラッチ回路
にリセット信号を出力する割込回路とを含む付加回路
を、各プロセッサ対応に設け、各プロセッサは、或るタ
スクの処理において前記共通バスを介して読み出した前
記ロックフラグの値が占有中を示していた場合、自プロ
セッサ対応の前記付加回路内の前記ラッチ回路に前記ロ
ックフラグのアドレスを設定した後に前記タスクをウェ
イト状態にして他のタスクの実行を行い、自プロセッサ
対応の前記付加回路内の前記割込回路から割込が発生す
ることにより前記ウェイト状態にしたタスクを実行可能
状態とする。
Means for Solving the Problems In order to achieve the above object, the present invention comprises a plurality of processors each running a plurality of tasks, and a shared memory connected to the plurality of processors via a common bus. A multi-task multi-processor system for performing exclusive control on data on the shared memory by using a lock flag accessible from each processor via the common bus; and a latch circuit for holding data set by the processor. A comparison circuit for comparing the data held in the latch circuit with an address at the time of writing on the common bus, and generating an interrupt to the processor when a match signal is output from the comparison circuit; An additional circuit including an interrupt circuit for outputting a reset signal is provided for each processor. If the value of the lock flag read via the common bus in the processing of a certain task indicates that the processor is occupied, the address of the lock flag is set in the latch circuit in the additional circuit corresponding to the own processor. After that, the task is put into a wait state, another task is executed, and the interrupted circuit in the additional circuit corresponding to the own processor causes the task in the wait state to be in an executable state.

〔作用〕[Action]

本発明のマルチタスク・マルチプロセッサシステムに
おける共有メモリアクセス方式においては、各プロセッ
サは、或るタスクの処理において共通バスを介して読み
出したロックフラグの値が占有中を示している場合、自
プロセッサ対応の付加回路内のラッチ回路にロックフラ
グのアドレスを設定した後にそのタスクをウェイト状態
にして他のタスクの実行を行い、上記ロックフラグのア
ドレスが設定された付加回路内の比較回路は、そのアド
レスと共通バス上の書込み時のアドレスとを比較し始め
る。その後、他のプロセッサが共有メモリ上のデータに
対するアクセスを終了しロックフラグに非占有中に相当
する値を書き込む為に共通バスにロックフラグのアドレ
スを出力すると、上記の付加回路内の比較回路で比較一
致が検出されて割込回路から対応するプロセッサに割込
が発生され、この割込を受けたプロセッサが前記ウェイ
ト状態にしたタスクを実行可能状態にする。また、割込
回路ラッチ回路にリセット信号を出力する。
In the shared memory access method in the multi-task multi-processor system of the present invention, each processor, if the value of the lock flag read via the common bus in the processing of a certain task indicates that the processor is occupied, After setting the address of the lock flag in the latch circuit in the additional circuit, the task is put into a wait state and another task is executed, and the comparison circuit in the additional circuit in which the address of the lock flag is set is assigned to the address. And compare it with the address at the time of writing on the common bus. Thereafter, when the other processor terminates the access to the data on the shared memory and outputs the address of the lock flag to the common bus in order to write the value corresponding to the non-occupied state to the lock flag, the comparison circuit in the additional circuit described above outputs When a comparison match is detected, an interrupt is generated from the interrupt circuit to the corresponding processor, and the processor that has received the interrupt makes the task in the wait state executable. Also, the reset signal is output to the interrupt circuit latch circuit.

〔実施例〕〔Example〕

次に、本発明の実施例について図面を参照して詳細に
説明する。
Next, embodiments of the present invention will be described in detail with reference to the drawings.

第1図は本発明の一実施例の要部ブロック図であり、
各々複数のタスクが稼動する複数の処理装置1,2と、こ
れらの処理装置1,2に共通バス3を介して接続された共
有メモリ4とを含み、共有メモリ4上のデータに対する
排他制御を共通バス3を介して各処理装置1,2よりアク
セス可能なロックフラグ例えば共有メモリ4上に設けら
れたロックフラグを用いて行うマルチタスク・マルチプ
ロセッサシステムに本発明を適用したものである。
FIG. 1 is a block diagram of a main part of an embodiment of the present invention.
It includes a plurality of processing devices 1 and 2 each running a plurality of tasks, and a shared memory 4 connected to these processing devices 1 and 2 via a common bus 3. Exclusive control of data on the shared memory 4 is performed. The present invention is applied to a multitasking multiprocessor system using a lock flag accessible from each of the processing devices 1 and 2 via the common bus 3, for example, a lock flag provided on the shared memory 4.

処理装置1は、第1図に示すように、プロセッサ10
と、プロセッサ10によって制御されプロセッサ10のバス
を共通バス3に接続するバスバッファ11と、プロセッサ
10の命令によってプロセッサ10から出されたデータを保
持するラッチ回路12と、共通バス3にデータの書込みに
かかるアドレスが出力された時にそのアドレス値とラッ
チ回路12に保持されたデータとを比較し一致することに
より一致信号を出力する比較回路13と、この比較回路13
から一致信号が出力されることによりプロセッサ10に対
し割込信号を発生すると共にラッチ回路12にリセット信
号を発生する割込回路14とを含んでいる。処理装置2も
処理装置1と同じ構成を有している。
As shown in FIG. 1, the processing device 1 includes a processor 10
A bus buffer 11 controlled by the processor 10 to connect the bus of the processor 10 to the common bus 3;
The latch circuit 12 holds the data output from the processor 10 by the instruction of 10, and compares the address value when the address for writing data is output to the common bus 3 with the data held in the latch circuit 12. A comparison circuit 13 that outputs a coincidence signal by matching,
And an interrupt circuit 14 for generating an interrupt signal to the processor 10 by outputting a coincidence signal from the processor 10 and generating a reset signal to the latch circuit 12. The processing device 2 also has the same configuration as the processing device 1.

第2図は処理装置1,2内におけるプロセッサの処理例
を示す流れ図であり、以下、各図を参照して本実施例の
動作を説明する。
FIG. 2 is a flowchart showing a processing example of the processor in the processing devices 1 and 2, and the operation of the present embodiment will be described below with reference to the drawings.

第1図において、処理装置1上のプロセッサ10は、或
るタスク処理において共有メモリ4のデータの更新処理
等を行う場合、第2図に示すようにそのデータにかかる
ロックフラグを調査し(ステップ51)、ロックフラグが
オフであればロックフラグをオンにし(ステップ54)、
そのデータの更新処理等を含むデータ処理を行う(ステ
ップ55)。
In FIG. 1, when performing a process of updating data in the shared memory 4 or the like in a certain task process, the processor 10 of the processing device 1 checks a lock flag concerning the data as shown in FIG. 51) If the lock flag is off, turn on the lock flag (step 54)
Data processing including the data update processing is performed (step 55).

他方、他の処理装置2がロックを取得している為にス
テップ51でロックフラグがオンであることを検知する
と、プロセッサ10はそのロックフラグのアドレスをラッ
チ回路12にセットし(ステップ52)、当該タスクをウェ
イト状態とする(ステップ53)。そして、実行可能状態
にある他のタスクを実行する。
On the other hand, when detecting that the lock flag is on in step 51 because the other processing device 2 has acquired the lock, the processor 10 sets the address of the lock flag in the latch circuit 12 (step 52), The task is put into a wait state (step 53). Then, another task in the executable state is executed.

その後、処理装置2がロックフラグをオフに書き換え
る処理の一環として共通バス3にロックフラグのアドレ
スを出力すると、そのアドレスとラッチ回路12に保持さ
れたアドレスとの一致が比較回路13において検出され、
割込回路14からプロセッサ10に対し割込信号が送出され
る。なお、このときラッチ回路12はリセットされる。
Thereafter, when the processing device 2 outputs the address of the lock flag to the common bus 3 as part of the process of rewriting the lock flag to off, the comparison circuit 13 detects a match between the address and the address held in the latch circuit 12, and
An interrupt signal is sent from the interrupt circuit 14 to the processor 10. At this time, the latch circuit 12 is reset.

プロセッサ10は割込回路14から割込信号が加えられる
と、第2図に示す割込処理に入り、上述のウェイト状態
にしたタスクをポストし(ステップ56)、実行可能状態
とする。そして、そのタスクが実行状態となると、プロ
セッサ10は第2図に示すように、ロックフラグをオンと
し(ステップ54)、データ処理を行う(ステップ55)。
When an interrupt signal is applied from the interrupt circuit 14, the processor 10 enters an interrupt process shown in FIG. 2, posts the task in the wait state described above (step 56), and sets the task in an executable state. When the task enters the execution state, the processor 10 turns on the lock flag (step 54) and performs data processing (step 55), as shown in FIG.

以上は処理装置1の動作であるが、処理装置2も同様
の動作を行うものである。
The above is the operation of the processing apparatus 1, but the processing apparatus 2 performs the same operation.

〔発明の効果〕〔The invention's effect〕

以上説明したように、本発明のマルチタスク・マルチ
プロセッサシステムにおける共有メモリアクセス方式に
おいては、各プロセッサ毎に、プロセッサから設定され
たデータと共通バス上の書込み時のアドレスとを比較し
一致することによりプロセッサに割込を発生する付加回
路を設け、各プロセッサは共有メモリ上のデータを処理
するときに既に他のプロセッサが占有していた場合は自
プロセッサ対応の付加回路にロックフラグのアドレスを
設定すると共に当該タスクを待ち状態にして別のタスク
を処理し、共有メモリ上のデータを占有中であった他の
プロセッサがその占有を解いた時点で発生する上記付加
回路からの割込を契機として上記待ち状態のタスクを実
行可能状態としているので、マルチタスクとしての能力
を十二分に活かすことができ、プロセッサの処理能力を
低下させることなく、最短時間でロックを取得して共有
メモリ上のデータに対するアクセスを行うことが可能と
なる。
As described above, in the shared memory access method in the multitask multiprocessor system of the present invention, for each processor, the data set by the processor and the address at the time of writing on the common bus are compared and matched. An additional circuit that generates an interrupt to the processor is provided.If each processor has already occupied another processor when processing data on the shared memory, the address of the lock flag is set in the additional circuit corresponding to its own processor. At the same time, the task is put into a waiting state, another task is processed, and the interrupt from the additional circuit generated when the other processor which has occupied the data on the shared memory releases the occupation. Since the above-mentioned tasks in the waiting state can be executed, the ability as a multitask can be fully utilized. Can be, without reducing the processing capacity of the processor, it is possible to perform access to data in the shared memory to get the lock in the shortest time.

【図面の簡単な説明】[Brief description of the drawings]

第1図は本発明の一実施例の要部ブロック図および、 第2図はプロセッサの処理例の流れ図である。 図において、 1,2……処理装置 3……共通バス 4……共有メモリ 10……プロセッサ 11……バスバッファ 12……ラッチ回路 13……比較回路 14……割込回路 FIG. 1 is a block diagram of a main part of an embodiment of the present invention, and FIG. 2 is a flowchart of a processing example of a processor. In the figure, 1, 2 processing unit 3 common bus 4 shared memory 10 processor 11 bus buffer 12 latch circuit 13 comparison circuit 14 interrupt circuit

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】各々複数のタスクが稼働する複数のプロセ
ッサと、該複数のプロセッサに共通バスを介して接続さ
れた共有メモリとを含み、該共有メモリ上のデータに対
する排他制御を前記共通バスを介して各プロセッサより
アクセス可能なロックフラグを用いて行うマルチタスク
・マルチプロセッサシステムにおいて、 プロセッサから設定されたデータを保持するラッチ回路
と、該ラッチ回路に保持されたデータと前記共通バス上
の書込み時のアドレスとを比較する比較回路と、該比較
回路から一致信号が出力されたときプロセッサに割込を
発生すると共に前記ラッチ回路にリセット信号を出力す
る割込回路とを含む付加回路を、前記各プロセッサ対応
に設け、 前記各プロセッサは、或るタスクの処理において前記共
通バスを介して読み出した前記ロックフラグの値が占有
中を示していた場合、自プロセッサ対応の前記付加回路
内の前記ラッチ回路に前記ロックフラグのアドレスを設
定した後に前記タスクをウェイト状態にして他のタスク
の実行を行い、自プロセッサ対応の前記付加回路内の前
記割込回路から割込が発生することにより前記ウェイト
状態にしたタスクを実行可能状態とすることを特徴とす
るマルチタスク・マルチプロセッサシステムにおける共
有メモリアクセス方式。
A plurality of processors each running a plurality of tasks; and a shared memory connected to the plurality of processors via a common bus, wherein exclusive control of data on the shared memory is performed by the common bus. A multi-task multi-processor system using a lock flag accessible from each processor through a latch circuit for holding data set by the processor, and writing the data held in the latch circuit and the data on the common bus An additional circuit including a comparison circuit that compares an address of the time and an interrupt circuit that generates an interrupt to a processor when a match signal is output from the comparison circuit and outputs a reset signal to the latch circuit. Provided for each processor, wherein each of the processors reads out via the common bus in processing of a certain task. If the value of the lock flag indicates occupancy, the task is set to a wait state after setting the address of the lock flag in the latch circuit in the additional circuit corresponding to the own processor, and execution of another task is performed. A shared memory access in a multitask multiprocessor system, wherein the task in the wait state is made executable by an interrupt from the interrupt circuit in the additional circuit corresponding to the own processor. method.
JP19176189A 1989-07-25 1989-07-25 Shared memory access method in multitask multiprocessor system Expired - Fee Related JP2952896B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP19176189A JP2952896B2 (en) 1989-07-25 1989-07-25 Shared memory access method in multitask multiprocessor system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP19176189A JP2952896B2 (en) 1989-07-25 1989-07-25 Shared memory access method in multitask multiprocessor system

Publications (2)

Publication Number Publication Date
JPH0355657A JPH0355657A (en) 1991-03-11
JP2952896B2 true JP2952896B2 (en) 1999-09-27

Family

ID=16280074

Family Applications (1)

Application Number Title Priority Date Filing Date
JP19176189A Expired - Fee Related JP2952896B2 (en) 1989-07-25 1989-07-25 Shared memory access method in multitask multiprocessor system

Country Status (1)

Country Link
JP (1) JP2952896B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11203254A (en) 1998-01-14 1999-07-30 Nec Corp Shared process control device and machine readable recording medium for storing program
JP5397546B2 (en) * 2010-07-27 2014-01-22 富士通株式会社 Multi-core processor system, control program, and control method
JP5621896B2 (en) * 2013-10-24 2014-11-12 富士通株式会社 Multiprocessor system, control program, and control method
CN115599459B (en) * 2022-12-13 2023-04-07 成都启英泰伦科技有限公司 Cross-power-domain multiprocessor operation device and communication method thereof

Also Published As

Publication number Publication date
JPH0355657A (en) 1991-03-11

Similar Documents

Publication Publication Date Title
JPH0354375B2 (en)
JP2952896B2 (en) Shared memory access method in multitask multiprocessor system
JP2000003302A (en) Method for controlling exclusive access of common memory
JPH0728748A (en) Bus control mechanism and computer system
JPS58107977A (en) Accessing system for storage device
JPS6257050A (en) Common memory device
JPH1011405A (en) Memory access conflict control system
JP2854066B2 (en) Multiprocessor system
JPH0679306B2 (en) Multiprocessor control method
JP2825589B2 (en) Bus control method
JPS62166464A (en) Contension control system for multiprocessor
JP3219422B2 (en) Cache memory control method
JPH03271859A (en) Information processor
JPH08249289A (en) Memory controller and its control method
JPH03293837A (en) Bus transfer control system
JPS6349815B2 (en)
JPH0192862A (en) Data processor
JPS63298555A (en) Shared memory control system
JPH05334233A (en) Data transferring device
JPS63155254A (en) Information processor
JPH07111711B2 (en) Processing end interrupt control system
JPH052523A (en) Access control device
JPH0581211A (en) Inter-processor communication system
JPH02231667A (en) Bus monitoring device
JPH0457145A (en) Multiprocessor system

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees