JP2001312413A - Method for retrial control in access collision and recording medium - Google Patents

Method for retrial control in access collision and recording medium

Info

Publication number
JP2001312413A
JP2001312413A JP2000132760A JP2000132760A JP2001312413A JP 2001312413 A JP2001312413 A JP 2001312413A JP 2000132760 A JP2000132760 A JP 2000132760A JP 2000132760 A JP2000132760 A JP 2000132760A JP 2001312413 A JP2001312413 A JP 2001312413A
Authority
JP
Japan
Prior art keywords
retry
access
time
program
retrial
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.)
Withdrawn
Application number
JP2000132760A
Other languages
Japanese (ja)
Inventor
Toshiro Hiraishi
敏郎 平石
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.)
Denso Ten Ltd
Original Assignee
Denso Ten 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 Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP2000132760A priority Critical patent/JP2001312413A/en
Publication of JP2001312413A publication Critical patent/JP2001312413A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Retry When Errors Occur (AREA)

Abstract

PROBLEM TO BE SOLVED: To increase the success rate of access in retrial processing through simple processing if plural programs collide when accessing a common resource. SOLUTION: A program periodically accesses the common resource 2 to update it. A program 1B optionally accesses the common resource 2 to update it. When access from the program 1B collides against access from the program 1A, the program retries access after a retrial time set in a retrial timer 4 elapses. When the retrial is successful, a counter which counts a retrial frequency 3 is cleared. If the retrial fails, the set value of the retrial timer 4 is varied through simple arithmetic processing for dividing the set value by a constant or subtracting a constant and access is retried while the retrial time is varied until the retrial frequency is exceeded, so the success rate of the retrial can be increased.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、マルチタスクなど
で複数のプログラムがリソースを共有しながら並行して
動作しうるようにするアクセス競合時のリトライ制御方
法および記録媒体に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a retry control method at the time of access contention and a recording medium for enabling a plurality of programs to operate in parallel while sharing resources in multitasking or the like.

【0002】[0002]

【従来の技術】マルチタスクが可能なコンピュータシス
テムでは、1つのプロセッサが複数のプログラムを並行
して実行する。並行して動作する複数のプログラムは、
プログラムを実行するプロセッサ自体や、各種入出力装
置、あるいはメモリなどのリソースを共有することにな
る。プロセッサは、オペレーティングシステムによっ
て、複数のプログラムを時間的に少しずつ切換えて動作
したり、1つのプログラムがイベントと入力待ちなどに
なっているときに他のプログラムの動作に切換えたりし
て、複数のプログラムの並行動作を行う。
2. Description of the Related Art In a computer system capable of multitasking, one processor executes a plurality of programs in parallel. Multiple programs running in parallel
Resources such as the processor itself that executes the program, various input / output devices, and memory are shared. Depending on the operating system, the processor operates by switching a plurality of programs little by little in time, or switches to the operation of another program when one program is waiting for an event and input, etc. Perform parallel operation of the program.

【0003】入出力装置などの共有リソースは、アクセ
スが行われても直ちにそのアクセスの目的が達成される
とは限らない。たとえば、CD−ROMやDVD−RO
Mなどの記録媒体に記録されている情報を読取る場合に
は、アクセスの要求があってから記録媒体の読取りのた
めの準備を開始し、実際に記録媒体から情報の読取りが
可能になるまでに時間がかかることがある。このような
リソースへのアクセスを行うプログラムは、一旦アクセ
ス要求を行った後、読取りが可能になるまで待つ必要が
あるので、その間他のプログラムが動作しうる。ただし
他のプログラムも既にアクセス要求が出されているリソ
ースに対してアクセスするようなときには、アクセスの
競合が生じ、円滑なプログラムの実行のためには何らか
の調定が必要となる。一般には、先に行われたアクセス
が完了するまでは、先のアクセスが優先し、後からアク
セスしたプログラムは時間を変更し再びアクセスするリ
トライを行う必要がある。また、共有リソースに対して
複数のプログラムが同時にアクセスするときには、いず
れのプログラムもアクセスを完結することはできず、リ
トライを行ってアクセスが他のプログラムのアクセスと
重ならないようにする必要がある。リトライの処理を簡
易化するためには、一定時間間隔でリトライする手法が
考えられる。
[0003] When a shared resource such as an input / output device is accessed, the purpose of the access is not always achieved immediately. For example, CD-ROM and DVD-RO
When reading information recorded on a recording medium such as an M, the preparation for reading the recording medium is started after an access request is made, and until the information can be actually read from the recording medium. It may take some time. A program that accesses such a resource needs to wait until it becomes readable after once making an access request, during which time another program can operate. However, when another program accesses a resource for which an access request has already been issued, access conflict occurs, and some adjustment is required for smooth execution of the program. In general, until the previously performed access is completed, the earlier access takes precedence, and the later accessed program needs to change the time and retry to access again. Further, when a plurality of programs simultaneously access the shared resource, none of the programs can complete the access, and it is necessary to perform a retry so that the access does not overlap with the access of another program. In order to simplify the retry process, a method of retrying at regular time intervals can be considered.

