JPH03100837A - Detection system for shared data access - Google Patents
Detection system for shared data accessInfo
- Publication number
- JPH03100837A JPH03100837A JP1237187A JP23718789A JPH03100837A JP H03100837 A JPH03100837 A JP H03100837A JP 1237187 A JP1237187 A JP 1237187A JP 23718789 A JP23718789 A JP 23718789A JP H03100837 A JPH03100837 A JP H03100837A
- Authority
- JP
- Japan
- Prior art keywords
- access
- program
- shared
- access history
- variable
- 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
- 238000001514 detection method Methods 0.000 title claims description 10
- 238000000034 method Methods 0.000 claims description 27
- 238000010586 diagram Methods 0.000 description 8
- 238000011835 investigation Methods 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明はタスク間で共有するデータをアクセスする際に
行うべき排他制御の誤りを検出する共有データのアクセ
ス検出方式に関する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a shared data access detection method for detecting errors in exclusive control to be performed when accessing data shared between tasks.
マルチプロセッサシステムにおいて、利用者プログラム
の命令コードを複数のタスクに分割し、各タスクをマル
チプロセッサの各プロセッサに割り当てて並列処理プロ
グラムを実行させるようになっている場合に、従来、並
列処理プログラムの複数のタスクが共有するデータをア
クセスする際各タスクで排他制御処理、用のロック変数
を用意していた。すなわちこのロック変数に基づいて既
にロックされていたらアンロックされるまで待ってアン
ロックされた後にロックするロック手続きと、既にロッ
クされているものを解除するアンロック手続きとを使用
し、これによって、共有データ(共有変数とも呼ぶ)の
アクセスの際はロック−アンロックの手続きの中(ロッ
ク区間)でアクセスを行うようにし、各タスクで同時に
アクセスが行われないようにする排他制御の処理を利用
者プログラムの中で行なっていた。In a multiprocessor system, when the instruction code of a user program is divided into multiple tasks and each task is assigned to each processor of the multiprocessor to execute the parallel processing program, conventionally, the parallel processing program is When accessing data shared by multiple tasks, each task provided a lock variable for exclusive control processing. In other words, we use a lock procedure that waits until the lock is unlocked if it is already locked based on this lock variable, and then locks it after it is unlocked, and an unlock procedure that releases the lock that is already locked. When accessing shared data (also called shared variables), access is done during the lock-unlock procedure (lock section), and exclusive control processing is used to prevent simultaneous access by each task. It was carried out in the program.
このように、利用者プログラムの中で排他制御の処理を
行うようにする場合に、プログラムのミスによりロック
区間に入り忘れたりアンロックの手続き呼び出しの位置
が不正であったりすると各タスクで同時にアクセスが発
生し、プログラムの実行結果が正しくなかったり、実行
するたびに結果が異なるというような問題が発生するこ
とがあった。このような場合利用者は共有変数の排他制
御のバグによって問題が発生したことを知ることができ
ず、再実行してもタスク間の実行順序によっては同一の
結果が得られない場合もあるため問題の解決に多大の時
間がかかるという問題点があった。また共有変数のロッ
ク区間が正しいかどうかを調べる場合にも人手でソース
プログラムを調査し、タスク間の動作を検討して共有変
数のアクセスがどの様な順序で行われるかを調べなけれ
ばならず、プログラムの大きさによっては多大な労力を
必要とし、またアクセスの仕方が複雑なときには調査の
際に検討もれなどが発生し、プログラムのデバッグ効率
が悪いという欠点があった。In this way, when performing exclusive control processing in a user program, if a program error causes the program to forget to enter the lock section or call the unlock procedure at an incorrect position, each task may access the lock at the same time. This could cause problems such as incorrect program execution results or different results each time the program is executed. In this case, the user will not be able to know that a problem has occurred due to a bug in the exclusive control of shared variables, and even if the task is re-executed, the same result may not be obtained depending on the execution order of the tasks. The problem was that it took a lot of time to solve the problem. Also, when checking whether the lock interval of a shared variable is correct, it is necessary to manually examine the source program, consider the behavior between tasks, and check the order in which shared variables are accessed. However, depending on the size of the program, it requires a lot of effort, and if the access method is complicated, problems may be overlooked during investigation, resulting in poor program debugging efficiency.
本発明はこのような従来の欠点を改善したちので、その
目的は、利用者プログラムの動作を正確に観測すること
ができて、プログラムのデバッグ効率を向上させること
の可能な共有データのアクセス検出方式を提供すること
にある。The present invention improves these conventional drawbacks, and its purpose is to detect accesses to shared data that can accurately observe the behavior of user programs and improve program debugging efficiency. The goal is to provide a method.
本発明の共有データのアクセス検出方式は、利用者のソ
ースプログラムを読み込み、共有変数のアクセスが発生
するソース行を共有変数の読み込みおよび書き込みのア
クセス手続きの呼び出しに変更するプリプロセッサと、
当該アクセス手続きの処理を行うライブラリ手段と、ア
クセス手続きの処理された履歴を記憶しておくアクセス
ヒストリファイルと、アクセスヒストリファイルを読み
込んで任意の変数のアクセスされた順序関係を表示する
アクセスヒストリ表示手段とを有している。The shared data access detection method of the present invention includes a preprocessor that reads a user's source program and changes a source line where a shared variable access occurs to a call to a shared variable read and write access procedure;
A library means for processing the access procedure, an access history file for storing the history of the access procedure processing, and an access history display means for reading the access history file and displaying the order relationship in which arbitrary variables are accessed. It has
プリプロセッサでは、利用者のソースプログラムを読み
込み、共有変数のアクセスが発生するソー行を共有変数
の読み込みおよび書き込みのアクセス手続きの呼び出し
に変更し、ライブラリ手段では上記アクセス手段の処理
を行う。この際、アクセスヒストリファイルには、アク
セス手続きの処理された時間や実行アドレスなどの履歴
が記憶され、アクセスヒストリ表示手段では、このアク
セスヒストリファイルを読み込んで任意の変数のアクセ
スされた順序関係を表示する。The preprocessor reads the user's source program and changes the source line where shared variable access occurs to a call to an access procedure for reading and writing shared variables, and the library means processes the access means. At this time, the access history file stores a history such as the processing time and execution address of the access procedure, and the access history display means reads this access history file and displays the order relationship in which arbitrary variables are accessed. do.
以下、本発明の一実施例について図面を参照して詳細に
説明する。Hereinafter, one embodiment of the present invention will be described in detail with reference to the drawings.
第1図は本発明の一実施例のブロック図である。FIG. 1 is a block diagram of one embodiment of the present invention.
第1図において1は共有データのアクセス検出部、2は
プリプロセッサ、3はライブラリルーチン、4はアクセ
スヒストリ表示プログラム、5は入力ソースプログラム
、6は出力ソースプログラム、7はコンパイラ、8はオ
ブジェクトプログラム、9はリンカ、10はロードモジ
ュール、11はアクセスヒストリファイル、12は入力
装置、13はアクセスヒストリリストであって、本実施
例では、共有データのアクセス検出部1は、プリプロセ
ッサ2と、ライブラリルーチン3と、アクセスヒストリ
表示プログラム4とからなっている。In FIG. 1, 1 is a shared data access detection unit, 2 is a preprocessor, 3 is a library routine, 4 is an access history display program, 5 is an input source program, 6 is an output source program, 7 is a compiler, 8 is an object program, 9 is a linker, 10 is a load module, 11 is an access history file, 12 is an input device, and 13 is an access history list. In this embodiment, the shared data access detection unit 1 includes a preprocessor 2 and a library routine 3. and an access history display program 4.
プリプロセッサ2は入力ソースプログラム5の人力によ
って処理の対象となるすべてのサブルーチンやプログラ
ムの解析を行いその中で共有データとして宣言されてい
る変数のアクセスが行われている部分をライブラリルー
チンの手続き呼び出しの形に変換するようになっており
、このとき個々の共有データに対してそれぞれロック、
変数を宣言しライブラリルーチン3にパラメータとして
渡すようになっている。またプリプロセッサ2は処理の
結果として出力ソースプログラム6を生成するようにな
っている。The preprocessor 2 analyzes all the subroutines and programs to be processed using the input source program 5, and processes the parts where variables declared as shared data are accessed by calling the procedure of the library routine. At this time, locks and locks are applied to each individual piece of shared data.
Variables are declared and passed to library routine 3 as parameters. The preprocessor 2 also generates an output source program 6 as a result of the processing.
プリプロセッサ2が出力した出力ソースプログラム6は
コンパイラ7によってコンパイルされてオブジェクトプ
ログラム8が生成され、オブジェクトプログラム8をリ
ンクする際には、共有データのアクセス検出部1のライ
ブラリルーチン3がリンカ9によってロードモジュール
10に組み込まれるようになっている。リンカ9が出力
したロードモジュール10は利用者のプログラムであり
、これを実行するとプログラムの実行と同時にアクセス
ヒストリファイル11がライブラリルーチン3によって
出力され、共有データのアクセス検出部lのアクセスヒ
ストリ表示プログラム4はアクセスヒストリファイル1
1を入力し、入力装置12から入力したコマンドによっ
て共有変数のアクセスの順序関係をどのタクスがどの様
な順序でアクセスしたかという情報としてアクセスヒス
トリリスト13に出力するようになっている。The output source program 6 output by the preprocessor 2 is compiled by the compiler 7 to generate an object program 8, and when linking the object program 8, the library routine 3 of the shared data access detection unit 1 is converted into a load module by the linker 9. 10 will be included. The load module 10 output by the linker 9 is a user's program, and when this is executed, the access history file 11 is output by the library routine 3 at the same time as the program is executed, and the access history display program 4 of the shared data access detection unit 1 is output. is access history file 1
1 is input, and in response to a command input from the input device 12, the access order relationship of shared variables is output to the access history list 13 as information on which tasks accessed and in what order.
第2図はライブラリルーチンのインターフェイスの一例
を示す図である。FIG. 2 is a diagram showing an example of the library routine interface.
ライブラリルーチンは大別して共有変数への値の代入を
行うCOMWRTxと共有変数の参照を行うCOMRD
xとの2つの手続きがある。ここでXは変数の型とサイ
ズを示す値である。第2図では例としてREAL型4バ
イトの代入、参照のライブラリルーチンのインターフェ
イスが示されている。手続きCOMWRTR4は共有変
数へ値の代入を行う手続きである。COMWRTR4の
第1パラメータは代入を行う共有変数の名前であり、第
2パラメータは変数が配列であるかどうか、第3パラメ
ータは変数が配列のときの配列要素、第4パラメータは
ロック変数の名前、第5パラメータは代入する値である
。Library routines are broadly divided into COMWRTx, which assigns values to shared variables, and COMRD, which refers to shared variables.
There are two procedures with x. Here, X is a value indicating the type and size of the variable. FIG. 2 shows an interface of a library routine for REAL type 4-byte assignment and reference as an example. Procedure COMWRTR4 is a procedure for assigning a value to a shared variable. The first parameter of COMWRTR4 is the name of the shared variable to be assigned, the second parameter is whether the variable is an array, the third parameter is the array element if the variable is an array, the fourth parameter is the name of the lock variable, The fifth parameter is the value to be substituted.
手続きCOMRDR4は共有変数の参照を行う手続きで
あり、第1パラメータは参照する共有変数の名前、第2
パラメータは変数が配列であるかどうか、第3パラメー
タは変数が配列のときの配列要素、第4パラメータはロ
ック変数の名前である。参照したい値はこの手続きの戻
り値として返却されるようになっている。Procedure COMRDR4 is a procedure that refers to a shared variable, and the first parameter is the name of the shared variable to be referenced, and the second
The parameter is whether the variable is an array, the third parameter is the array element if the variable is an array, and the fourth parameter is the name of the lock variable. The value you want to reference is returned as the return value of this procedure.
また第5図はアクセスヒストリファイル13の内容を示
した図である。アクセスヒストリファイル13には、前
述のようにライブラリルーチン3によってそのレコード
が書き込まれ、アクセスヒストリ表示プログラム4によ
って編集出力されるようになっている。各レコードには
アクセスが発生した時間、アクセスの種類として代入・
参照の区別、変数のアドレス、変数の値、配列の要素、
実行アドレス、その他の情報が格納される。FIG. 5 is a diagram showing the contents of the access history file 13. The record is written into the access history file 13 by the library routine 3 as described above, and edited and output by the access history display program 4. For each record, the time when the access occurred, the type of access, and
Distinguishing references, variable addresses, variable values, array elements,
Execution address and other information are stored.
次にこのような構成における共有データのアクセス検出
処理動作を説明する。Next, the shared data access detection processing operation in such a configuration will be explained.
先ずプリプロセッサでは、第4図に示すような処理を行
う。First, the preprocessor performs processing as shown in FIG.
すなわち第4図において入力ソースプログラム5のソー
スプログラムは共有変数Vl、V2をアクセスしている
。vlはスカラ変数、v2は配列である。ブリプロセッ
サ2は入力ソースプログラム5のソース行の中で共有変
数の参照、代入をライブラリルーチン3の手続き呼び出
しに変換し出力ソースプログラム6を生成する。ライブ
ラリルーチン3では、第5図に示すような処理を行う。That is, in FIG. 4, the source program of the input source program 5 accesses the shared variables V1 and V2. vl is a scalar variable and v2 is an array. The preprocessor 2 converts shared variable references and assignments in the source lines of the input source program 5 into procedure calls to the library routine 3, and generates an output source program 6. In library routine 3, processing as shown in FIG. 5 is performed.
なお第5図はライブラリルーチン3の処理の概要をCO
MWRTR4を例として示したものである。第5図にお
いて、ステップA1では第1パラメータで指定された共
有変数が第4パラメータで指定されたロック変数によっ
てロックされているか調べる。ロックされていれば同時
に複数のタスクにてアクセスが発生しているのステップ
A2にて排他的でないアクセスが発生していることをア
クセスヒストリファイル11に出力する。ステップA3
では共有変数のアクセスを行うために第4パラメータの
ロック変数にてロックする。ステップA4では共有変数
への代入を行い、ステップA5でアクセスヒストリファ
イル11への出力を行い、ステップA6にてアンロック
する。ライブラリルーチン3のうち値の参照を行う手続
きではステップA4の部分が値の読みだしになる。Figure 5 shows an overview of the processing of library routine 3.
MWRTR4 is shown as an example. In FIG. 5, in step A1, it is checked whether the shared variable specified by the first parameter is locked by the lock variable specified by the fourth parameter. If it is locked, access is occurring in multiple tasks at the same time.In step A2, a message indicating that a non-exclusive access is occurring is output to the access history file 11. Step A3
Now, in order to access the shared variable, lock it using the lock variable of the fourth parameter. In step A4, assignment to the shared variable is performed, in step A5 output is performed to the access history file 11, and in step A6 it is unlocked. In the procedure for referencing values in the library routine 3, step A4 is where the values are read.
アクセスヒストリ表示プログラム4はこのアクセスヒス
トリファイル11を入力し、タスクごとに変数の代入、
参照が行われた時間の順でアクセスヒストリリスト13
を出力する。利用者はこのアクセスヒストリリスト13
を参照すればタスク間の共有変数のアクセスの順序を知
ることが可能となり、どのような順序でアクセスが発生
しているか調査することができる。これにより、共有変
数のアクセスに関するプログラムミスの検出ができる。The access history display program 4 inputs this access history file 11 and assigns variables for each task.
Access history list 13 in order of reference time
Output. Users can use this access history list 13
By referring to , it is possible to know the order in which shared variables are accessed between tasks, and it is possible to investigate in what order the accesses occur. This makes it possible to detect program errors related to shared variable access.
以上説明したように、本発明は並列に動作する利用者プ
ログラムの処理に使用される共有変数のアクセスの順序
を表示するようにしているので、非排他的アクセスが発
生している場合のプログラムの調査が簡単にできて、こ
れにより、利用者プログラムの動作の観測が正確にでき
、プログラムデバッグの効率が向上するという効果があ
る。As explained above, the present invention displays the access order of shared variables used in the processing of user programs running in parallel, so that when non-exclusive access occurs, the program Investigations can be easily carried out, which has the effect of making it possible to accurately observe the behavior of user programs and improving the efficiency of program debugging.
第1図は本発明の一実施例のブロック図、第2図はライ
ブラリルーチンのインターフェイスの一例を示す図、第
3図はアクセスヒストリファイルの内容を示した図、第
4図はプリプロセッサの処理の一例を示す図、第5図は
ライブラリルーチンの処理の概要を示すフローチャート
である。
第1図において、
1・・・共有データのアクセス検出部、2・・・プリプ
ロセッサ、3・・・ライブラリルーチン、4・・・アク
セスヒストリ表示プログラム、5・・・入力ソースプロ
グラム、6・・・出力ソースプログラム、7・・・コン
パイラ、8・・・オブジェクトプログラム、9・・・リ
ンカ、lO・・・ロードモジュール、11・・・アクセ
スヒストリファイル、12・・・入力装置、13・・・
アクセスヒストリリスト。Figure 1 is a block diagram of an embodiment of the present invention, Figure 2 is a diagram showing an example of the library routine interface, Figure 3 is a diagram showing the contents of an access history file, and Figure 4 is a diagram showing the processing of the preprocessor. FIG. 5, which is a diagram showing an example, is a flowchart showing an overview of the processing of the library routine. In FIG. 1, 1... shared data access detection unit, 2... preprocessor, 3... library routine, 4... access history display program, 5... input source program, 6... Output source program, 7... Compiler, 8... Object program, 9... Linker, lO... Load module, 11... Access history file, 12... Input device, 13...
Access history list.
Claims (1)
スが発生するソース行を共有変数の読み込みおよび書き
込みのアクセス手続きの呼び出しに変更するプリプロセ
ッサと、当該アクセス手続きの処理を行うライブラリ手
段と、アクセス手続きの処理された履歴を記憶しておく
アクセスヒストリファイルと、アクセスヒストリファイ
ルを読み込んで任意の変数のアクセスされた順序関係を
表示するアクセスヒストリ表示手段とを備えていること
を特徴とする共有データのアクセス検出方式。A preprocessor that reads a user's source program and changes a source line where a shared variable access occurs to a call to an access procedure for reading and writing a shared variable, a library means that processes the access procedure, and a library that processes the access procedure. A shared data access detection method comprising: an access history file for storing access history, and an access history display means for reading the access history file and displaying the access order relationship of arbitrary variables. .
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1237187A JPH03100837A (en) | 1989-09-14 | 1989-09-14 | Detection system for shared data access |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1237187A JPH03100837A (en) | 1989-09-14 | 1989-09-14 | Detection system for shared data access |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH03100837A true JPH03100837A (en) | 1991-04-25 |
Family
ID=17011666
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP1237187A Pending JPH03100837A (en) | 1989-09-14 | 1989-09-14 | Detection system for shared data access |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH03100837A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007257397A (en) * | 2006-03-24 | 2007-10-04 | Fujitsu Ltd | Contention state detection process additional program, contention state detection process adding apparatus and contention state detection process adding method |
-
1989
- 1989-09-14 JP JP1237187A patent/JPH03100837A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007257397A (en) * | 2006-03-24 | 2007-10-04 | Fujitsu Ltd | Contention state detection process additional program, contention state detection process adding apparatus and contention state detection process adding method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9274923B2 (en) | System and method for stack crawl testing and caching | |
US20020133807A1 (en) | Automation and isolation of software component testing | |
US8352921B2 (en) | Static analysis defect detection in the presence of virtual function calls | |
US20070245312A1 (en) | Precise data-race detection using locksets | |
US5255385A (en) | Method of testing program, and compiler and program testing tool for the method | |
CN111753306B (en) | Intelligent contract vulnerability detection method and device, electronic equipment and storage medium | |
WO2005055051A2 (en) | Determining the possibility of adverse effects arising from a code change | |
US8510604B2 (en) | Static data race detection and analysis | |
US20030018957A1 (en) | Debugger monitor with anticipatory highlights | |
JPH03100837A (en) | Detection system for shared data access | |
Sousa et al. | Preventing atomicity violations with contracts | |
EP0801348A1 (en) | Method of monitoring the operation of a computer | |
Raza | A review of race detection mechanisms | |
JP3298554B2 (en) | Software debugging equipment | |
JPH0581087A (en) | Processor monitoring system | |
Park et al. | Detecting race conditions in one-sided communication of MPI programs | |
JP3101458B2 (en) | Program error detection device | |
JPH05165680A (en) | Memory operation tracing device | |
JPS60179847A (en) | Matching check system between real array and virtual array | |
JP2590083B2 (en) | Source program translation processing method | |
CN118276926A (en) | Workflow engine function expansion method and device, storage medium and electronic equipment | |
JPH04540A (en) | Debugging device | |
CN115309596A (en) | Read-write test method and device for universal device, computer equipment and storage medium | |
CN117290211A (en) | Method and device for detecting system memory of computer, operating system and storage medium | |
JPS62208137A (en) | Image processor |