【0004】共通のリソースに対して複数のアクセスが
競合する例としては、1本の通信ラインをバスとして共
有する複数のノード間で、バスを円滑に使用するための
CSMA/CD(Carrier Sense Multiple Access With
Collision Detection)方式がLAN(Local Area Net
work)などの分野で広く知られいる。CSMA/CD方
式では、1つのノードがバスを使う場合には、まずバス
上に既に通信が行われているか否かを判断する。バスが
空いていると判断するときには、通信を開始するけれど
も、通信が他のノードからの通信と衝突しているか否か
も監視する。バスが空いているときには、複数のノード
が同時に通信を開始する可能性があり、そのような場合
には通信が衝突する。通信の衝突を検出すると、それぞ
れのノードは一旦通信を停止する。そのため通信ライン
は再び空くようになるけれども、各ノードから再び同じ
ような通信を開始すると再び衝突が起こる可能性が大き
く、衝突と待機とを繰返していつまでたっても通信を行
うことができなくなってしまう可能性がある。このた
め、各ノードで次に通信を開始する時間間隔を変えるた
めに、たとえば乱数を使用して、ランダムに待機時間を
変えて、次に通信を開始するときには衝突する可能性が
小さくなるようにしている。このようなリトライの待ち
時間をランダムに変化させる考え方は、共有リソースへ
のアクセス競合時に一般的に適用することができる。
As an example in which a plurality of accesses compete for a common resource, a CSMA / CD (Carrier Sense Multiple) for smoothly using a bus among a plurality of nodes sharing one communication line as a bus. Access With
Collision Detection) method is LAN (Local Area Net)
work) is widely known. In the CSMA / CD system, when one node uses the bus, it is first determined whether or not communication has already been performed on the bus. When it is determined that the bus is free, communication is started, but it is also monitored whether the communication collides with communication from another node. When the bus is free, multiple nodes may start communication at the same time, in which case the communication will collide. Upon detecting a communication collision, each node temporarily stops communication. Therefore, although the communication line becomes empty again, if the same communication is started again from each node, there is a high possibility that collision will occur again, and it will not be possible to communicate even after repeating collision and standby. there is a possibility. For this reason, in order to change the time interval at which each node starts the next communication, for example, by using a random number, the standby time is changed at random, so that the possibility of collision when starting the next communication is reduced. ing. Such a concept of randomly changing the retry waiting time can be generally applied at the time of contention for access to a shared resource.

【0005】また、特開平9−114750号公報に
は、システムバス上での異常検出時のリトライ間隔を、
予め複数のレジスタに規定されている値の間で切換えた
り、バス監視制御回路の出力で規定される値に切換える
考え方が示されている。
Japanese Patent Application Laid-Open No. Hei 9-114750 discloses that a retry interval when an abnormality is detected on a system bus is defined as:
The concept of switching between values specified in advance in a plurality of registers or switching to a value specified by an output of a bus monitoring control circuit is shown.

【0006】[0006]

【発明が解決しようとする課題】マルチタスクで複数の
プログラムが並行して動作するコンピュータシステムで
は、共有リソースに一定の時間間隔で周期的にアクセス
するプログラムが動作している場合がある。このような
場合に、他のプログラムが同じ共有リソースに対してア
クセスしようとしてアクセス競合が生じると、一定時間
間隔でリトライする場合、その時間間隔と周期的なアク
セスの周期とが一致し、何回リトライを繰返しても共有
リソースにアクセスすることができなくなる可能性があ
る。CSMA/CD方式のように、ランダムにリトライ
の時間間隔を変化させれば、リトライでのアクセス成功
の可能性を高めることができる。しかしながら、ランダ
ムにリトライ時間を設定すると、リトライ回数とリトラ
イ時間の合計とを対応させることが困難であり、リトラ
イ回数を制限しても時間は不定となり、リトライ時間を
規定するとリトライ回数は不定となる。また乱数の発生
のための処理も必要となる。
In a computer system in which a plurality of programs operate in parallel in a multitask, a program that periodically accesses a shared resource at predetermined time intervals may be operating. In such a case, if an access conflict occurs when another program tries to access the same shared resource, when retrying at a fixed time interval, the time interval and the periodic access cycle match, and Even if retry is repeated, it may not be possible to access the shared resource. If the time interval of the retry is randomly changed as in the CSMA / CD system, the possibility of successful access in the retry can be increased. However, if the retry time is set at random, it is difficult to make the number of retries correspond to the sum of the retry times. Even if the number of retries is limited, the time is undefined, and if the retry time is specified, the number of retries is undefined. . Also, processing for generating random numbers is required.

【0007】また、特開平9−114750号公報の先
行技術のようにリトライ時間を切換えるときには、切換
えるリトライ時間が周期的にアクセスするプログラムの
アクセス周期と一致しないことが必要である。このため
には、予め周期についての情報を取得して、プログラム
を作成しなければならず、プログラム作成時に制約や負
担が大きい。
Further, when the retry time is switched as in the prior art of Japanese Patent Application Laid-Open No. Hei 9-114750, it is necessary that the retry time to be switched does not coincide with the access cycle of a program that accesses periodically. For this purpose, it is necessary to acquire information about the cycle in advance and create a program, and there are great restrictions and burdens when creating the program.

【0008】本発明の目的は、リトライの成功率を向上
することが容易で、リトライ回数と時間との関係を正確
に規定しうるアクセス競合時のリトライ制御方法および
記録媒体を提供することである。
An object of the present invention is to provide a retry control method and a recording medium at the time of access conflict in which the success rate of retry can be easily improved and the relationship between the number of times of retry and time can be accurately defined. .

【0009】[0009]

【課題を解決するための手段】本発明は、複数のプログ
ラムが並行して動作しうる環境で、少なくとも1つのプ
ログラムが周期的にアクセスする共有リソースに対し、
他のプログラムが任意にアクセスして競合が生じるとき
に行うアクセス競合時のリトライ制御方法であって、最
初のアクセスで競合が生じるときには、予め定めるリト
ライ時間経過後にリトライを行い、リトライ時でもアク
セス競合が生じるときには、リトライ時間を予め定める
一定の演算処理で変化させて、次のリトライは変化させ
たリトライ時間の経過後に行うように制御するアクセス
競合時のリトライ制御方法である。
SUMMARY OF THE INVENTION According to the present invention, in an environment in which a plurality of programs can operate in parallel, at least one program periodically accesses a shared resource.
This is a retry control method at the time of access conflict which is performed when another program arbitrarily accesses and a conflict occurs. When a conflict occurs at the first access, a retry is performed after a predetermined retry time elapses, and even at the time of the retry, the access conflict occurs. Is a retry control method at the time of access contention in which the retry time is changed by a predetermined constant arithmetic processing, and the next retry is controlled after the changed retry time elapses.

【0010】本発明に従えば、並行して動作している複
数のプログラムのうちの少なくとも1つのプログラムが
共有リソースに対して周期的にアクセスしているとき
に、他のプログラムから共有リソースにアクセスし、ア
クセス競合時には予め定めるリトライ時間経過後にリト
ライを行う。最初のアクセス時に周期的なアクセスと競
合してアクセスを行うことができなくても、リトライ時
には周期的なアクセスとアクセスのタイミングがずれ
て、アクセスを行うことが可能な可能性を高めることが
できる。さらに、リトライ時にもアクセス競合が生じる
ときには、最初に定められているリトライ時間が共有リ
ソースに対する周期的なアクセスの周期と一致している
可能性があり、リトライ時間を予め定める一定の演算処
理で変化させることによって、次のリトライ時にはアク
セス競合が生じず、確実にアクセスが可能となる確率を
高めることができる。
According to the present invention, when at least one of a plurality of programs operating in parallel is accessing the shared resource periodically, another program accesses the shared resource. However, at the time of access conflict, retry is performed after a predetermined retry time has elapsed. Even if the access cannot be performed in conflict with the periodic access at the time of the first access, the timing of the periodic access and the access is shifted at the time of the retry, thereby increasing the possibility that the access can be performed. . Further, when an access conflict also occurs during a retry, there is a possibility that the initially determined retry time coincides with the period of the periodic access to the shared resource, and the retry time is changed by a predetermined arithmetic processing. By doing so, access conflict does not occur at the time of the next retry, and it is possible to increase the probability of being able to access reliably.

【0011】また本発明で2回目以降のリトライ時でも
前記アクセス競合が生じるときには、前記予め定める一
定の演算処理を、前記リトライ時間に対して再度施すよ
うに制御することを特徴とする。
Further, in the present invention, when the access conflict occurs even in the second and subsequent retries, control is performed such that the predetermined arithmetic processing is performed again for the retry time.

【0012】本発明に従えば、最初のアクセス時にアク
セス競合が生じ、リトライ時にもアクセス競合が生じ
て、複数回リトライを行う場合に、各リトライの間の待
ち時間であるリトライ時間を予め定める一定の演算処理
で変化させるので、リトライ毎にリトライ時間を変化さ
せ、しかもリトライの成功率の向上を図ることができ
る。また、リトライ時間の変化は、予め定める一定の演
算処理に従って行われるので、リトライ時間は予測可能
な範囲で変化し、リトライを何回繰返しても全体的なリ
トライ時間の算出を容易に行うことができる。各リトラ
イ時でリトライ時間を変えているので、リトライ時にア
クセス成功の可能性を高めることができる。
According to the present invention, when an access conflict occurs at the time of the first access and an access conflict occurs at the time of the retry, and the retry is performed a plurality of times, the retry time, which is a waiting time between each retry, is predetermined. , The retry time can be changed for each retry, and the success rate of the retry can be improved. In addition, since the change in the retry time is performed according to a predetermined calculation process, the retry time changes within a predictable range, and the total retry time can be easily calculated regardless of how many times the retry is repeated. it can. Since the retry time is changed at each retry, the possibility of successful access at the time of retry can be increased.

【0013】また本発明で前記予め定める一定の演算処
理は、定数による除算であることを特徴とする。
In the present invention, the predetermined arithmetic processing is division by a constant.

【0014】本発明に従えば、定数による除算でリトラ
イ時間を変化させるので、リトライ時間が定数分だけ減
少するようにして、周期的なアクセスと競合しにくく、
かつリトライ時間の把握を容易にすることができる。
According to the present invention, since the retry time is changed by division by a constant, the retry time is reduced by the constant, so that it is difficult to compete with periodic access.
In addition, it is possible to easily grasp the retry time.

【0015】また本発明で前記予め定める一定の演算処
理は、定数の減算であることを特徴とする。
Further, in the present invention, the predetermined arithmetic processing is a subtraction of a constant.

【0016】本発明に従えば、リトライを繰返すときに
リトライ時間を定数で減算していくので、周期的なアク
セスと競合しても、リトライ時間を変えて次のリトライ
ではアクセス成功する可能性を高めることができる。リ
トライ時間は、定数を減算して変化させるので、リトラ
イ回数とリトライ時間との対応関係を容易に把握するこ
とができる。
According to the present invention, when the retry is repeated, the retry time is decremented by a constant. Therefore, even if contention with periodic access occurs, the possibility of success in the next retry can be changed by changing the retry time. Can be enhanced. Since the retry time is changed by subtracting a constant, the correspondence between the number of retries and the retry time can be easily grasped.

【0017】さらに本発明は、前述のアクセス競合時の
リトライ制御方法を、コンピュータに実行させるための
プログラムとして記録したコンピュータ読取可能な記録
媒体である。
Further, the present invention is a computer-readable recording medium in which the above-described retry control method at the time of access conflict is recorded as a program for causing a computer to execute the method.

【0018】本発明に従えば、コンピュータで複数のプ
ログラムを並行して動作させ、共有リソースに対するア
クセス競合を効率的に調整することができる。
According to the present invention, a plurality of programs can be operated in parallel by a computer, and access competition for a shared resource can be efficiently adjusted.

【0019】[0019]

【発明の実施の形態】図1は、本発明の実施の一形態と
してのアクセス競合時のリトライ制御方法を実行するシ
ステムの概略的な構成を示す。複数のプログラム1Aと
プログラム1Bとが並行して動作し、共有リソース2に
対して共にアクセス可能である。一方のプログラム1A
は、共有リソース2に対して周期的にアクセスして、そ
の内容を更新する。他方のプログラム1Bは、共有リソ
ース2に対して任意にアクセスして、その内容を更新す
る。プログラム1Bは、共有リソース2に対してアクセ
スしてプログラム1Aとアクセスが競合するときに、リ
トライ回数3を計数し、またリトライの待ち時間である
リトライ時間をリトライタイマ4に設定する。なお、並
行して動作し、共有リソース2にアクセスするプログラ
ムが3以上のときも、本発明を同様に適用することがで
きる。
FIG. 1 shows a schematic configuration of a system for executing a retry control method at the time of access contention as one embodiment of the present invention. A plurality of programs 1A and 1B operate in parallel and can access the shared resource 2 together. One program 1A
Periodically accesses the shared resource 2 and updates its content. The other program 1B arbitrarily accesses the shared resource 2 and updates the content. When the program 1B accesses the shared resource 2 and the access conflicts with the program 1A, the program 1B counts the number of retries 3 and sets a retry time, which is a retry waiting time, in the retry timer 4. The present invention can be similarly applied to a case where three or more programs operate in parallel and access the shared resource 2.

【0020】図2は、図1に示すプログラム1Aによる
共有リソース2に対する周期的な更新動作を示す。ステ
ップa1から動作を開始し、ステップa2では、共有リ
ソース2に対してアクセスし、セマフォを取得する。共
有リソース2は、複数のプログラムからのアクセスを想
定し、アクセス競合を調定するためにセマフォ方式を採
用する。セマフォ方式は、いずれのプログラムからのア
クセスもない状態から、初めてアクセスがある方のプロ
グラムにセマフォを取得させ、以後はセマフォを取得し
ているプログラムのみからのアクセスを認める方式であ
り、アクセスが終了するとセマフォを解放させ、再びア
クセスを待つ状態に戻る方式である。すなわち、1つの
プログラムがセマフォを取得していれば、そのプログラ
ムが共有リソースに対して独占的にアクセスすることが
可能となる。
FIG. 2 shows a periodic update operation for the shared resource 2 by the program 1A shown in FIG. The operation is started from step a1, and in step a2, the shared resource 2 is accessed to acquire a semaphore. The shared resource 2 is assumed to be accessed from a plurality of programs, and employs a semaphore method to adjust access competition. The semaphore method is a method in which the program that has access for the first time acquires the semaphore from the state where there is no access from any program, and thereafter, the access is permitted only from the program that has acquired the semaphore, and the access ends Then, the semaphore is released, and the system returns to the state of waiting for access again. That is, if one program has acquired a semaphore, that program can exclusively access the shared resource.

【0021】ステップa3では、セマフォの取得に成功
しているか否かを判断する。成功していれば、ステップ
a4で共有リソースにアクセスし、その内容の更新を行
う。アクセスによる共有リソースの更新処理が終了する
と、ステップa5でセマフォを解放する。ステップa5
のセマフォ解放の処理が終了した後、またはステップa
3でセマフォ取得に成功しないと判断されたとき、ステ
ップa6で一定時間待ちに移る。ステップa6の一定時
間待ちが終了すると、ステップa2に戻る。すなわち、
プログラム1Aは、一定時間毎に共有リソースへアクセ
スし、セマフォを取得してアクセスに成功すれば共有リ
ソースの更新を行い、セマフォの取得に成功しなけれ
ば、次の一定時間後に再びアクセスを試みながら、一定
時間毎に共有リソース2に対するアクセスを行う。
In step a3, it is determined whether or not the semaphore has been successfully acquired. If succeeded, the shared resource is accessed in step a4, and the content is updated. When the update processing of the shared resource by the access ends, the semaphore is released in step a5. Step a5
After the semaphore release processing is completed, or
If it is determined in step 3 that the semaphore acquisition has not succeeded, the process shifts to waiting for a certain time in step a6. When the waiting for the predetermined time in step a6 ends, the process returns to step a2. That is,
The program 1A accesses the shared resource at regular intervals, acquires the semaphore, updates the shared resource if the access is successful, and attempts to access again after the next fixed time if the acquisition of the semaphore is not successful. Access to the shared resource 2 at regular time intervals.

【0022】図3は、図1のプログラム1Bによる共有
リソース2へのアクセス動作を示す。ステップb1から
動作を開始し、ステップb2ではイベント待ちを行う。
イベント待ち状態では、実際は他のプログラム、たとえ
ばプログラム1Aなどの動作が行われ、プログラム1B
としては要求割込みやリトライタイマ4からの割込みを
待つ状態である。要求割込みは、たとえばコンピュータ
システムのユーザからの要求に従って、オペレーティン
グシステムが行う。要求割込みやリトライタイマ4から
の割込みなどのイベントが発生すると、イベントに伴う
プログラム処理の一環として共有リソース2に対するア
クセスが必要となり、ステップb3でセマフォ取得を行
う。
FIG. 3 shows an operation of accessing the shared resource 2 by the program 1B of FIG. The operation is started from step b1, and an event is waited in step b2.
In the event waiting state, the operation of another program, for example, the program 1A, is actually performed, and the program 1B
Is a state of waiting for a request interrupt or an interrupt from the retry timer 4. The request interrupt is performed by the operating system, for example, according to a request from a user of the computer system. When an event such as a request interrupt or an interrupt from the retry timer 4 occurs, access to the shared resource 2 is required as part of the program processing accompanying the event, and a semaphore is obtained in step b3.

【0023】ステップb4では、セマフォ取得が成功し
ているか否かを判断する。セマフォの取得に成功してい
ると判断されるときには、ステップb5でリトライ回数
3をクリアし、ステップb6で共有リソース2にアクセ
スしてその更新を行い、ステップb7でセマフォを解放
する。ステップb4で、セマフォの取得に成功していな
いと判断されるときには、ステップb8で、リトライ回
数3を計数するカウンタをインクリメントする。
In step b4, it is determined whether or not the semaphore acquisition has been successful. When it is determined that the acquisition of the semaphore is successful, the retry count 3 is cleared in step b5, the shared resource 2 is accessed and updated in step b6, and the semaphore is released in step b7. If it is determined in step b4 that acquisition of the semaphore has not been successful, a counter for counting the number of retries 3 is incremented in step b8.

【0024】ステップb9では、リトライ回数3の回数
が、予め設定される最大値を超える回数超過の状態とな
っているか否かを判断する。回数超過となっていないと
判断されるときには、ステップb10で、リトライタイ
マ4の値を計算し、ステップb11でリトライタイマ4
に計算値を設定してリトライタイマ4を起動する。リト
ライタイマ4が起動すると、ステップb10の計算結果
に従って指定した時間後にイベントを発行する。ステッ
プb9で、回数超過であると判断されるときには、ステ
ップb12でリトライ回数3をクリアし、ステップb1
3でリトライ回数超過処理を行う。ステップb7、ステ
ップb11またはステップb13の各処理が終了する
と、ステップb2に戻る。
At step b9, it is determined whether or not the number of retries 3 exceeds the maximum value set in advance. When it is determined that the number of times has not been exceeded, the value of the retry timer 4 is calculated in step b10, and the value of the retry timer 4 is calculated in step b11.
And the retry timer 4 is started. When the retry timer 4 starts, an event is issued after a specified time according to the calculation result of step b10. When it is determined in step b9 that the number of times is excessive, the number of retries 3 is cleared in step b12, and step b1
In step 3, retry count excess processing is performed. Upon completion of the processing in the step b7, the step b11, or the step b13, the process returns to the step b2.

【0025】ステップb7のセマフォ解放後にステップ
b2のイベント待ちに戻るときには、次の要求割込みを
待つことになる。ステップb11のリトライタイマ起動
後にステップb2のイベント待ちを行うときには、リト
ライタイマ4からの割込みをイベントとして待つ状態と
なる。ステップb13のリトライ回数超過処理では、共
有リソース2にアクセスすることができなかった旨を、
ユーザに知らせる処理などを行う。
When returning to the event wait of step b2 after the release of the semaphore in step b7, it waits for the next request interrupt. When waiting for an event in step b2 after the start of the retry timer in step b11, the system waits for an interrupt from the retry timer 4 as an event. In the retry count excess process of step b13, it is determined that the shared resource 2 cannot be accessed.
It performs processing for notifying the user.

【0026】図2に示すように、プログラム1Aは周期
的に次の手順で共有リソース2のアクセスを行う。 1)アクセスする前にセマフォ取得を行う。 2)セマフォ取得失敗時はアクセスしない。 3)セマフォ取得成功時は、共有リソース2にアクセス
し、終了後にセマフォを解放する。
As shown in FIG. 2, the program 1A periodically accesses the shared resource 2 according to the following procedure. 1) Acquire a semaphore before accessing. 2) Do not access when semaphore acquisition fails. 3) If semaphore acquisition is successful, access shared resource 2 and release the semaphore after termination.

【0027】プログラム1Bは、共有リソース2へのア
クセスを含むイベントが発生すると、次の手順でアクセ
スを行う。 1)アクセスする前にセマフォ取得を行う。 2)セマフォ取得成功時は、共有リソース2へアクセス
し、終了後セマフォを解放する。 3)セマフォ取得失敗時は、1回目のリトライタイマ4
による時間待ちを行う。1回目のリトライ時間はn1秒
とする。 4)セマフォ取得を行う。 5)セマフォ取得成功時は、共有リソース2にアクセス
し、終了後セマフォを解放する。 6)セマフォ取得失敗時は、2回目のリトライタイマ4
による時間待ちを行う。2回目のリトライ時間はn2秒
とする。 7)セマフォ取得を行う。 8)セマフォ取得成功時は、共有リソース2へアクセス
し、終了後セマフォを解放する。 9)セマフォ取得失敗時は、3回目のリトライタイマ4
の設定値での時間待ちを行う。リトライタイマ4の設定
値は、n3秒とする。 10)セマフォ取得を行う。 11)セマフォ取得成功時は、共有リソース2へアクセス
し、終了後、セマフォを解放する。 12)セマフォ取得失敗時は、リトライ回数超過として異
常処理を行う。
When an event including an access to the shared resource 2 occurs, the program 1B accesses according to the following procedure. 1) Acquire a semaphore before accessing. 2) If the semaphore acquisition is successful, access the shared resource 2 and release the semaphore after the end. 3) When semaphore acquisition fails, first retry timer 4
To wait for the time. The first retry time is n1 seconds. 4) Acquire a semaphore. 5) If semaphore acquisition is successful, access shared resource 2 and release the semaphore after termination. 6) When semaphore acquisition fails, the second retry timer 4
To wait for the time. The second retry time is n2 seconds. 7) Acquire a semaphore. 8) If semaphore acquisition is successful, access shared resource 2 and release the semaphore after termination. 9) When semaphore acquisition fails, the third retry timer 4
Wait for the set value of. The set value of the retry timer 4 is n3 seconds. 10) Acquire a semaphore. 11) When semaphore acquisition is successful, access shared resource 2 and release the semaphore after completion. 12) If the semaphore acquisition fails, perform the error processing with the retry count exceeded.

【0028】以上の手順では、3回までリトライを行っ
ても共有リソース2にアクセスすることができないとき
に、リトライ回数超過と判断している。この場合のリト
ライ回数超過を検出するまでの時間は、xとして、次の
式で規定することができる。 x=n1+n2+n3
In the above procedure, when the shared resource 2 cannot be accessed even after performing the retry up to three times, it is determined that the retry number has been exceeded. In this case, the time until the retry count is exceeded can be defined as x by the following equation. x = n1 + n2 + n3

【0029】また、リトライタイマ4は、次のように設
定を変化させることが可能である。 1)定数で除算する方法 例)定数を2とすると、n1=10,n2=5,n3=
2.5となり、x=17.5となる。2)定数を除算す
る方法 例)定数を2とすると、n1=10,n2=8,n3=
6となり、x=24となる。
The setting of the retry timer 4 can be changed as follows. 1) Method of dividing by a constant Example: If the constant is 2, n1 = 10, n2 = 5, n3 =
2.5, and x = 17.5. 2) Method of dividing a constant Example: Assuming that the constant is 2, n1 = 10, n2 = 8, n3 =
6 and x = 24.

【0030】これらの簡単な演算処理でリトライタイマ
4の設定値を変更し、リトライ時間を変化させれば、プ
ログラム1Aからの周期的なアクセスに対する周期など
を知らなくても、リトライの回数の繰返しでリトライの
成功率を高めることができる。
If the set value of the retry timer 4 is changed and the retry time is changed by these simple arithmetic operations, the repetition of the number of retries can be performed without knowing the period for the periodic access from the program 1A. Can increase the retry success rate.

【0031】以上説明したようなマルチタスク方式で共
有リソース2にアクセスするコンピュータ装置の考え方
は、たとえば車載用のナビゲーション装置に適用するこ
とができる。ナビゲーション装置では、一定時間毎の周
期的に、車両の現在位置を検出するプログラムが、道路
地図データを記録している記録媒体にアクセスし、推測
航法やマップマッチングに基づく現在位置の検出に道路
地図データを使用する。また、読取られる道路地図デー
タに基づき、表示画面上に現在位置を中心とするような
道路地図を表示する。ナビゲーション装置のユーザが、
たとえば特定の地点についての地図を見たいと要求する
ときには、ユーザの要望に応答して地図データの読取り
を行うプログラムが起動する。このプログラムは、ユー
ザの要求に応じて、任意のタイミングで共有リソースで
ある道路地図データの記録媒体にアクセスし、アクセス
に成功すれば読取った地図データを表示画面に表示す
る。
The concept of the computer device for accessing the shared resource 2 by the multitask method as described above can be applied to, for example, an in-vehicle navigation device. In the navigation device, a program for periodically detecting the current position of a vehicle at regular time intervals accesses a recording medium that stores road map data, and uses a road map to detect the current position based on dead reckoning navigation or map matching. Use data. Further, a road map centering on the current position is displayed on the display screen based on the read road map data. The user of the navigation device
For example, when requesting to view a map of a specific point, a program for reading map data in response to a user's request is activated. This program accesses a recording medium of road map data, which is a shared resource, at an arbitrary timing according to a user's request, and displays the read map data on a display screen if the access is successful.

【0032】車載用のナビゲーション装置では、表示画
面も限られているので、画像表示用のディスプレイも共
有リソースとなる。表示画面に対して、現在位置の表示
を周期的に行う際には、全画面を現在位置の表示のため
に使用する。ユーザからの特定の場所についての情報の
表示を求められるときには、現在位置表示と表示画面を
並行したり、あるいはユーザからの要求の地図データの
表示を優先して表示画面を全部その表示のために使用し
たりする。ただし、表示画面への表示のための処理は、
アクセスすれば直ちに応答することができるので、プロ
セッサも共有リソースであるマルチタスクの場合には、
特にセマフォによる管理などを必要とはしない。
[0032] Since the display screen of the in-vehicle navigation device is limited, the display for displaying images is also a shared resource. When periodically displaying the current position on the display screen, the entire screen is used for displaying the current position. When the user is required to display information about a specific place, the display of the current position and the display screen are performed in parallel, or the display of the map data requested by the user is prioritized and the entire display screen is displayed. Or use it. However, the processing for displaying on the display screen is
If you access, you can respond immediately, so in the case of multitasking that the processor is also a shared resource,
In particular, there is no need for semaphore management.

【0033】記録媒体のアクセスに対しては、アクセス
の要求から実際に必要な地図データを読出すまでに時間
がかかるので、セマフォなどによってアクセス競合を避
ける管理を行う必要がある。排他的な管理を行わない
と、たとえば現在位置の検出のためのアクセス要求で、
地図データの読取準備を行っている間に、ユーザからの
特定の地点の道路情報等の要求のためのアクセスがなさ
れ、そのアクセスに対して現在位置の道路データを与
え、次に現在位置の読取り要求があるときに、ユーザか
らの要求される他の地点の道路地図データを与えると、
誤動作を生じてしまう。
For access to a recording medium, since it takes time from the access request to the actual reading of the necessary map data, it is necessary to perform management to avoid access conflicts by using a semaphore or the like. Without exclusive management, for example, in an access request to detect the current location,
During the preparation for reading the map data, an access is made from the user for a request for road information or the like at a specific point, road data of the current position is given to the access, and then the reading of the current position is performed. When there is a request, if the road map data of another point requested by the user is given,
A malfunction will occur.

【0034】また、複数のプログラムが並行して動作す
る環境は、単一のプロセッサによるマルチタスクを行う
コンピュータ装置に限らず、複数のプロセッサが同時に
動作するマルチプロセッサのコンピュータシステムや、
LANなどで相互に接続される複数のコンピュータシス
テム間でも生じうる。たとえば、今日車両には多くの電
子制御装置が分散して搭載され、各装置間は通信ライン
で接続される。搭載する複数の電子制御装置間を共通の
通信ラインで接続することによって、ワイヤハーネスな
どとして必要なケーブルを削減し、重量の軽減を図るこ
とができる。そのような通信ケーブルを介するデータ伝
送は、たとえば車両の運行に必要な各種データを、一定
の周期で伝送し、操作部や表示部を運転席近くに配置
し、多くの記録媒体を収納して交換可能なチェンジャや
大出力のアンプなどをトランクルームなどに配置するオ
ーディオビジュアルシステムでの制御も、通信ケーブル
を介して行う場合に適用することができる。すなわち、
オーディオビジュアル装置としての通信ケーブルの利用
は、周期的に行われる車両の運行のための通信の合間に
行うために、共有リソースとしての通信ラインへのアク
セスの競合時に、オーディオビジュアル装置としての次
のリトライの待ち時間を、本発明を適用して変化させれ
ば、リトライの成功率を高め、通信ラインを有効に利用
することができる。
The environment in which a plurality of programs operate in parallel is not limited to a computer device that performs multitasking with a single processor, but may be a multiprocessor computer system in which a plurality of processors operate simultaneously,
This may occur between a plurality of computer systems interconnected by a LAN or the like. For example, many electronic control devices are mounted on vehicles today in a distributed manner, and each device is connected by a communication line. By connecting a plurality of electronic control devices to be mounted with a common communication line, the number of cables required as a wire harness or the like can be reduced, and the weight can be reduced. For data transmission via such a communication cable, for example, various types of data necessary for vehicle operation are transmitted at a constant cycle, an operation unit and a display unit are arranged near a driver's seat, and many recording media are stored. Control in an audio-visual system in which a replaceable changer, a high-output amplifier, and the like are disposed in a trunk room or the like can also be applied to a case where the control is performed via a communication cable. That is,
The use of a communication cable as an audiovisual device may be performed in a time interval between communications for periodically operating a vehicle, and in the event of contention for access to a communication line as a shared resource, the following as an audiovisual device. If the retry waiting time is changed by applying the present invention, the success rate of the retry can be increased and the communication line can be used effectively.

【0035】[0035]

【発明の効果】以上のように本発明によれば、任意に共
有リソースにアクセスするプログラムで、共有リソース
へのアクセス時に周期的にアクセスするプログラムから
のアクセスと競合を生じて、予め定める一定時間経過後
のリトライでも競合を生じるとき、次のリトライは予め
定める一定の演算処理を施したリトライ時間の経過後に
行うので、周期的なアクセスとの競合の可能性を小さく
してリトライ成功率を向上させることができる。リトラ
イ時間の変化は、乱数によらず、予め定める一定の演算
処理によって行うので、乱数を発生させる処理は不要で
あり、単純な処理でリトライに必要な待ち時間を明確に
することができる。
As described above, according to the present invention, a program for arbitrarily accessing a shared resource causes a conflict with an access from a program that periodically accesses the shared resource when the shared resource is accessed, and a predetermined period of time. When a conflict occurs even after retry after the elapse, the next retry is performed after the elapse of the retry time after performing a predetermined fixed arithmetic processing, so the possibility of contention with periodic access is reduced and the retry success rate is improved. Can be done. The change in the retry time is performed not by random numbers but by a predetermined arithmetic processing, so that processing for generating random numbers is unnecessary, and the waiting time required for retry can be clarified by simple processing.

【0036】また本発明によれば、予め定める一定の演
算処理でリトライ時間を変化させながらリトライを繰返
して行うので、乱数を使う必要はなく、リトライ回数と
リトライ時間との把握も容易に行うことができる。
Further, according to the present invention, since retry is repeatedly performed while changing the retry time by a predetermined constant arithmetic processing, it is not necessary to use a random number, and it is easy to grasp the number of times of retry and the retry time. Can be.

【0037】また本発明によれば、定数で除算するとい
う簡単な演算処理で、リトライの成功率を高め、かつリ
トライ回数とリトライ時間との対応関係を容易に把握す
ることができる。
Further, according to the present invention, it is possible to increase the success rate of retry and easily grasp the correspondence between the number of retries and the retry time by a simple operation of dividing by a constant.

【0038】また本発明によれば、定数を減算するとい
う簡単な演算処理で、リトライの成功率を高め、かつリ
トライ回数とリトライ時間との対応関係を容易に否定す
ることができる。
Further, according to the present invention, the success rate of retry can be increased and the correspondence between the number of retries and the retry time can be easily denied by a simple operation of subtracting a constant.

【0039】さらに本発明によれば、コンピュータに複
数のプログラムを並行して動作させ、共有リソースへの
アクセス競合時の調整を効率よく行うことができる。
Further, according to the present invention, a plurality of programs can be operated in parallel by the computer, and the adjustment at the time of contention for access to the shared resource can be efficiently performed.

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

【図1】本発明の実施の一形態としての基本的なシステ
ム構成を示すブロック図である。
FIG. 1 is a block diagram showing a basic system configuration as one embodiment of the present invention.

【図2】図1のプログラム1Aの動作手順を示すフロー
チャートである。
FIG. 2 is a flowchart showing an operation procedure of a program 1A in FIG.

【図3】図1のプログラム1Bの動作手順を示すフロー
チャートである。
FIG. 3 is a flowchart showing an operation procedure of a program 1B of FIG. 1;

【符号の説明】[Explanation of symbols]

1A,1B プログラム 2 共有リソース 3 リトライ回数 4 リトライタイマ 1A, 1B program 2 shared resource 3 retry count 4 retry timer

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 複数のプログラムが並行して動作しうる
環境で、少なくとも1つのプログラムが周期的にアクセ
スする共有リソースに対し、他のプログラムが任意にア
クセスして競合が生じるときに行うアクセス競合時のリ
トライ制御方法であって、 最初のアクセスで競合が生じるときには、予め定めるリ
トライ時間経過後にリトライを行い、 リトライ時でもアクセス競合が生じるときには、リトラ
イ時間を予め定める一定の演算処理で変化させて、次の
リトライは変化させたリトライ時間の経過後に行うよう
に制御するアクセス競合時のリトライ制御方法。
1. An access conflict that occurs when another program arbitrarily accesses a shared resource that is periodically accessed by at least one program in an environment where a plurality of programs can operate in parallel, and a conflict occurs. When contention occurs in the first access, retry is performed after a predetermined retry time elapses. A retry control method at the time of access contention in which the next retry is controlled after the changed retry time has elapsed.
【請求項2】 2回目以降のリトライ時でも前記アクセ
ス競合が生じるときには、前記予め定める一定の演算処
理を、前記リトライ時間に対して再度施すように制御す
ることを特徴とする請求項1記載のアクセス競合時のリ
トライ制御方法。
2. The system according to claim 1, wherein when the access conflict occurs even in the second and subsequent retries, control is performed such that the predetermined arithmetic processing is performed again on the retry time. Retry control method at the time of access conflict.
【請求項3】 前記予め定める一定の演算処理は、定数
による除算であることを特徴とする請求項1または2記
載のアクセス競合時のリトライ制御方法。
3. The method according to claim 1, wherein the predetermined arithmetic processing is division by a constant.
【請求項4】 前記予め定める一定の演算処理は、定数
の減算であることを特徴とする請求項1または2記載の
アクセス競合時のリトライ制御方法。
4. The retry control method at the time of access contention according to claim 1, wherein said predetermined arithmetic processing is a subtraction of a constant.
【請求項5】 請求項1〜4のいずれかに記載のアクセ
ス競合時のリトライ制御方法を、コンピュータに実行さ
せるためのプログラムとして記録したコンピュータ読取
可能な記録媒体。
5. A computer-readable recording medium in which a retry control method at the time of access conflict according to claim 1 is recorded as a program for causing a computer to execute the method.
JP2000132760A 2000-05-01 2000-05-01 Method for retrial control in access collision and recording medium Withdrawn JP2001312413A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000132760A JP2001312413A (en) 2000-05-01 2000-05-01 Method for retrial control in access collision and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000132760A JP2001312413A (en) 2000-05-01 2000-05-01 Method for retrial control in access collision and recording medium

Publications (1)

Publication Number Publication Date
JP2001312413A true JP2001312413A (en) 2001-11-09

Family

ID=18641394

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000132760A Withdrawn JP2001312413A (en) 2000-05-01 2000-05-01 Method for retrial control in access collision and recording medium

Country Status (1)

Country Link
JP (1) JP2001312413A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2469196A (en) * 2009-03-31 2010-10-06 Fujitsu Ltd Analysing process history to identify collisions
WO2012014313A1 (en) * 2010-07-30 2012-02-02 富士通株式会社 Multi-core processor system, thread control method, and thread control program
JP2012528369A (en) * 2009-05-27 2012-11-12 インターナショナル・ビジネス・マシーンズ・コーポレーション Computer-implemented multi-resource shared lock

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2469196A (en) * 2009-03-31 2010-10-06 Fujitsu Ltd Analysing process history to identify collisions
US8037359B2 (en) 2009-03-31 2011-10-11 Fujitsu Limited Operation management system having a process execution apparatus, information management apparatus, and process analyzing apparatus, process analyzing apparatus, recording medium in which process analysis program is recorded, and process analysis method
JP2012528369A (en) * 2009-05-27 2012-11-12 インターナショナル・ビジネス・マシーンズ・コーポレーション Computer-implemented multi-resource shared lock
WO2012014313A1 (en) * 2010-07-30 2012-02-02 富士通株式会社 Multi-core processor system, thread control method, and thread control program
JP5321748B2 (en) * 2010-07-30 2013-10-23 富士通株式会社 Multi-core processor system, thread control method, and thread control program

Similar Documents

Publication Publication Date Title
US5901295A (en) Address and data bus arbiter for pipelined transactions on a split bus
WO1988008577A2 (en) Node for servicing interrupt request messages on a pended bus
JP6129976B2 (en) Method and apparatus using high efficiency atomic operations
JPH103447A (en) Bus bridge device
USRE40261E1 (en) Apparatus and method of partially transferring data through bus and bus master control device
JP2002304369A (en) Bus system
JP2001312413A (en) Method for retrial control in access collision and recording medium
JP4953794B2 (en) Bus arbitration method for bus system and bus system
JP2972491B2 (en) Bus control mechanism and computer system
JPH05282244A (en) Information processor
JP3497478B2 (en) DMA transfer device and data transfer system
JP3240863B2 (en) Arbitration circuit
JPH0844662A (en) Information processor
JP2747258B2 (en) Write buffer busy control method
JPH02219157A (en) Bus arbiter in computer system
JPH05289987A (en) Bus right arbitrating circuit
JP2742135B2 (en) Bus arbitration equipment
JPH09204311A (en) Information processing system
JP3096760B2 (en) Common data reference setting device and reference setting method
JPH05134980A (en) Bus system
JP2001177542A (en) Communication equipment between control nodes
JPH1139266A (en) Multiprocessor device
JPH04178869A (en) Interruption control device for multiprocessor system and its interruption communication method
JP2837893B2 (en) Microcomputer device
JP3236459B2 (en) Error handling device in common bus data transfer

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20070703