JPH0816456A - Resource management device - Google Patents

Resource management device

Info

Publication number
JPH0816456A
JPH0816456A JP14344594A JP14344594A JPH0816456A JP H0816456 A JPH0816456 A JP H0816456A JP 14344594 A JP14344594 A JP 14344594A JP 14344594 A JP14344594 A JP 14344594A JP H0816456 A JPH0816456 A JP H0816456A
Authority
JP
Japan
Prior art keywords
resource
semaphore
read
value
write
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP14344594A
Other languages
Japanese (ja)
Inventor
Ritsuko Ueki
理津子 植木
Suketada Futamura
祐地 二村
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP14344594A priority Critical patent/JPH0816456A/en
Publication of JPH0816456A publication Critical patent/JPH0816456A/en
Pending legal-status Critical Current

Links

Landscapes

  • Multi Processors (AREA)

Abstract

PURPOSE:To increase the flexibility and improve the throughput of the whole system by acquiring a common resource in common exclusively to a read system process, and acquiring the common resource exclusively to a write system process. CONSTITUTION:An exclusive control part 10 has P instruction parts which declare resource acquisition to a read system and a write system respectively and V instruction parts which declare the release of resources; and the read system P instruction part 20 acquires the common resource in common exclusively to the read system process and the write system P instruction part 30 acquires the common resource exclusively to the write system process. The resource acquisition priority 7 of a process control block 6 stored in the memory 1 is assigned to the read system process and write system process and resource acquisition order is determined on the basis of the priority; and the P instruction parts 20 and 30 of the read and write systems acquires the resources of the respective processes and the V instruction parts 40 and 50 release the resources respectively.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、計算機システムのソフ
トウェアに関し、複数のプロセスから共用にアクセスさ
れ、かつアクセスの種類が読み込み系、書き込み系に分
かれる資源に対する資源管理方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to software for a computer system, and more particularly to a resource management system for resources that are commonly accessed by a plurality of processes and the type of access is divided into read type and write type.

【0002】[0002]

【従来の技術】従来技術として「オペレーティングシス
テムの概念上」(J.L.ピーターソン、A.シルバー
シャッツ共著)に記載されている排他制御および共用排
他制御の構造について説明する。複数のプロセスが並行
に動作するシステムでは、プロセス間で共通にアクセス
されるデータに対し、排他制御を行う必要がある。更に
ファイルやレコードなどの共用データには共用排他制御
が必要である。ファイルやレコードなどのデータ対象に
は、その内容を読むだけのプロセスもあれば、その内容
を更新する(読んで書く)プロセスもある。読むだけの
プロセスを読み込み系プロセス、その他を書き込み系プ
ロセスと呼んで両者を区別することにする。2つの読み
込み系プロセスが同時に共用データ対象をアクセスして
もデータに不整合は生じないが、もう一つの書き込み系
プロセスと(読み込み系か書き込み系のいずれかの)他
のプロセスが同時に共用データ対象をアクセスすると混
乱が生じる。このような混乱が生じないようにするため
に、書き込み系は共用データを排他的にアクセスする必
要がある。この資源管理方法を共用排他制御と呼ぶこと
にする。
2. Description of the Related Art Structures of exclusive control and shared exclusive control described in "Concept of operating system" (co-authored by JL Peterson and A. Silvershatz) will be described as prior art. In a system in which a plurality of processes operate in parallel, it is necessary to perform exclusive control on data commonly accessed by the processes. Furthermore, shared exclusive control is required for shared data such as files and records. For data objects such as files and records, there are processes that only read the contents, and processes that update (read and write) the contents. A process that only reads is called a read process, and other processes are called a write process to distinguish them. Data inconsistency does not occur when two read-related processes access the shared data target at the same time, but another write-related process and another process (either read or write-related) simultaneously share the shared data target. Accessing is confusing. In order to prevent such confusion, the write system needs to access the shared data exclusively. This resource management method is called shared exclusive control.

【0003】従来の共用排他制御は、排他制御機構を用
いて実装する。共用排他制御の方法を説明する前に、共
用データの排他制御方法について述べる。この排他制御
の方法としてはDijkstraによって導入されたセ
マフォが知られている。セマフォへの操作は2つの標準
的な基本命令であるP命令とV命令のみによって行われ
る。P命令、V命令は不可分な単位として実行される必
要があるため、割り込み禁止区間で実行される。プロセ
スはセマフォに対するP命令を実行してから資源へのア
クセスを行ない、アクセスが終了したら同セマフォに対
してV命令を実行することにより、資源の排他制御を行
う。つまり、P命令の処理は資源獲得の宣言であり、V
命令の処理は資源解放の宣言である。P命令を実行して
からV命令を実行するまでの間、プロセスは資源あるい
はセマフォをロック中あるいはセマフォを獲得中である
という。
Conventional shared exclusive control is implemented using an exclusive control mechanism. Before explaining the shared exclusive control method, the shared data exclusive control method will be described. A semaphore introduced by Dijkstra is known as a method of this exclusive control. Operations on semaphores are performed only by two standard primitives, the P and V instructions. Since the P instruction and the V instruction need to be executed as an indivisible unit, they are executed in the interrupt prohibited section. The process executes the P instruction for the semaphore to access the resource, and when the access is completed, executes the V instruction for the semaphore to perform the exclusive control of the resource. That is, the processing of the P instruction is a declaration of resource acquisition, and V
The processing of an instruction is a declaration of resource release. It is said that the process is locking the resource or the semaphore or acquiring the semaphore from the execution of the P instruction to the execution of the V instruction.

【0004】図25にセマフォの構成を示す。メモリ1
上には、セマフォ管理テーブル180およびプロセス制
御ブロック(以下PCBと称する)183が格納されて
いる。セマフォ管理テーブル180には、セマフォの獲
得待ちプロセスのリストへのポインタ181およびセマ
フォの値(整数値)182の各領域がある。PCB18
3内には、資源獲得待ちプロセスリストを形成するため
のPCBへのポインタ184が含まれる。待ちプロセス
リストは、待ち列(queue)として実現されるのが
より一般的で、どのような待ち列方式(FIFO,スケ
ジューリング優先度、その他)を使用してもよい。排他
制御部18は、P命令部190およびV命令部200か
ら構成されており、上記メモリ1上のデータを用いてセ
マフォに対する操作を行う。
FIG. 25 shows the structure of a semaphore. Memory 1
A semaphore management table 180 and a process control block (hereinafter referred to as a PCB) 183 are stored above. The semaphore management table 180 has areas of a pointer 181 to a list of processes waiting for acquisition of a semaphore and a semaphore value (integer value) 182. PCB18
3 includes a pointer 184 to a PCB for forming a resource acquisition waiting process list. The queue process list is more commonly implemented as a queue, and any queue scheme (FIFO, scheduling priority, etc.) may be used. The exclusive control unit 18 includes a P command unit 190 and a V command unit 200, and uses the data in the memory 1 to operate the semaphore.

【0005】図26にセマフォのP命令部(ロックある
いは獲得)、図27にV命令部(アンロックあるいは解
放)処理のフローチャートを示す。P命令部では、まず
セマフォの値を−1して(S1901)、その結果セマ
フォの値が負の値でなければ(S1902、No)、こ
のP命令部を呼び出したプロセスは資源を獲得できるた
め、そのまま処理を終了する。S1901の結果セマフ
ォの値が負の値であれば(S1902、Yes)該プロ
セスは資源獲得待ちを行わなければならないため、該プ
ロセスのPCBを資源獲得待ちリストへ挿入して(S1
903)、該プロセス自身を休眠状態とし実行を中断さ
せる(S1904)。一方、V命令部では、図27にお
いて、まずセマフォの値を+1して(S2001)、そ
の結果セマフォの値が0以下の値でなければ(S200
2、No)、資源獲得待ちをしているプロセスが存在し
ないため、そのまま処理を終了する。S2001の結果
セマフォの値が0以下の値であれば(S2002、Ye
s)、資源獲得待ちをしているプロセスが存在するた
め、待ちプロセスリストの先頭からPCBを1つ取りだ
し(S2003)、そのPCBのプロセスの実行を再開
させる(S2004)。なお、ステップS1904およ
びステップS2004の2つの命令は、基本システムコ
ールとしてオペレーティングシステムによって提供され
る。
FIG. 26 shows a flow chart of the P command portion (lock or acquisition) of the semaphore, and FIG. 27 shows a flow chart of the V instruction portion (unlock or release) processing. In the P command part, the value of the semaphore is first decremented by 1 (S1901), and if the result is not a negative value of the semaphore (S1902, No), the process calling this P command part can acquire the resource. , And ends the process. If the result of S1901 is a negative value of the semaphore (S1902, Yes), the process must wait for resource acquisition, so the PCB of the process is inserted into the resource acquisition wait list (S1).
903), the process itself is put into a sleep state and execution is suspended (S1904). On the other hand, in the V instruction part, in FIG. 27, the value of the semaphore is first incremented by 1 (S2001), and as a result, the value of the semaphore is not 0 or less (S200).
(2, No), since there is no process waiting for resource acquisition, the process is terminated. As a result of S2001, if the value of the semaphore is 0 or less (S2002, Yes
s) Since there is a process waiting for resource acquisition, one PCB is taken out from the head of the waiting process list (S2003), and execution of the process of the PCB is restarted (S2004). The two instructions of step S1904 and step S2004 are provided by the operating system as basic system calls.

【0006】次に上記セマフォを用いた従来の共用排他
制御について説明する。読み込み系プロセスは次のデー
タ構造を共用する。 A,B:セマフォ; readcnt:integer型の変数; セマフォAとセマフォBの初期値は1であり、read
cntの初期値は0である。readcntは現在共用
資源にアクセス中の読み込み系プロセス(共用データを
読み出す処理を行うプロセス)の個数を数えるための変
数である。セマフォAは、readcntの値を更新す
るとき、readcntの相互排除を保証するために用
いる。セマフォBは、読み込み系プロセスと書き込み系
プロセス(共用データを更新するプロセス)の間の相互
排除および書き込み系プロセス間での相互排除を行うた
めに使用される。
Next, a conventional shared exclusive control using the semaphore will be described. The reading process shares the following data structure. A, B: semaphore; readcnt: integer type variable; initial values of semaphore A and semaphore B are 1, read
The initial value of cnt is 0. readcnt is a variable for counting the number of read-related processes (processes for reading shared data) currently accessing the shared resource. The semaphore A is used to guarantee mutual exclusion of readcnt when updating the value of readcnt. The semaphore B is used for mutual exclusion between a read process and a write process (process for updating shared data) and mutual exclusion between a write process.

【0007】読み込み系プロセスの一般的な構造は次の
ようになる。 P(A); readcnt=readcnt+1; if(readcnt==1) P(B); V(A); ・・・・・・・・ 読み取りが実行される。 ・・・・・・・・ P(A); readcnt=readcnt−1; if(readcnt==0) V(B); V(A); 一方、書き込み系プロセスの一般的な構造は次のように
なる。 P(B); ・・・・・・・・ 書き込みが実行される。 ・・・・・・・・ V(B);
The general structure of the reading process is as follows. P (A); readcnt = readcnt + 1; if (readcnt == 1) P (B); V (A);・ ・ ・ ・ ・ ・ ・ ・ P (A); readcnt = readcnt-1; if (readcnt == 0) V (B); V (A); On the other hand, the general structure of the writing process is as follows. become. P (B); ... Writing is executed.・ ・ ・ ・ ・ ・ ・ ・ V (B);

【0008】書き込み系プロセスの場合は、いままでの
排他制御と同じである。読み込み系プロセスで共用デー
タにアクセスしているものがない場合は次のようにな
る。まず、1番目のプロセスがセマフォAを獲得し、r
eadcntに1を加える。但しこの時、初期値として
readcntには0が入っているとする。次にrea
dcntが1に等しいのでセマフォBを獲得する。そし
てセマフォAを解放する。この後、第1番目の読み込み
系プロセスは共用データにアクセスを開始し、読み取り
が実行される。次に、2番目の読み込み系プロセスが共
用データにアクセスをしようとすると、まず始めにセマ
フォAを獲得する。セマフォAはこの時既に1番目の読
み込み系プロセスにより解放されているので獲得するこ
とができる。そしてreadcntに1を加え、rea
dcntの値を2とする。この時readcntは1で
はないので、セマフォBを獲得するという処理は行わ
ず、セマフォAを解放し読み取りを実行する。第3番目
の読み込み系プロセスが、共用データにアクセスする場
合も同じである。このように、初めて共用データにアク
セスする読み込み系プロセスの場合、readcntは
常に1となるのでセマフォBを獲得する。そして1つの
読み込み系プロセスがセマフォBを獲得することができ
たならば、他の読み込み系プロセスは新たにセマフォB
を獲得待ちする必要がなく、読み取りを実行することが
できる。ここでn個の読み込み系プロセスが読み取りを
実行しているとする。そしてその中の一つが読み取りを
終了した場合、セマフォAを獲得し、readcntか
ら1を引き現在共用データにアクセスしている読み込み
系プロセスの個数を1減らす。もし、この読み込み系プ
ロセスが最後のものであれば、readcntは0に等
しくなるのでこの時セマフォBを解放する。そしてセマ
フォAを解放する。このように読み込み系プロセスのみ
が共用データをアクセスする場合は、n個の読み込み系
プロセスが同時に共用データをアクセスすることができ
る。この時、初めの読み込み系プロセスのみがセマフォ
Bを獲得し、そして最後の読み込み系プロセスがセマフ
ォBを解放する。また、この時書き込み系プロセスが共
用データにアクセスしようとしてセマフォBを獲得しよ
うとしても、既に読み込み系プロセスがセマフォBを使
用しているので獲得することができず書き込み系プロセ
スはセマフォBの解放を待つことになる。
In the case of the write-related process, the exclusive control is the same as the conventional one. If no read process is accessing the shared data, the process is as follows. First, the first process acquires semaphore A and r
Add 1 to eadcnt. However, at this time, 0 is included in readcnt as an initial value. Then rea
Since dcnt is equal to 1, semaphore B is acquired. Then release semaphore A. After this, the first read-related process starts access to the shared data and the read is executed. Next, when the second read process tries to access the shared data, the semaphore A is first acquired. Since the semaphore A has already been released by the first reading process at this time, it can be acquired. Then add 1 to readcnt, and rea
The value of dcnt is 2. At this time, since readcnt is not 1, the process of acquiring the semaphore B is not performed and the semaphore A is released and the reading is executed. The same applies when the third read-related process accesses shared data. In this way, in the case of a read process that accesses shared data for the first time, readcnt is always 1, so semaphore B is acquired. If one reading process can acquire the semaphore B, another reading process newly acquires the semaphore B.
Can be read without having to wait for acquisition. Here, it is assumed that n reading processes are executing reading. When one of them has finished reading, the semaphore A is acquired, 1 is subtracted from readcnt, and the number of read-related processes currently accessing the shared data is reduced by 1. If this read process is the last one, readcnt becomes equal to 0, so the semaphore B is released at this time. Then release semaphore A. In this way, when only the read-related processes access the shared data, n read-related processes can simultaneously access the shared data. At this time, only the first reading process acquires the semaphore B, and the last reading process releases the semaphore B. Also, at this time, even if the writing process attempts to access the shared data and acquires the semaphore B, the reading process cannot use the semaphore B because the reading process already uses the semaphore B, and the writing process releases the semaphore B. I will wait.

【0009】もし、一つの書き込み系プロセスが共用デ
ータにアクセスしていて、n個の読み込み系プロセスが
待たされているとすると、一つの読み込み系プロセスは
セマフォBで待たされ、他のn−1個の読み込み系プロ
セスはセマフォAで待たされることになる。また、書き
込み系プロセスが共用データへのアクセスを終了してV
(B)を実行すると、セマフォBで待っていた読み込み
系か、または待っていた1つの書き込み系のプロセスの
実行が再開される。この時読み込み系プロセスの実行が
再開された場合は、セマフォAで待っていたn−1個の
読み込み系プロセスの処理が順次再開されることにな
る。
If one write process is accessing shared data and n read processes are waiting, one read process is kept waiting by semaphore B and the other n-1. Each reading process is kept waiting by the semaphore A. In addition, when the write-related process finishes accessing the shared data, V
When (B) is executed, the execution of the read system waiting for the semaphore B or the one writing process waiting for the semaphore B is resumed. At this time, when the execution of the reading process is restarted, the processing of the n-1 reading processes waiting in the semaphore A is sequentially restarted.

【0010】[0010]

【発明が解決しようとする課題】この従来のセマフォを
利用した共用排他制御方式では、読み込み系プロセスが
一端共用データにアクセスしてしまうと、以降では読み
込み系プロセス群は、無条件に共用データへアクセス可
能となる。このとき、共用データへアクセスしようとす
る書き込み系プロセスは、共用データへアクセスしてい
る読み込み系プロセスが全ていなくなるまで、待たなけ
ればならない。従って書き込み系プロセスの共用データ
へのアクセスが、読み込み系プロセス群によって不定時
間待たされてしまう問題が生じる。この問題は、読み込
み系プロセスの資源ロック要求が、長時間に渡り連続し
て起こらないような設計をすることにより防ぐことも可
能であるが、このような設計はかなり困難であり、開発
効率およびデバッグの負荷等もかかるという問題があ
る。
In the shared exclusive control method using the conventional semaphore, if the read process once accesses the shared data, the read process group unconditionally changes to the shared data. It becomes accessible. At this time, the writing process trying to access the shared data must wait until all the reading processes accessing the shared data are gone. Therefore, there is a problem that the access to the shared data of the writing process is delayed by the reading process group for an indefinite time. This problem can be prevented by designing so that the resource lock request of the reading process does not occur continuously for a long time, but such a design is quite difficult, and development efficiency and There is a problem that it also takes a debugging load.

【0011】本発明は、上記指摘したように、書き込み
系プロセスが資源割り当て飢餓状態に陥ることを回避す
るためになされたもので、アプリケーション設計の開発
効率およびシステムの正常動作を保証できる、と同時に
システム全体のスループットを向上させ、柔軟性の高い
排他制御を行う資源管理装置を提供することを目的とす
る。
As pointed out above, the present invention has been made in order to prevent the write-related process from falling into the resource allocation starvation state, and can guarantee the development efficiency of application design and the normal operation of the system. An object of the present invention is to provide a resource management device that improves the throughput of the entire system and performs flexible exclusive control.

【0012】[0012]

【課題を解決するための手段】この発明に係る共用資源
の資源管理装置は以下の要素を有するものである。 (a)読み込み系プロセスに対して共用排他的に共用資
源の獲得を実行する読み込み系命令部と、書き込み系プ
ロセスに対して排他的に共用資源の獲得を実行する書き
込み系命令部を備えた排他制御部、(b)読み込み系プ
ロセスに対して、上記排他制御部の読み込み系命令部を
実行させ、書き込み系プロセスに対して、上記排他制御
部の書き込み命令部を実行させる制御手段。
A resource management apparatus for shared resources according to the present invention has the following elements. (A) Exclusive with a read instruction unit that executes shared acquisition of a shared resource for a read process and a write instruction unit that executes acquisition of a shared resource exclusively for a write process (B) control means for causing the read-related process to execute the read-related command part of the exclusive control part and causing the write-related process to execute the write command part of the exclusive control part.

【0013】上記制御手段は、読み込み系プロセスと書
き込み系プロセスに対して資源獲得優先度を割り当て、
資源獲得優先度に基づいて、読み込み系プロセスと書き
込み系プロセスに対する上記排他制御部による資源獲得
順を決定することを特徴とする。
The control means assigns resource acquisition priorities to the reading process and the writing process,
It is characterized in that the order of resource acquisition by the exclusive control unit for the read process and the write process is determined based on the resource acquisition priority.

【0014】上記資源獲得優先度としてプロセス固有の
属性値を用いることを特徴とする。
It is characterized in that a process-specific attribute value is used as the resource acquisition priority.

【0015】上記プロセス固有の属性値としてプロセス
のスケジューリング優先度を用いることを特徴とする。
The process scheduling priority is used as the attribute value peculiar to the process.

【0016】プロセス固有の属性値としてプロセスの既
占有資源数を用いることを特徴とする。
It is characterized in that the number of already occupied resources of the process is used as the attribute value peculiar to the process.

【0017】プロセス固有の属性値として主メモリ上に
存在するプロセス実行イメージの主メモリ占有容量を用
いることを特徴とする。
The feature is that the main memory occupation capacity of the process execution image existing on the main memory is used as the attribute value peculiar to the process.

【0018】プロセス固有の属性値としてプロセスのC
PU使用時間を用いることを特徴とする。
C of the process as a process-specific attribute value
It is characterized by using PU usage time.

【0019】プロセス固有の属性値としてプロセスの処
理重要度を用いることを特徴とする。
It is characterized in that the processing importance of the process is used as the attribute value unique to the process.

【0020】上記資源獲得優先度の値を資源獲得要求時
に明示的に指定できることを特徴とする。
It is characterized in that the value of the resource acquisition priority can be explicitly designated at the time of resource acquisition request.

【0021】上記資源獲得優先度をプロセス毎に各資源
に対応して予め登録できる手段を設けたことを特徴とす
る。
A feature is provided in which means for registering the resource acquisition priority in advance for each process for each resource is provided.

【0022】上記資源獲得優先度の値としてプロセスの
資源占有時間を用いることを特徴とする。
The resource occupancy time of the process is used as the value of the resource acquisition priority.

【0023】上記資源獲得優先度の値を任意個の尺度の
組合せで決定することを特徴とする。
It is characterized in that the value of the resource acquisition priority is determined by a combination of arbitrary scales.

【0024】資源獲得優先度の設定方式を複数種類備
え、各資源毎に資源獲得優先度の設定方式を選択する手
段を設けたことを特徴とする。
A plurality of types of resource acquisition priority setting methods are provided, and means for selecting a resource acquisition priority setting method for each resource is provided.

【0025】[0025]

【作用】本発明において、制御手段は、読み込み系プロ
セスに対し排他制御部の読み込み系命令部を実行させ、
書き込み系プロセスに対し排他制御部の書き込み系命令
部を実行させる。そのため、読み込み系プロセスと書き
込み系プロセスとでは、異なる制御を実現することがで
きる。
In the present invention, the control means causes the read system process to execute the read system command section of the exclusive control section,
Causes the write process to execute the write command unit of the exclusive control unit. Therefore, different controls can be realized in the reading process and the writing process.

【0026】本発明において、上記制御手段は、読み込
み系プロセスと書き込み系プロセスに対して資源獲得優
先度を割り当てる。そのため、上記排他制御部の読み込
み系命令部と書き込み系命令部は、資源獲得優先度に基
づき、読み込み系プロセスと書き込み系プロセスに対し
て、資源獲得順を決定することができる。また、書き込
み系プロセスの資源獲得飢餓状態を回避することができ
る。
In the present invention, the control means assigns the resource acquisition priority to the reading process and the writing process. Therefore, the read instruction unit and the write instruction unit of the exclusive control unit can determine the resource acquisition order for the read process and the write process based on the resource acquisition priority. In addition, the resource acquisition starvation state of the writing process can be avoided.

【0027】本発明において、資源獲得優先度としてプ
ロセス固有の属性値を用いる。
In the present invention, a process-specific attribute value is used as the resource acquisition priority.

【0028】本発明において、プロセス固有の属性値と
してプロセスのスケジューリング優先度を用いる。
In the present invention, the scheduling priority of a process is used as a process-specific attribute value.

【0029】本発明において、プロセス固有の属性値と
してプロセス既占有資源数を用いる。
In the present invention, the number of resources already occupied by the process is used as the attribute value unique to the process.

【0030】本発明において、プロセス固有の属性値と
して主メモリ上に存在するプロセス実行イメージの主メ
モリ占有容量を用いる。
In the present invention, the main memory occupation capacity of the process execution image existing on the main memory is used as the attribute value peculiar to the process.

【0031】本発明において、プロセス固有の属性値と
してプロセスのCPU使用時間を用いる。
In the present invention, the CPU usage time of a process is used as a process-specific attribute value.

【0032】本発明において、プロセス固有の属性値と
してプロセスの処理重要度を用いる。
In the present invention, the processing importance of the process is used as the attribute value unique to the process.

【0033】本発明において、資源獲得優先度の値を各
資源に応じて資源獲得要求時に明示的に指定できる。
In the present invention, the value of resource acquisition priority can be explicitly specified at the time of resource acquisition request according to each resource.

【0034】本発明において、資源獲得優先度をプロセ
ス毎に各資源に応じて予め登録できる手段を設けた。
In the present invention, means for registering the resource acquisition priority for each process in advance according to each resource is provided.

【0035】本発明において、予め登録する各資源に対
するプロセスの資源獲得優先度の値としてプロセスの資
源占有時間を用いる。
In the present invention, the process resource occupation time is used as the value of the process resource acquisition priority for each resource registered in advance.

【0036】本発明において、上記資源獲得優先度の値
を任意個の尺度の組合せで決定する。
In the present invention, the value of the resource acquisition priority is determined by a combination of arbitrary scales.

【0037】本発明において、資源獲得優先度の設定方
式を複数種類備え、各資源毎に資源獲得優先度の設定方
式を選択する。
In the present invention, a plurality of types of resource acquisition priority setting methods are provided, and the resource acquisition priority setting method is selected for each resource.

【0038】[0038]

【実施例】【Example】

実施例1.この実施例の基本構成を図1に示す。1はメ
モリ、メモリ1にはセマフォ管理テーブル2とプロセス
制御ブロック(以下PCBと称する)6が格納されてい
る。セマフォ管理テーブル2内は、セマフォの獲得待ち
プロセスのリストへのポインタとして待ちプロセスリス
トポインタ181と、セマフォの獲得待ちをしているプ
ロセスの数を示すセマフォの値(valueともいう)
182と、資源をアクセスしている読み込み系プロセス
の個数を数えるための変数readcounter3、
セマフォ獲得待ちプロセスのうち最も資源獲得優先度が
高い書き込み系プロセスへのポインタ(PTR)4、こ
のセマフォを獲得しているプロセスのロックモード(読
み込みモード/書き込みモード)5の各領域から構成さ
れる。セマフォの値182の初期値は1、readco
unter3の初期値は0である。PTR4が何も指さ
ない場合はNullである。PCB6内には、待ちプロ
セスリストを形成するためのPCBへのポインタとして
nextポインタ184と、プロセスの資源獲得優先度
格納領域である資源獲得優先度7および資源ロックモー
ド(読み込みモード/書き込みモード)格納領域である
資源ロックモード8がある。資源獲得待ちプロセスリス
トは、各待ちプロセスのプロセス制御ブロック(PC
B)6を資源獲得優先度7の値を降順にPCBのnex
tポインタ184を用いてリンクしたリストである。排
他制御部10には、読み込み系P命令部20、書き込み
系P命令部30、読み込み系V命令部40および書き込
み系V命令部50が含まれる。P命令部およびV命令部
は、従来同様に不可分な単位として実行される必要があ
るため、割り込み禁止区間で実行される。
Example 1. The basic configuration of this embodiment is shown in FIG. Reference numeral 1 denotes a memory, and the memory 1 stores a semaphore management table 2 and a process control block (hereinafter referred to as a PCB) 6. In the semaphore management table 2, a waiting process list pointer 181 as a pointer to a list of processes waiting to acquire a semaphore, and a semaphore value indicating the number of processes waiting to acquire a semaphore (also referred to as value).
182 and a variable readcounter3 for counting the number of read processes that are accessing the resource,
It is composed of a pointer (PTR) 4 to a write-related process having the highest resource acquisition priority among the processes waiting for semaphore acquisition, and a lock mode (read mode / write mode) 5 of the process acquiring this semaphore. . The initial value of the semaphore value 182 is 1, readco
The initial value of unter3 is 0. Null if PTR4 points to nothing. In the PCB 6, the next pointer 184 as a pointer to the PCB for forming the waiting process list, the resource acquisition priority 7 which is the process resource acquisition priority storage area, and the resource lock mode (read mode / write mode) storage There is an area resource lock mode 8. The resource acquisition waiting process list is a process control block (PC
B) 6 for resource acquisition priority 7 in descending order of PCB next
It is a list linked using the t pointer 184. The exclusive control unit 10 includes a read system P command unit 20, a write system P command unit 30, a read system V command unit 40, and a write system V command unit 50. Since the P instruction part and the V instruction part need to be executed as an indivisible unit as in the conventional case, they are executed in the interrupt prohibited section.

【0039】この実施例の特徴は、従来例では排他制御
部にP命令部、V命令部しかなかったものを、読み込み
系、書き込み系それぞれにP命令部、V命令部を持たせ
た点である。また、セマフォ管理テーブル2に、rea
dcounter3とPTR4、ロックモード5を持た
せ、PCB6には資源獲得優先度7と、資源ロックモー
ド8を持たせた点である。実施例1におけるP命令部、
V命令部とも引数にはセマフォ(S)とロックモード
(RorW)を指定する。セマフォの値の初期値は1で
あり、RはRead、WはWriteを示す。このた
め、従来のセマフォを利用した共用排他制御方式では、
一度に2個のセマフォを用いたが、1個のセマフォによ
り制御する点が特徴である。
The feature of this embodiment is that the read control system and the write system have a P command section and a V command section, respectively, whereas the prior art example had only the P command section and V command section. is there. Also, in the semaphore management table 2,
This is that dcounter 3, PTR 4 and lock mode 5 are provided, and PCB 6 is provided with resource acquisition priority 7 and resource lock mode 8. P command part in the first embodiment,
In both the V command section, a semaphore (S) and a lock mode (RorW) are designated as arguments. The initial value of the semaphore is 1, R indicates Read and W indicates Write. Therefore, in the shared exclusive control method using the conventional semaphore,
Two semaphores were used at one time, but the feature is that they are controlled by one semaphore.

【0040】図2は実施例1による読み込み系P命令部
20の概要である。まず、このP命令部を呼び出したプ
ロセスのPCBの資源ロックモード8を読み込みモード
に設定する(S201)。次に従来のP命令部と同様に
してステップS1901において、セマフォSのval
ueの値を−1し、S1902においてセマフォSのv
alueの値<0を調べる。S1902による判定がN
oであれば、この処理を呼び出した読み込み系プロセス
が資源獲得することができることを示すため、セマフォ
をロックしている読み込み系プロセスの個数を数える変
数readcounterの値を+1し(S207)、
セマフォの現在のロックモード5を読み込みモードに設
定して(S208)処理を終了する。
FIG. 2 is an outline of the read system P command section 20 according to the first embodiment. First, the resource lock mode 8 of the PCB of the process that called the P command part is set to the read mode (S201). Next, as in the conventional P command section, in step S1901, the semaphore S val
The value of ue is decremented by 1 and the v of the semaphore S is incremented in S1902.
Check the value of value <0. The judgment in S1902 is N
If the value is o, it indicates that the read process that called this process can acquire the resource, so the value of the variable readcounter that counts the number of read processes that lock the semaphore is incremented by 1 (S207),
The current lock mode 5 of the semaphore is set to the read mode (S208), and the process ends.

【0041】S1902による判定がYesであれば、
資源獲得待ちをする可能性があることを示す。なぜなら
ば、資源が書き込み系プロセスにより占有されていれ
ば、新たに資源獲得要求をだした読み込み系プロセスは
資源獲得待ちをする必要がある。一方、資源が読み込み
系プロセスにより占有されていれば、新たに資源獲得要
求をだした読み込み系プロセスは、資源獲得優先度によ
りそのまま資源を獲得できる場合と、資源獲得待ちをす
る必要がある場合がある。このように、読み込み系プロ
セスのP命令部ではセマフォSのロックモードによって
処理を区別する必要があるため、S202によりセマフ
ォSのロックモードの判定を行っている。
If the determination in S1902 is Yes,
Indicates that there is a possibility of waiting for resource acquisition. This is because, if the resource is occupied by the writing process, the reading process that newly issued the resource acquisition request needs to wait for the resource acquisition. On the other hand, if the resource is occupied by the reading process, the reading process that newly issued the resource acquisition request may acquire the resource as it is according to the resource acquisition priority or may need to wait for the resource acquisition. is there. As described above, in the P command part of the read-related process, it is necessary to distinguish the processing depending on the lock mode of the semaphore S, and therefore the lock mode of the semaphore S is determined in S202.

【0042】現在のロックモードが書き込みモードでな
ければ(S202、No)、S203へと処理が渡る。
S203において、セマフォSのPTRがNull即
ち、PTRが指しているPCBが無いかを判定し、無け
れば(S203、Yes)、S205へと処理が渡る。
S203による判定がNoであれば、この処理を呼び出
した(資源ロック要求を行った)読み込み系プロセス
と、同資源の獲得待ちを行っているプロセス中最も資源
獲得優先度が高い書き込み系プロセスの資源獲得優先度
を比較する(S204)。ステップS204の結果、該
読み込み系プロセスの資源獲得優先度が高ければ(Ye
s)、資源の獲得待ちをする必要がないため、ステップ
S1901で更新していたセマフォの値をもとに戻して
から(S205)、ステップS207、S208を実行
して処理を終了する。一方、書き込み系プロセスの資源
獲得優先度が高ければ(S204、No)、資源ロック
要求を行った読み込み系プロセスを、資源待ちプロセス
リストへ資源獲得優先度順(降順)に挿入し(S20
6)、休眠状態にして資源が解放されるまで実行を封鎖
する(S1904)。
If the current lock mode is not the write mode (S202, No), the process proceeds to S203.
In S203, it is determined whether or not the PTR of the semaphore S is Null, that is, there is no PCB pointed to by the PTR. If there is no (S203, Yes), the process proceeds to S205.
If the determination in S203 is No, the resources of the read process that called this process (requested the resource lock) and the write process with the highest resource acquisition priority among the processes waiting to acquire the same resource The acquisition priorities are compared (S204). As a result of step S204, if the resource acquisition priority of the reading process is high (Yes
s) Since it is not necessary to wait for the acquisition of resources, the value of the semaphore updated in step S1901 is returned to the original value (S205), then steps S207 and S208 are executed, and the process ends. On the other hand, if the resource acquisition priority of the write process is high (S204, No), the read process that made the resource lock request is inserted into the resource waiting process list in the resource acquisition priority order (descending order) (S20).
6) Then, the execution is blocked until the resource is released in the sleep state (S1904).

【0043】また、ステップS202の判定の結果現在
のロックモードが書き込みモードであれば(S202、
Yes)、ステップS206、S1904を実行して資
源ロック要求を行った読み込み系プロセスを資源が解放
されるまで封鎖する。休眠状態の読み込み系プロセス
は、資源が解放されて資源の獲得が可能になると実行可
能状態となり、S207から処理を再開することにな
る。以上の処理では、S204において、PTRが指し
ている書き込み系プロセスとこの読み込み系プロセスの
資源獲得優先度を比較し、これにより待ちプロセスリス
トに加えるか実行を行うか判定することにより、書き込
み系プロセスが資源割り当て飢餓状態に陥ることを回避
する点が特徴である。
If the current lock mode is the write mode as a result of the determination in step S202 (S202,
Yes), executing steps S206 and S1904 to block the read process that has made the resource lock request until the resource is released. When the resources are released and the resources can be acquired, the dormant read-related process becomes the executable state, and the process is restarted from S207. In the above process, in S204, the write process indicated by the PTR is compared with the resource acquisition priority of the read process to determine whether the process is added to the waiting process list or executed. The feature is that it avoids the resource allocation starvation.

【0044】次に図3を用いて書き込み系P命令部30
の処理の流れについて述べる。まず、このP命令部を呼
び出したプロセスのPCBの資源ロックモード8を書き
込みモードに設定する(S301)。次に従来のP命令
部と同様にしてセマフォSのvalueの値を−1し
(S1901)、セマフォSのvalueの値<0を判
定する(S1902)。S1902による判定がNoで
あれば、この処理を呼び出した書き込み系プロセスが資
源獲得することができることを示し、セマフォの現在の
ロックモード5を書き込みモードに設定して(S30
3)処理を終了する。ステップS1902による判定が
Yesであれば、資源獲得待ちをする必要があることを
示す。S204において、同資源の獲得待ちを行ってい
るプロセス中最も資源獲得優先度が高い書き込み系プロ
セスと、この処理を呼び出した書き込み系プロセスとの
資源獲得優先度を比較する、またはPTR4がNull
かを判定する。呼び出した書き込み系プロセスの資源獲
得優先度が高ければ、またはPTR4がNullであれ
ばセマフォのPTR4がこのプロセスのPCB6を指す
ように更新し(S302)、そうでなければPTR4の
値は更新しない。最後に、呼び出した書き込み系プロセ
スを資源待ちプロセスリストへ資源獲得優先度順(降
順)に挿入し(S206)、休眠状態にして資源が解放
されるまで実行を封鎖する(S1904)。資源をロッ
ク中のプロセスがV命令部を実行したことにより封鎖が
解除された書き込み系プロセスは、ステップS303か
ら処理を再開する。
Next, referring to FIG. 3, the write system P command section 30
The processing flow of is described. First, the resource lock mode 8 of the PCB of the process that called the P command part is set to the write mode (S301). Then, the value of the value of the semaphore S is decremented by -1 (S1901) in the same manner as in the conventional P command unit, and the value of the value of the semaphore S <0 is determined (S1902). If the determination in S1902 is No, it indicates that the write-related process that called this process can acquire resources, and sets the current lock mode 5 of the semaphore to the write mode (S30
3) End the process. If the determination in step S1902 is Yes, it indicates that it is necessary to wait for resource acquisition. In S204, the resource acquisition priority of the write-related process having the highest resource acquisition priority among the processes waiting for acquisition of the same resource and the write-related process that called this processing is compared, or PTR4 is Null.
To determine. If the resource acquisition priority of the called write-related process is high, or if PTR4 is Null, the semaphore PTR4 is updated to point to the PCB 6 of this process (S302), otherwise the value of PTR4 is not updated. Finally, the called write processes are inserted into the resource waiting process list in the order of resource acquisition priority (descending order) (S206), put into the sleep state and execution is blocked until the resources are released (S1904). The write-related process whose blockade has been released due to the process that has locked the resource executing the V instruction part restarts processing from step S303.

【0045】次に図4を用いて、読み込み系V命令部4
0の処理の流れについて述べる。まず、この処理を呼び
出した読み込み系プロセスが資源を占有している唯一の
読み込み系プロセスであるかを判別する(S401)。
唯一の読み込み系プロセスでなければ(No)、現在資
源にアクセス中の読み込み系プロセスの個数を数える変
数readcounterの値を−1する(S403)
だけで処理を終了する。一方、呼び出した読み込み系プ
ロセスが資源にアクセスしている唯一の読み込み系プロ
セスであれば、資源の解放を行うために従来のV命令部
200と同様の処理S2001からS2004を行う。
まずセマフォの値を+1して(S2001)、その結果
セマフォの値が0以下の値でなければ(S2002,N
o)、資源獲得待ちをしているプロセスが存在しないた
めS403を実行し、終了する。S2001の結果セマ
フォの値が0以下の値であれば(S2002,Ye
s)、資源獲得待ちをしているプロセスが存在する。そ
こで、セマフォのPTR4が次に高い資源獲得優先度の
書き込み系プロセスを指すよう書き換える。次の書き込
み系プロセスがない場合はNullとする(S40
2)。次に、待ちプロセスリストの先頭からPCBを1
つ取り出し(S2003)、そのPCBのプロセスの実
行を再開させる(S2004)。その後、readco
unterの値を−1して(S403)処理を終了す
る。
Next, referring to FIG. 4, the read system V instruction unit 4
The processing flow of 0 will be described. First, it is determined whether or not the reading process that called this process is the only reading process that occupies the resource (S401).
If it is not the only reading process (No), the value of the variable readcounter that counts the number of reading processes currently accessing the resource is decremented by 1 (S403).
Only ends the process. On the other hand, if the calling read process is the only read process that is accessing the resource, the same processes S2001 to S2004 as the conventional V command unit 200 are performed to release the resource.
First, the value of the semaphore is incremented by 1 (S2001), and as a result, the value of the semaphore is not 0 or less (S2002, N
o) Since there is no process waiting for resource acquisition, S403 is executed and the process ends. If the value of the semaphore as a result of S2001 is a value of 0 or less (S2002, Ye
s), there are processes waiting for resource acquisition. Therefore, the semaphore PTR4 is rewritten to point to the write-related process having the next highest resource acquisition priority. If there is no next write-related process, Null is set (S40).
2). Next, from the head of the waiting process list, set PCB to 1
One is taken out (S2003), and execution of the process of the PCB is restarted (S2004). Then readco
The value of unter is decremented by -1 (S403), and the process ends.

【0046】次に図5を用いて、書き込み系V命令部5
0の処理の流れについて述べる。S2001,S200
2は従来のV命令部と同じである。S2002の判定が
Noであれば、資源待ちを行っているプロセスがいない
ことを示すため、このまま処理を終了する。一方、S2
002の判定がYesであれば、資源獲得待ちを行って
いるプロセスが存在することを示すため、資源待ちを行
っているプロセスの実行を再開させる処理を行う。待ち
プロセスの実行を再開させる処理は、セマフォSのPT
Rの値がNullか否か判定し(S203)、Null
の場合は(S203、Yes)資源獲得待ちをしている
書き込み系プロセスが存在しないため、S502へと処
理が渡る。S502において待ちプロセスは全て読み込
み系プロセスであるため、全てのプロセスをリストから
外す。次にS504において、リストからはずした全て
のプロセスの実行を再開させ処理を終了する。S203
の判定がNoであれば、まず資源待ちプロセスリストの
先頭のプロセスの資源要求ロックモードが書き込みモー
ドであるかを判定し(S501)、書き込みモードであ
れば(Yes)、セマフォS内のPTR4が待ちプロセ
スのうち次に資源獲得優先度が高い書き込み系プロセス
のPCB6を指すように更新(次の書き込み系プロセス
がない時はNullとする)した後(S402)、待ち
プロセスリストの先頭のPCB6をリストから削除し
(S2003)、該PCBに対応するプロセスを休眠状
態から実行可状態へと変更させて(S504)処理を終
了する。S501の判定の結果、資源待ちプロセスリス
トの先頭のプロセスの資源要求ロックモード8が読み込
みモードであれば(No)、資源待ちプロセスリストの
先頭からPTR4が指す書き込み系プロセスの直前まで
の全ての読み込み系プロセスを待ちプロセスリストから
外して(S503)、各プロセスを休眠状態から実行可
状態へと変更させて(S504)処理を終了する。
Next, referring to FIG. 5, the write system V command section 5
The processing flow of 0 will be described. S2001, S200
2 is the same as the conventional V command section. If the determination in S2002 is No, it means that there is no process waiting for the resource, and the process is terminated as it is. On the other hand, S2
If the determination of 002 is Yes, it means that there is a process waiting for the resource acquisition, and therefore, the process of restarting the execution of the process waiting for the resource is performed. The process for restarting the execution of the waiting process is the PT of the semaphore S.
It is determined whether the value of R is Null (S203), and Null
In the case of (S203, Yes), since there is no write-related process waiting for the resource acquisition, the process proceeds to S502. In S502, all the waiting processes are reading processes, so all the processes are removed from the list. Next, in step S504, execution of all the processes removed from the list is restarted, and the processing ends. S203
If the determination is No, first, it is determined whether the resource request lock mode of the first process in the resource waiting process list is the write mode (S501), and if it is the write mode (Yes), the PTR4 in the semaphore S After updating the PCB6 of the writing process with the next highest resource acquisition priority among the waiting processes (Null when there is no next writing process) (S402), the first PCB6 in the waiting process list is updated. The process is deleted from the list (S2003), the process corresponding to the PCB is changed from the sleep state to the executable state (S504), and the process ends. If the result of the determination in S501 is that the resource request lock mode 8 of the process at the head of the resource waiting process list is the read mode (No), all reads from the beginning of the resource waiting process list to immediately before the write-related process pointed to by PTR4. The system process is removed from the waiting process list (S503), each process is changed from the sleep state to the executable state (S504), and the process ends.

【0047】次に、図6に示すプロセスAからGが1つ
のファイルにアクセスする場合を例にとり、図2から図
5の処理の流れを具体的に述べる。ここで、図6のpr
iは、各プロセスの資源獲得優先度を意味する。 (1)Aプロセスがファイルに読み込み要求を行う。た
だし、これ以前にどのプロセスもアクセスしていないも
のとする。図2の読み込み系P命令部は、このプロセス
の資源ロックモード8を読み込みモードに設定する(S
201)。次に、セマフォSのvalueの値を−1
し、0とする(S1901)。セマフォSのvalue
の値が0以下かを調べ(S1902)この時value
の値は0なのでNoとなり、この処理を呼び出した読み
込み系プロセスが資源獲得することができる。そこで次
にS207において、セマフォSのreadcount
erの値を+1し、+1とする。S208においてセマ
フォSのロックモードを読み込みモードに設定し、終了
する。
Next, the processing flow of FIGS. 2 to 5 will be specifically described by taking as an example the case where the processes A to G shown in FIG. 6 access one file. Here, pr in FIG.
i means the resource acquisition priority of each process. (1) Process A issues a read request to a file. However, it is assumed that no process has accessed before this. The read P command section in FIG. 2 sets the resource lock mode 8 of this process to the read mode (S
201). Next, set the value of value of semaphore S to -1
To 0 (S1901). Semaphore S value
Whether the value of is 0 or less (S1902) At this time value
Since the value of is 0, the result is No, and the reading process that called this process can acquire the resource. Then, next in S207, the readcount of the semaphore S
The value of er is incremented by 1 to be +1. In S208, the lock mode of the semaphore S is set to the read mode, and the process ends.

【0048】(2)Bプロセスがファイルに読み込みを
要求する。図2において、セマフォSのvalueの値
は−1となる(S1901)。次に、S1902におい
てセマフォSの値が0以下となるので、S202の処理
にいく。S202においてセマフォSのロックモードが
書き込みモードか否か調べ、この場合は読み込みモード
なのでNoとなり、S203へいく。S203において
PTRが指しているプロセスが存在するか否かを調べる
ため、PTRがNullであるかを判定し、Yesとな
りS205にいく。S205においてセマフォSのva
lueの値を+1する。次に、S207においてセマフ
ォSのreadcounterの値を+1する。セマフ
ォSのロックモードを読み込みモードに設定し(S20
8)、終了する。この時点でAプロセスとBプロセスが
ファイルから読み込みを行っているので、readco
unterの値は2となり、セマフォSのvalueの
値は0となっている。読み込み系プロセスが同時にアク
セスしているならば図2のS1901で−1を行い、S
205で+1を行っているので、読み込み系プロセスの
個数がいくつに増えてもセマフォSの値は変化しない。
(2) Process B requests the file for reading. In FIG. 2, the value of the value of the semaphore S becomes -1 (S1901). Next, since the value of the semaphore S becomes 0 or less in S1902, the process proceeds to S202. In S202, it is checked whether the lock mode of the semaphore S is the write mode. In this case, since it is the read mode, the determination is No, and the process proceeds to S203. In S203, in order to check whether or not there is a process pointed to by the PTR, it is determined whether the PTR is Null, and the result is Yes and the process proceeds to S205. Va of the semaphore S in S205
Add 1 to the value of lue. Next, in S207, the value of readcounter of the semaphore S is incremented by one. Set the lock mode of the semaphore S to the read mode (S20
8) The process ends. At this point, process A and process B are reading from the file, so readco
The value of unter is 2, and the value of value of the semaphore S is 0. If the reading processes are accessing at the same time, -1 is performed in S1901 of FIG.
Since +1 is performed in 205, the value of the semaphore S does not change no matter how many read-related processes increase.

【0049】(3)Cプロセスがファイルに書き込み要
求をする。書き込み要求なので図3の書き込み系P命令
部の処理の流れに従う。S301においてこのプロセス
の資源ロックモードを書き込みモードに設定する。S1
901においてセマフォSのvalueの値を−1する
と−1となる。S1902においてセマフォSの値が0
以下となるのでYesとなり、S203においてPTR
がNullであるか調べる。ここで、PTRがNull
であるのでYesとなり、次にS302の処理を行う。
S302においてPTRがこのプロセスを指すように更
新する。S206においてこのプロセスをセマフォSの
待ちプロセスリストに加える。S1904においてこの
プロセスを休眠状態とする。この時の待ちプロセスリス
トを図7に示す。図7において、待ちプロセスリストポ
インタ181はCプロセスのPCB6を指し、またセマ
フォ管理テーブル2のvalueの値182は−1とな
り、この時プロセスAとBが読み込みを行っているので
readcounterの値は2となる。Cプロセスが
書き込み系プロセスであるので、PTR4はCプロセス
のPCB6を指す。次に、ロックモードはreadであ
る。またCプロセスのPCB6は資源獲得優先度7は4
であり、資源ロックモード8はwriteである。
(3) The C process requests writing to the file. Since it is a write request, it follows the flow of processing of the write-system P command section in FIG. In S301, the resource lock mode of this process is set to the write mode. S1
In 901, the value of the value of the semaphore S is subtracted by -1 to obtain -1. The value of the semaphore S is 0 in S1902.
It becomes the following because it becomes the following, PTR in S203
Is Null. Where PTR is Null
Therefore, the result is Yes, and then the process of S302 is performed.
In S302, the PTR is updated to point to this process. In S206, this process is added to the waiting process list of the semaphore S. In step S1904, this process is put to sleep. The waiting process list at this time is shown in FIG. In FIG. 7, the waiting process list pointer 181 points to the PCB 6 of the C process, and the value 182 of the value in the semaphore management table 2 becomes -1, and since the processes A and B are reading at this time, the value of readcounter is 2. Becomes Since the C process is a write process, the PTR4 indicates the PCB 6 of the C process. Next, the lock mode is read. Also, the PCB 6 of the C process has the resource acquisition priority 7 of 4
And the resource lock mode 8 is write.

【0050】(4)Dプロセスがファイルに読み込みを
要求する。読み込みであるので、図2の読み込み系P命
令部の処理に従う。セマフォSの値は−2となり、S2
02、S203、S204の処理へいく。S204にお
いてセマフォSのPTRが指しているプロセスの資源獲
得優先度よりこのプロセスの資源獲得優先度が高いかど
うかを調べる。図7からセマフォSのPTRが指してい
るプロセスの資源獲得優先度は4であり、Dプロセスの
資源獲得優先度は2であるのでNoとなり、次にS20
6の処理へいく。S206においてこのプロセスを資源
獲得優先度順でセマフォSの待ちプロセスリストへ加
え、このプロセスを休眠状態とする(S1904)。こ
の時のセマフォ管理テーブルとプロセス制御ブロックを
図8に示す。図8において、セマフォ管理テーブルでセ
マフォの値valueは−2となり、また、図7のCプ
ロセスの後にDプロセスのPCBがポイントされてい
る。 (5)Eプロセスが書き込み要求を行う。書き込み要求
なので書き込み系P命令部の図3の処理に従う。セマフ
ォSの値は−3となるので、S203の処理へいく。S
203においてPRTがNullではないので、S20
4においてセマフォSのPTRが指しているプロセスの
資源獲得優先度よりこのプロセスの資源獲得優先度が高
いかどうかを調べる。Eプロセスの資源獲得優先度は1
であり、セマフォSのPTRが指しているCプロセスの
資源獲得優先度は4であるのでNoとなりS206の処
理へいく。S206以下でこのプロセスをセマフォSの
待ちプロセスリストへ加え、休眠状態とする。この時の
セマフォ管理テーブルとPCBを図9に示す。図9は図
8にEプロセスのPCBが加わったものである。またこ
の時のセマフォ管理テーブルのvalueの値は−3で
ある。
(4) The D process requests the file to be read. Since it is reading, the processing of the reading system P command section in FIG. 2 is followed. The value of semaphore S becomes -2, and S2
02, S203, and S204. In S204, it is checked whether the resource acquisition priority of this process is higher than the resource acquisition priority of the process pointed to by the PTR of the semaphore S. From FIG. 7, the resource acquisition priority of the process pointed to by the PTR of the semaphore S is 4, and the resource acquisition priority of the D process is 2, so the result is No, and then S20.
Go to 6 processing. In S206, this process is added to the waiting process list of the semaphore S in the resource acquisition priority order, and this process is put to sleep (S1904). FIG. 8 shows the semaphore management table and process control block at this time. In FIG. 8, the value value of the semaphore is -2 in the semaphore management table, and the PCB of the D process is pointed after the C process of FIG. (5) Process E makes a write request. Since this is a write request, the processing of the write-related P command section in FIG. 3 is followed. Since the value of the semaphore S is -3, the process goes to S203. S
Since PRT is not Null in 203, S20
In step 4, it is checked whether the resource acquisition priority of this process is higher than the resource acquisition priority of the process pointed to by the PTR of the semaphore S. E process resource acquisition priority is 1
Since the resource acquisition priority of the C process indicated by the PTR of the semaphore S is 4, the result is No and the process proceeds to S206. After S206, this process is added to the waiting process list of the semaphore S and put into a sleep state. FIG. 9 shows the semaphore management table and the PCB at this time. FIG. 9 is a diagram in which the PCB of the E process is added to FIG. The value of value in the semaphore management table at this time is -3.

【0051】(6)Fプロセスが読み込み要求をする。
Fプロセスの資源獲得優先度は5である。図2の読み込
み系P命令部の処理に従う。セマフォSの値は−4とな
り、S202、S203、S204へと処理が渡る。S
204において、PTRの指しているプロセスの資源獲
得優先度は4、Fプロセスの資源獲得優先度は5である
のでYesとなり、ファイルへアクセス可能となりS2
05へいく。S205において、セマフォSの値を+1
すると−3となる。次に、S207においてセマフォS
のreadcounterの値を+1し、3とする。セ
マフォSのロックモードを読み込みモードに設定し(S
208)終了する。この時、Fプロセスの資源獲得優先
度がセマフォSのPTRが指しているCプロセスの資源
獲得優先度よりも高いので、ファイルからの読み込みを
待たずに行える。読み込みが直ちに開始されるのでFプ
ロセスは待ちプロセスリストに加えられることはない。 (7)Gプロセスが読み込みを要求する。Gプロセスの
資源獲得優先度は3である。図2の読み込み系P命令部
の処理に従う。セマフォSの値は−4となり、S20
2、203、204と処理が渡る。S204において、
セマフォSのPTRの指しているプロセスの資源獲得優
先度は4であり、このプロセスの資源獲得優先度は3で
あるのでNoとなりS206へ処理が移る。S206に
おいてこのプロセスをセマフォSの待ちプロセスリスト
へ資源獲得優先度順に加える。このプロセスを休眠状態
とし(S1904)、終了する。この時点におけるセマ
フォ管理テーブルとPCBを図10に示す。図10は新
しく待ちプロセスリストに加えるGプロセスの資源獲得
優先度が3であるのでCプロセスとDプロセスの間に加
えられる点が図9との違いである。またセマフォ管理テ
ーブルのvalueの値が−4であり、readcou
nterの値が+3である。
(6) Process F issues a read request.
The resource acquisition priority of the F process is 5. The processing of the read system P command section in FIG. 2 is followed. The value of the semaphore S becomes -4, and the processing passes to S202, S203, and S204. S
In 204, since the resource acquisition priority of the process pointed to by the PTR is 4 and the resource acquisition priority of the F process is 5, the answer is Yes, and the file can be accessed S2.
Go to 05. In S205, the value of semaphore S is incremented by +1
Then it becomes -3. Next, in S207, the semaphore S
The value of readcounter of is incremented by 1 and set to 3. Set the lock mode of the semaphore S to read mode (S
208) Finish. At this time, since the resource acquisition priority of the F process is higher than the resource acquisition priority of the C process indicated by the PTR of the semaphore S, the process can be performed without waiting for reading from the file. The F process will not be added to the waiting process list because the reading will start immediately. (7) The G process requests reading. The resource acquisition priority of the G process is 3. The processing of the read system P command section in FIG. 2 is followed. The value of semaphore S becomes -4, and S20
The process passes through 2, 203, and 204. In S204,
Since the resource acquisition priority of the process pointed to by the PTR of the semaphore S is 4, and the resource acquisition priority of this process is 3, the determination is No and the process proceeds to S206. In S206, this process is added to the waiting process list of the semaphore S in the order of resource acquisition priority. This process is put to sleep (S1904), and the process ends. FIG. 10 shows the semaphore management table and PCB at this point. 10 is different from FIG. 9 in that the G process newly added to the waiting process list has a resource acquisition priority of 3, so that it is added between the C process and the D process. The value of value in the semaphore management table is -4, and readcou
The value of nter is +3.

【0052】(8)次にFプロセスが読み込みを終了す
る。読み込みの終了であるので図4の読み込み系V命令
部の処理に従う。S401において、セマフォSのre
adcounterの値が1であるかどうかを調べ、こ
の場合+3であるのでNoとなりS403へいく。最後
の読み込み系プロセスではないので、次にS403にお
いてセマフォSのreadcounterの値を2とし
て終了する。 (9)Aプロセスが読み込みを終了する。図4の読み込
み系V命令部の処理に従う。(8)と同じように最後の
読み込み系プロセスであるかどうかを調べると、rea
dcounterの値が2なので、S401はNoとな
り、S403の処理を行う。S403においてセマフォ
Sのreadcounterの値を1とし終了する。
(8) Next, the F process finishes reading. Since this is the end of reading, the processing of the read system V instruction section in FIG. 4 is followed. In S401, re of the semaphore S
Whether or not the value of adcounter is 1 is checked. In this case, since it is +3, the determination is No and the process proceeds to S403. Since it is not the last reading process, the value of readcounter of the semaphore S is set to 2 in S403, and the process is terminated. (9) Process A finishes reading. The processing of the read system V instruction section in FIG. 4 is followed. As in (8), when checking whether it is the last read-related process, rea
Since the value of dcounter is 2, S401 is No and the process of S403 is performed. In step S403, the value of the read counter of the semaphore S is set to 1, and the process ends.

【0053】(10)Bプロセスの読み込み終了とCプ
ロセスの書き込み開始。Bプロセスの読み込み終了は図
4、読み込み系V命令部の処理に従う。この場合、re
adcounterの値は1であるのでS401におい
てYesとなり、S2001の処理を行う。S2001
においてセマフォSのvalueの値を+1すると−3
となる。S2002においてセマフォSの値が0以下な
のでYesとなり、S402の処理を行う。S402に
おいてPTRの値を更新すると、PTRはEプロセスを
さす。S2003においてセマフォSの待ちプロセスリ
ストの先頭かららプロセスを取り除く。この場合はCプ
ロセスのPCBを先頭から取り除く。そしてS2004
においてリストから取り外したプロセスを休眠状態から
実行可能状態へ変更する。S403において、セマフォ
Sのreadcounterの値を−1すると0とな
り、終了する。読み込みを行っているプロセスの数は0
クリアされた。次にS2004において実行可能状態へ
変更されたプロセスは、Cプロセスである。Cプロセス
は書き込み要求なので、図3の書き込み系P命令部の休
眠処理S1904の次からはじまる。S303において
セマフォSのロックモードを書き込みモードに設定し終
了する。この時のセマフォ管理テーブルとPCBを図1
1に示す。図11は図10のCプロセスが除かれたもの
であり、PTRポインタがEプロセスを指す。またセマ
フォ管理テーブルのvalueの値が−3であり、re
adcounterの値が0となっており、またロック
モードがwriteとなっている。
(10) Completion of reading of process B and start of writing of process C. Completion of the reading of the B process follows the process of the reading V instruction section in FIG. In this case, re
Since the value of adcounter is 1, the result in S401 is Yes, and the process of S2001 is performed. S2001
+1 if the value of the value of the semaphore S is +1
Becomes Since the value of the semaphore S is 0 or less in S2002, the determination result is Yes, and the process of S402 is performed. When the PTR value is updated in S402, the PTR points to the E process. In step S2003, the process is removed from the head of the waiting process list of the semaphore S. In this case, the C process PCB is removed from the beginning. And S2004
Change the process removed from the list from the dormant state to the runnable state. In S403, the value of the readcounter of the semaphore S is decremented by 1 to 0, and the process ends. The number of reading processes is 0
It was cleared. Next, the process changed to the executable state in S2004 is the C process. Since the C process is a write request, it starts from the sleep process S1904 of the write-related P command section in FIG. In S303, the lock mode of the semaphore S is set to the write mode, and the process ends. Figure 1 shows the semaphore management table and PCB at this time.
It is shown in FIG. In FIG. 11, the C process of FIG. 10 is omitted, and the PTR pointer points to the E process. The value of value in the semaphore management table is -3, and re
The value of adcounter is 0, and the lock mode is write.

【0054】(11)Cプロセスの書き込み終了とGプ
ロセス、Dプロセスの読み込み開始。Cプロセスは書き
込み要求であるので、終了のためには図5の書き込み系
V命令部の処理に従う。S2001においてセマフォS
の値は−2となる。次にS2002においてセマフォS
の値が0以下なのでYesとなり、S203の処理を行
う。S203において、PTRがNullではないの
で、NoとなりS501の処理へいく。S501におい
て、待ちプロセスリストの先頭が書き込み系か否か調べ
るために、PTRが待ちプロセスリストの先頭のプロセ
スを指しているかどうかを調べる。この場合、図11よ
りNoとなるのでS503の処理を行う。S503にお
いて、セマフォSの待ちプロセスリストの先頭からPT
Rが指すプロセスの直前までのプロセスを全てリストか
ら外す。次にS504において、リストから取り外した
全てのプロセスを、この場合はGプロセスとDプロセス
を休眠状態から実行可状態へと変更する。以上でCプロ
セスは終了し、次にGプロセスとDプロセスが開始す
る。Gプロセス、Dプロセスは共に読み込み系であるの
で、図2の読み込み系P命令部の処理に従う。図2のS
207の処理からはじまる。まず、Gプロセスが休眠状
態から実行可状態へと移り、S207においてセマフォ
Sのreadcounterの値を+1し、1とする。
S208においてセマフォSのロックモードを読み込み
モードに設定し、終了する。次にDプロセスがS207
より開始する。S207においてreadcounte
rの値を+2とする。次にS208においてセマフォS
のロックモードを読み込みモードに設定し、終了する。
これによりGプロセス、Dプロセスがファイルから読み
込みを開始する。この時点のセマフォ管理テーブルとP
CBを図12に示す。
(11) Writing of C process is completed and reading of G process and D process is started. Since the C process is a write request, the process of the write-related V command section in FIG. 5 is followed for termination. S2001: Semaphore S
Has a value of -2. Next, in S2002, the semaphore S
Since the value of is 0 or less, the determination result is Yes, and the process of S203 is performed. Since the PTR is not Null in S203, the determination is No, and the process proceeds to S501. In S501, in order to check whether or not the head of the waiting process list is a write system, it is checked whether the PTR points to the head process of the waiting process list. In this case, since No is obtained from FIG. 11, the process of S503 is performed. In step S503, PT from the head of the waiting process list of the semaphore S
Remove all processes up to immediately before the process pointed to by R. Next, in step S504, all the processes removed from the list, in this case the G process and the D process, are changed from the sleep state to the executable state. With the above, the C process ends, and then the G process and the D process start. Since both the G process and the D process are read systems, they follow the processing of the read system P command section in FIG. S in FIG.
The process of 207 starts. First, the G process shifts from the sleep state to the executable state, and the value of readcounter of the semaphore S is incremented by 1 and set to 1 in S207.
In S208, the lock mode of the semaphore S is set to the read mode, and the process ends. Next, the D process is S207.
Start more. In S207 readcount
Let the value of r be +2. Next, in S208, the semaphore S
Set the lock mode of to read mode and exit.
As a result, the G process and the D process start reading from the file. Semaphore management table and P at this point
CB is shown in FIG.

【0055】以上のように、資源待ちプロセスが資源獲
得優先度により制御されるため、従来の共用排他制御に
おける書き込み系プロセスの資源飢餓状態発生を自動的
に回避することができる。
As described above, since the resource waiting process is controlled by the resource acquisition priority, it is possible to automatically avoid the resource starvation state of the writing process in the conventional shared exclusive control.

【0056】実施例2.実施例2は、実施例1のセマフ
ォの構造およびP命令部(20,30)/V命令部(4
0,50)の処理を基本とし、PCB6内のプロセスの
資源獲得優先度7として、通常PCB6内で管理されて
いるプロセスの属性値を用いる。
Example 2. In the second embodiment, the structure of the semaphore of the first embodiment and the P instruction part (20, 30) / V instruction part (4
(0, 50), the attribute value of the process normally managed in the PCB 6 is used as the resource acquisition priority 7 of the process in the PCB 6.

【0057】本実施例によるP命令部の概要を説明す
る。図13は読み込み系P命令部60のフローチャート
を、図14は書き込み系P命令部70のフローチャート
を示す。まず、PCB6内で管理している一意のプロセ
ス属性値を該PCB内の資源獲得優先度7に設定する
(S601)。以降は、引数で指定されたロックモード
が読み込み系(R)であれば実施例1の読み込み系P命
令部20を、書き込み系(W)であれば実施例1の書き
込み系P命令部30を行う。一方、本実施例におけるV
命令部は実施例1のV命令部(40,50)と同じであ
る。
An outline of the P command section according to this embodiment will be described. 13 shows a flow chart of the read system P command section 60, and FIG. 14 shows a flow chart of the write system P command section 70. First, the unique process attribute value managed in the PCB 6 is set to the resource acquisition priority 7 in the PCB (S601). After that, if the lock mode specified by the argument is the read system (R), the read system P command unit 20 of the first embodiment is used, and if the lock mode is the write system (W), the write system P command unit 30 of the first embodiment is used. To do. On the other hand, V in the present embodiment
The command part is the same as the V command part (40, 50) of the first embodiment.

【0058】以上説明したように、本実施例のセマフォ
はプロセスの属性値を資源獲得優先度として用いること
により、従来の共用排他制御における書き込み系プロセ
スの資源飢餓状態発生を自動的に回避することができ
る。
As described above, the semaphore of this embodiment automatically avoids the occurrence of the resource starvation state of the write-related process in the conventional shared exclusive control by using the attribute value of the process as the resource acquisition priority. You can

【0059】実施例3.本実施例は、実施例2記載のP
命令部(60,70)のステップS601において、資
源獲得優先度として用いるプロセスの属性値としてプロ
セスのスケジューリング優先度を用いる場合である。
Example 3. This example is the same as P described in Example 2.
This is the case where the scheduling priority of the process is used as the attribute value of the process used as the resource acquisition priority in step S601 of the instruction part (60, 70).

【0060】本実施例の資源管理装置は、プロセスのス
ケジューリング優先度が高い順に資源が割り当てられる
ため、固定優先度スケジューリングを用いるリアルタイ
ムシステムにおいては有効である。
The resource management apparatus of the present embodiment is effective in a real-time system using fixed priority scheduling because resources are allocated in the order of higher process scheduling priority.

【0061】実施例4.本実施例は、実施例2記載のP
命令部(60,70)のステップS601において、資
源獲得優先度として用いるプロセスの属性値としてプロ
セスが現在ロックしている資源の数を用いる。図15
は、ロック中の資源の数の数え方の例である。図15に
おいて、ある1つのプロセスの中でA,B,C3種類の
セマフォが使われているとする。この時、図15から分
かるようにP(A)の時、セマフォAが獲得された段階
では、ロック中の資源の数は1、次にP(B)、セマフ
ォBが獲得された段階では、ロック中の資源の数は2、
次にP(C)、セマフォCが獲得された段階では、ロッ
ク中の資源の数は3、となり、V(C)、V(B)、V
(A)でセマフォが解放されるにつれロック中の資源の
数は2、1、0となる。プロセスがロックしている資源
の数とは、このように数える。
Example 4. This example is the same as P described in Example 2.
In step S601 of the instruction part (60, 70), the number of resources currently locked by the process is used as the attribute value of the process used as the resource acquisition priority. FIG.
Is an example of how to count the number of resources that are locked. In FIG. 15, it is assumed that three types of semaphores of A, B, and C are used in a certain process. At this time, as can be seen from FIG. 15, when P (A), when the semaphore A is acquired, the number of resources in lock is 1, then at the stage when P (B) and semaphore B are acquired, The number of resources locked is 2,
Next, when P (C) and semaphore C are acquired, the number of locked resources becomes 3, and V (C), V (B), V
As the semaphore is released in (A), the number of locked resources becomes 2, 1, 0. The number of resources locked by a process is counted in this way.

【0062】本実施例の資源管理装置は、プロセスがロ
ックしている資源の数が多い順にプロセスに資源が割り
当てられるため、システム全体のスループットが向上す
る。
In the resource management system of this embodiment, the resources are allocated to the processes in the descending order of the number of resources locked by the process, so that the throughput of the entire system is improved.

【0063】実施例5.本実施例は、ディスク装置など
の補助記憶装置を用いて主メモリ装置の実容量以上の主
記憶容量があるように見せる、ページング方式の仮想記
憶方式を採用しているオペレーティングシステム上でプ
ロセスが動作している場合である。実施例2記載のP命
令(60,70)のステップS601において、資源獲
得優先度として用いるプロセスの属性値として、プロセ
スの動作イメージが補助記憶装置ではなく主メモリの占
有量、例えば主メモリ上に何頁数分保持されているかと
いう値、すなわちプロセス実行イメージの主メモリ上頁
数を用いる。
Example 5. In the present embodiment, a process operates on an operating system that employs a paging-type virtual storage system that uses an auxiliary storage device such as a disk device to make it appear that the main storage capacity is larger than the actual capacity of the main memory device. That is the case. In step S601 of the P command (60, 70) described in the second embodiment, as the attribute value of the process used as the resource acquisition priority, the operation image of the process is not the auxiliary storage device but the occupancy amount of the main memory, for example, on the main memory. A value indicating how many pages are held, that is, the number of pages in the main memory of the process execution image is used.

【0064】本実施例の場合、プロセス実行イメージの
主メモリ上頁数が多いプロセスの方が、その動作に際し
て、補助記憶装置から主メモリ装置へのプロセス実行イ
メージの複写処理が少なく、その処理に要する時間が短
いことが期待できる。そのため、プロセス実行イメージ
の主メモリ上頁数が多い順にプロセスに資源を割り当て
ることで、処理に要する時間が短いことが期待されるプ
ロセスに優先的に資源を割り当てることができ、システ
ム全体のスループットが向上する。
In the case of the present embodiment, a process having a large number of pages in the main memory of the process execution image requires less copying of the process execution image from the auxiliary storage device to the main memory device during its operation. It can be expected that the time required will be short. Therefore, by allocating resources to processes in descending order of the number of pages in the main memory of the process execution image, it is possible to allocate resources preferentially to processes that are expected to require a short processing time, and the overall system throughput improves.

【0065】実施例6.本実施例は、実施例2記載のP
命令部(60,70)のステップS601において、資
源獲得優先度として用いるプロセスの属性値としてCP
U使用時間を用いる。
Example 6. This example is the same as P described in Example 2.
In step S601 of the instruction part (60, 70), CP is used as the attribute value of the process used as the resource acquisition priority.
Use U usage time.

【0066】本実施例の場合、プロセスのCPU使用時
間が多い順にプロセスに資源が割り当てられるため、重
要なアプリケーションまたは他のアプリケーションにサ
ービスしている可能性の高いプロセスに優先的に資源を
割り当てることができる。
In the case of this embodiment, resources are allocated to processes in the order of increasing CPU usage time of processes, so resources should be allocated preferentially to processes that are likely to serve important applications or other applications. You can

【0067】実施例7.本実施例は、例えばシステムの
過負荷時にどのプロセスの処理を優先させるかの決定指
針などに用いるために、CPUスケジュール優先度とは
別に、プロセス毎にその属性としてプロセスの処理重要
度が設定されているオペレーティングシステム上でプロ
セスが動作している場合である。実施例2記載のP命令
(60,70)のステップS601において、資源獲得
優先度として用いるプロセスの属性値としてプロセスの
処理重要度を用いる。
Example 7. In this embodiment, in order to use it as a guideline for deciding which process should be prioritized when the system is overloaded, for example, in addition to the CPU schedule priority, the process processing importance is set as an attribute for each process. The process is running on the operating system that is running. In step S601 of the P command (60, 70) described in the second embodiment, the process processing importance of the process is used as the attribute value of the process used as the resource acquisition priority.

【0068】本実施例の場合、プロセスの処理重要度の
より高いプロセスに速やかに資源が割り当てられ、重要
度のより高いプロセスの処理を円滑に行うことができ、
処理重要度というプロセスの属性を設定する目的の達成
を促進する。
In the case of this embodiment, resources are promptly allocated to the process having a higher processing importance, and the process having a higher processing importance can be smoothly processed.
Facilitates the achievement of the purpose of setting the process attribute of processing importance.

【0069】実施例8.本実施例は、実施例1のセマフ
ォの構造およびP命令部(20,30)/V命令部(4
0,50)の処理を基本とし、PCB6内の資源獲得優
先度7に設定する値としてユーザが動的に指定した値を
用いる。
Example 8. In this embodiment, the structure of the semaphore of the first embodiment and the P instruction section (20, 30) / V instruction section (4
0, 50), and the value dynamically set by the user is used as the value set for the resource acquisition priority 7 in the PCB 6.

【0070】本実施例によるP命令部の概要を説明す
る。図16は読み込み系P命令部80のフローチャート
を、図17は書き込み系P命令部90のフローチャート
を示す。P命令部は引数としてセマフォ(S)、ロック
モード(RorW)、および資源獲得優先度の値(Pr
i)を指定する。まず、ユーザが指定した値(引数Pr
i)をPCB6内のプロセスの資源獲得優先度7に設定
し(S801)、以降は、引数ロックモードが読み込み
モード(R)であれば実施例1の読み込み系P命令部2
0の処理を、引数ロックモードが書き込みモード(W)
であれば実施例1の書き込み系P命令部30の処理を行
う。一方、本実施例におけるV命令部は実施例1のV命
令部(40,50)と同じである。
An outline of the P command section according to this embodiment will be described. FIG. 16 is a flowchart of the read P command section 80, and FIG. 17 is a flowchart of the write P command section 90. The P command section uses semaphores (S), lock modes (RorW), and resource acquisition priority values (Pr) as arguments.
i) is specified. First, the value specified by the user (argument Pr
i) is set to the resource acquisition priority 7 of the process in the PCB 6 (S801), and thereafter, if the argument lock mode is the read mode (R), the read system P command unit 2 of the first embodiment
0 processing, argument lock mode is write mode (W)
If so, the processing of the write system P command unit 30 of the first embodiment is performed. On the other hand, the V command part in this embodiment is the same as the V command part (40, 50) in the first embodiment.

【0071】本実施例の場合、各資源に対してプロセス
毎にユーザが自由に資源獲得優先度の値を設定でき、よ
り細かい資源管理を行うことができる。
In the case of the present embodiment, the user can freely set the resource acquisition priority value for each process for each resource, and finer resource management can be performed.

【0072】実施例9.本実施例は、実施例1のセマフ
ォの構造およびP命令部(20,30)/V命令部(4
0,50)の処理を基本とし、PCB6内の資源獲得優
先度7に設定する値としてユーザが予め(静的に)指定
した値を用いる。本実施例では、実施例1の手段と各資
源に対してプロセス毎の資源獲得優先度7の値を管理す
るテーブルに予め資源獲得優先度の値を設定できる手段
とを備えることとする。
Example 9. In this embodiment, the structure of the semaphore of the first embodiment and the P instruction section (20, 30) / V instruction section (4
0, 50) is basically used, and the value specified in advance (statically) by the user is used as the value set for the resource acquisition priority 7 in the PCB 6. In the present embodiment, the means of the first embodiment and the means for setting the resource acquisition priority value in advance in the table for managing the resource acquisition priority 7 value for each process for each resource will be provided.

【0073】本実施例によるP命令部の概要を説明す
る。図18は読み込み系P命令部100のフローチャー
トを、図19は書き込み系P命令部110のフローチャ
ートを示す。資源獲得優先度の管理テーブル120は資
源獲得優先度の登録手段1002により登録される。資
源獲得優先度の管理テーブル120からこのP命令部を
呼び出したプロセスPiのセマフォS(資源)に対する
資源獲得優先度を取得して、その値を該プロセスのPC
B6の資源獲得優先度格納領域7に設定する(S100
1,S1101)。この時P命令部の引数で指定された
ロックモードが読み込みモード(R)であれば読み込み
系資源獲得優先度の管理テーブルを、書き込みモード
(W)であれば書き込み系資源獲得優先度の管理テーブ
ルを参照する。図20に各資源に対するプロセス毎の資
源獲得優先度7の値を管理するテーブルの構造を示す。
Piはプロセスを示し、Sjはセマフォ(資源)を示
す。例えば、図20におけるプロセスP2のセマフォS
1に対する資源獲得優先度は3である。ステップS10
01あるいはステップS1101以降は、引数ロックモ
ードが読み込みモード(R)であれば実施例1の読み込
み系P命令部20を、引数ロックモードが書き込みモー
ド(W)であれば実施例1の書き込み系P命令部30を
各々行う。一方、本実施例におけるV命令部は実施例1
のV命令部(40および50)と同じである。
An outline of the P command section according to this embodiment will be described. FIG. 18 is a flowchart of the read system P command unit 100, and FIG. 19 is a flowchart of the write system P command unit 110. The resource acquisition priority management table 120 is registered by the resource acquisition priority registration means 1002. From the resource acquisition priority management table 120, the resource acquisition priority for the semaphore S (resource) of the process Pi that called this P command unit is acquired, and the value is acquired by the PC of the process.
It is set in the resource acquisition priority storage area 7 of B6 (S100).
1, S1101). At this time, if the lock mode specified by the argument of the P command part is the read mode (R), the management table of the read system resource acquisition priority is set, and if the write mode (W), the write system resource acquisition priority management table is set. Refer to. FIG. 20 shows the structure of a table that manages the value of the resource acquisition priority 7 for each resource for each process.
Pi indicates a process, and Sj indicates a semaphore (resource). For example, the semaphore S of the process P2 in FIG.
The resource acquisition priority for 1 is 3. Step S10
01 or after step S1101, if the argument lock mode is the read mode (R), the read system P command section 20 of the first embodiment is used. If the argument lock mode is the write mode (W), the write system P of the first embodiment is used. The instruction unit 30 is executed. On the other hand, the V instruction part in this embodiment is the same as that in the first embodiment.
V command section (40 and 50).

【0074】本実施例の場合、各資源に対してプロセス
毎に自由に資源獲得優先度の値を設定でき、資源毎によ
り細かい資源管理を行うことができる。
In the case of this embodiment, the value of the resource acquisition priority can be freely set for each resource for each process, and finer resource management can be performed for each resource.

【0075】実施例10.本実施例は、実施例9におけ
る資源獲得優先度の管理テーブル120に登録する値と
してプロセスPiのセマフォSjに対するロック時間の
予想値を用いる。ロック時間とは、P(S)からV
(S)の間の時間、即ちセマフォS獲得時点から解放時
点までの時間である。
Example 10. In the present embodiment, the predicted value of the lock time for the semaphore Sj of the process Pi is used as the value registered in the resource acquisition priority management table 120 in the ninth embodiment. Lock time is from P (S) to V
It is the time between (S), that is, the time from the acquisition of the semaphore S to the release.

【0076】本実施例の場合、プロセスのセマフォロッ
ク時間の短い順に資源を割り当てるため、システム全体
のスループットを上げることができる。
In the case of this embodiment, since the resources are allocated in the ascending order of the process semaphore lock time, the throughput of the entire system can be increased.

【0077】実施例11.本実施例は、実施例1のセマ
フォの構造およびP命令部(20,30)/V命令部
(40,50)の処理を基本とし、上記実施例での資源
獲得優先度として任意個の尺度の組合せを用い、該P命
令部(20,30)の図2、図3のステップS204お
よびステップS206における資源獲得優先度の比較で
はそれらの尺度の組合せにより比較を行う。
Example 11. The present embodiment is based on the structure of the semaphore of the first embodiment and the processing of the P command part (20, 30) / V command part (40, 50), and an arbitrary number of scales are used as the resource acquisition priority in the above embodiment. 2 in the P command section (20, 30) in the step S204 and the step S206 of FIG. 3, the resource acquisition priority is compared by a combination of these scales.

【0078】例えば、尺度の組合せとして資源獲得要求
時に明示的に指定する値と、プロセスのスケジュール優
先度の2つの尺度の組合せを採用し、その比較には、ま
ず資源獲得要求時に明示的に指定する値の大きい方が資
源獲得優先度が高く、明示的に指定する値が同じ場合に
は、プロセスのスケジュール優先度が高いほうが資源獲
得優先度が高いという比較方法を採用したとする。まず
資源獲得要求時に、明示的に指定する値の大きいプロセ
スの方が優先して資源が割り当てられ、明示的に指定す
る値が同じ場合では、プロセスのスケジュール優先度の
高いプロセスの方に、優先して資源が割り当てられるこ
とを達成でき、明示的な指定値を活かしつつプロセスの
スケジュール優先度というプロセスの属性を活かした資
源割り当てが実現可能となる。
For example, as a combination of scales, a combination of two scales, that is, a value explicitly specified at the time of resource acquisition request and a process schedule priority is adopted. Assume that a comparison method is adopted in which the resource acquisition priority is higher when the value is larger, and when the value explicitly specified is the same, the resource acquisition priority is higher when the process schedule priority is higher. First, when a resource acquisition request is made, the process with the larger explicitly specified value is given priority, and if the explicitly specified value is the same, the process with the higher process schedule priority is given priority. Thus, it is possible to achieve resource allocation, and it is possible to realize resource allocation that utilizes the process attribute of process schedule priority while making use of the explicitly specified value.

【0079】なお本実施例では、資源獲得要求時に明示
的に指定する値と、プロセス属性の一種であるプロセス
のスケジュール優先度という2つの尺度を用い、資源獲
得要求時に明示的に指定する値を主として比較し資源獲
得優先度の高低を判断している。しかし、これはプロセ
スのスケジュール優先度を主として比較してもよく、ま
た2つの尺度として共にプロセスの属性を採用してもよ
く、さらに尺度の1つとして各資源に対する獲得優先度
としてプロセス毎に予め登録された値を採用しても構わ
ない。さらに用いる尺度の数は2つに限らず3つ以上で
もよく、任意の尺度の組合せとその尺度の組合せに対す
る任意の比較方法を採用することができる。
In this embodiment, two values, that is, a value explicitly specified at the time of resource acquisition request and a schedule priority of a process, which is a kind of process attribute, are used. Compared mainly, the priority of resource acquisition is judged to be high or low. However, this may mainly compare the schedule priorities of the processes, may adopt the attributes of the processes together as the two measures, and further, as one of the measures, the acquisition priority for each resource in advance for each process. The registered value may be adopted. Further, the number of scales to be used is not limited to two and may be three or more, and an arbitrary scale combination and an arbitrary comparison method for the scale combination can be adopted.

【0080】本実施例の場合、資源獲得優先度として単
一の尺度を用いた場合よりより細かく柔軟な判断を可能
とし、どのプロセスをより優先して資源獲得可能とする
かという判断の特性として、資源管理機構に対しシステ
ム構築上求められるより適した特性を設定できるという
効果を持つ。
In the case of the present embodiment, it is possible to make a finer and more flexible judgment than in the case where a single scale is used as the resource acquisition priority, and as a characteristic of the judgment of which process is to be given priority to acquire the resource. , It has the effect that the resource management mechanism can set more suitable characteristics required for system construction.

【0081】実施例12.本実施例は、実施例1のセマ
フォの構造およびP命令部(20,30)/V命令部
(40,50)の処理を基本とし、上記実施例1から1
1までの全ての手段を備えた上で、さらに資源毎にその
資源に対する資源獲得優先度として該実施例のいずれか
の方式を予め静的に選択することができる手段を有する
ことが特徴である。
Example 12 This embodiment is based on the structure of the semaphore of the first embodiment and the processing of the P command section (20, 30) / V command section (40, 50), and is based on the above-mentioned first to first embodiments.
In addition to providing all means up to 1, it is characterized by further having means for statically selecting one of the methods of the embodiment in advance as a resource acquisition priority for each resource. .

【0082】本実施例によるP命令部の概要を説明す
る。図21は読み込み系P命令部150のフローチャー
トを、図22は書き込み系P命令部160のフローチャ
ートを示す。まず、資源獲得優先度設定方式の管理テー
ブル170から、セマフォSに対する資源獲得優先度の
設定方式を識別する(S1501)。図23に各資源に
対する資源獲得優先度の設定方式を管理するテーブル1
70の構造を示す。Sjは資源を示す。例えば、図23
におけるセマフォS2に対する資源獲得優先度の設定方
式は実施例3の設定方式である。ステップS1501以
降の処理は、資源獲得優先度の設定方式に従い、引数ロ
ックモードが読み込みモード(R)であれば実施例3か
ら実施例8、実施例9と実施例10、実施例11のいず
れかの読み込み系P命令部(20,60,80,10
0)を、引数ロックモードが書き込みモード(W)であ
れば実施例3から実施例8、実施例9と実施例10、実
施例11のいずれかの書き込み系P命令部(30,7
0,90,110)を行う。一方、本実施例におけるV
命令部は実施例1のV命令部(40,50)と同じであ
る。
An outline of the P command section according to this embodiment will be described. FIG. 21 is a flowchart of the read P command section 150, and FIG. 22 is a flowchart of the write P command section 160. First, the resource acquisition priority setting method for the semaphore S is identified from the resource acquisition priority setting method management table 170 (S1501). FIG. 23 is a table 1 for managing the resource acquisition priority setting method for each resource.
70 shows the structure of 70. Sj indicates a resource. For example, in FIG.
The setting method of the resource acquisition priority for the semaphore S2 in is the setting method of the third embodiment. The processing from step S1501 onward is in accordance with the resource acquisition priority setting method, and if the argument lock mode is the read mode (R), any one of the third to eighth embodiments, the ninth embodiment, the tenth embodiment, and the eleventh embodiment. Read system P command section (20, 60, 80, 10
0) when the argument lock mode is the write mode (W), the write system P command section (30, 7) of any of the third to eighth embodiments, the ninth and tenth embodiments, and the eleventh embodiment.
0, 90, 110). On the other hand, V in the present embodiment
The command part is the same as the V command part (40, 50) of the first embodiment.

【0083】本実施例の場合、各資源の特性に適する資
源獲得優先度設定方式を選ぶことができるため、より細
かい資源管理を行うことができる。
In the case of the present embodiment, since the resource acquisition priority setting method suitable for the characteristics of each resource can be selected, more detailed resource management can be performed.

【0084】実施例13.資源獲得優先度の定め方は、
上記実施例で述べた以外のものであっても、順位を決め
ることのできるものであればよい。例えば、プロセスの
資源獲得要求順に早いものから高い資源獲得優先度を与
えてもよい。プロセスA(読み込み)、プロセスB(読
み込み)、プロセスC(書き込み)、プロセスD(読み
込み)、プロセスE(読み込み)、プロセスF(書き込
み)の順に資源獲得要求を出した場合、プロセスAから
順に高い資源獲得優先度を、例えば10から5を与え、
資源待ちプロセスリストに加えていく。
Example 13 How to determine the priority of resource acquisition
Other than those described in the above embodiment, any one can be used as long as the order can be determined. For example, the resource acquisition priority may be given from the earliest to the lowest in the process resource acquisition request. When resource acquisition requests are issued in the order of process A (reading), process B (reading), process C (writing), process D (reading), process E (reading), process F (writing), the order is highest from process A. Give a resource acquisition priority, for example 10 to 5,
Add to resource waiting process list.

【0085】この時、書き込み系プロセスの資源割り当
て飢餓状態に陥ることを回避するために、書き込み系プ
ロセスの資源獲得優先度をある値以上に設定するように
してもよい。例えば、書き込み系プロセスの資源獲得優
先度を常に7以上とした場合、上記のプロセスAの資源
獲得優先度は10、プロセスBは9、プロセスCは8、
プロセスDは7、プロセスEは6、プロセスFは7とな
る。この場合の資源待ちプロセスリストを図24に示
す。プロセスFが書き込み系プロセスであるため、資源
獲得優先度は7となり、図24のようにプロセスDとプ
ロセスEの間に入る。
At this time, in order to avoid the resource allocation starvation state of the writing process, the resource acquisition priority of the writing process may be set to a certain value or more. For example, if the resource acquisition priority of the writing process is always 7 or more, the resource acquisition priority of the above process A is 10, the process B is 9, the process C is 8,
The process D is 7, the process E is 6, and the process F is 7. A resource waiting process list in this case is shown in FIG. Since the process F is a writing process, the resource acquisition priority is 7, and it enters between the processes D and E as shown in FIG.

【0086】このように、プロセスの資源獲得優先度の
定め方は、順位を決めることのできるものであれば、目
的に合わせどのようなものでもよい。
As described above, the process resource acquisition priority may be determined according to the purpose as long as the order can be determined.

【0087】[0087]

【発明の効果】以上説明したように、本発明によれば、
本来の共用排他制御の目的である効率よい資源管理が実
現できる。
As described above, according to the present invention,
Efficient resource management, which is the original purpose of shared exclusive control, can be realized.

【0088】また、本発明によれば、書き込み系プロセ
スが資源割り当て飢餓状態に陥ることを資源の獲得優先
度に従って自動的に回避することにより、アプリケーシ
ョン設計の開発効率の向上およびシステムの正常動作を
保証できると同時にシステム全体のスループットを向上
させ、柔軟性の高い資源管理を行うことができる。
Further, according to the present invention, it is possible to improve the development efficiency of the application design and the normal operation of the system by automatically avoiding the write-related process from starving into resource allocation according to the resource acquisition priority. It is possible to guarantee and at the same time improve the throughput of the entire system, and to perform flexible resource management.

【0089】また、本発明によれば、プロセスの属性値
を資源獲得優先度として用いることにより、従来の共用
排他制御における書き込み系プロセスの資源飢餓状態発
生を自動的に回避することができる。
Further, according to the present invention, by using the attribute value of the process as the resource acquisition priority, it is possible to automatically avoid the resource starvation state of the writing process in the conventional shared exclusive control.

【0090】また、本発明によれば、プロセスのスケジ
ューリング優先度が高い順に資源が割り当てられるた
め、固定優先度スケジューリングを用いるリアルタイム
システムにおいては有効である。
Further, according to the present invention, resources are allocated in the descending order of process scheduling priority, which is effective in a real-time system using fixed priority scheduling.

【0091】また、本発明によれば、プロセスがロック
している資源の数が多い順にプロセスに資源が割り当て
られるため、システム全体のスループットが向上する。
Further, according to the present invention, since the resources are allocated to the processes in the descending order of the number of resources locked by the process, the throughput of the entire system is improved.

【0092】また、本発明によれば、プロセス実行イメ
ージの主メモリ占有量、例えば主メモリ上頁数が多い順
にプロセスに資源を割り当てることで、処理に要する時
間が短いことが期待されるプロセスに優先的に資源を割
り当てることが達成でき、システム全体のスループット
が向上する。
Further, according to the present invention, by allocating resources to a process in the order in which the main memory occupation amount of the process execution image, for example, the number of pages in the main memory is large, a process expected to have a short processing time can be obtained. It is possible to allocate resources preferentially, and the throughput of the entire system is improved.

【0093】また本発明によれば、プロセスの使用時間
が多い順にプロセスに資源が割り当てられるため、重要
なプロセスまたは他のアプリケーションにサービスして
いる可能性の高いプロセスに優先的に資源を割り当てる
ことができる。
Further, according to the present invention, resources are allocated to processes in the descending order of process usage time, so resources are preferentially allocated to important processes or processes that are likely to be serving other applications. You can

【0094】また、本発明によれば、プロセスの処理重
要度のより高いプロセスに速やかに資源が割り当てら
れ、重要度のより高いプロセスの処理を円滑に行うこと
ができ、処理重要度というプロセスの属性を設定する目
的の達成を促進する。
Further, according to the present invention, resources are promptly allocated to a process having a higher processing importance, so that a process having a higher importance can be smoothly processed. Promote the achievement of the purpose of setting attributes.

【0095】また、本発明によれば、各資源に対してプ
ロセス毎にユーザが自由に資源獲得優先度の値を設定で
き、より細かい資源管理を行うことができる。
Further, according to the present invention, the user can freely set the resource acquisition priority value for each resource for each process, and more detailed resource management can be performed.

【0096】また、本発明によれば、各資源に対してプ
ロセス毎に自由に資源獲得優先度の値を設定でき、資源
毎により細かい資源管理を行うことができる。
Further, according to the present invention, the value of the resource acquisition priority can be freely set for each process for each resource, and finer resource management can be performed for each resource.

【0097】また、本発明によれば、プロセスのセマフ
ォロック時間の短い順に資源を割り当てるため、システ
ム全体のスループットを上げることができる。
Further, according to the present invention, resources are allocated in the ascending order of semaphore lock time of a process, so that the throughput of the entire system can be increased.

【0098】また、本発明によれば、資源獲得優先度と
して単一の尺度を用いた場合よりより細かく柔軟な判断
を可能とし、どのプロセスをより優先して資源獲得可能
とするかという判断の特性として、資源管理機構に対し
システム構築上求められるより適した特性を設定できる
という効果を持つ。
Further, according to the present invention, it is possible to make a finer and more flexible judgment as compared with the case where a single measure is used as the resource acquisition priority, and it is possible to judge which process is given higher priority to acquire the resource. As a characteristic, it has an effect that a more suitable characteristic required for system construction can be set for the resource management mechanism.

【0099】また、本発明によれば、各資源の特性に適
する資源獲得優先度設定方式を選ぶことができるため、
より細かい資源管理を行うことができる。
Further, according to the present invention, a resource acquisition priority setting method suitable for the characteristics of each resource can be selected.
Finer resource management can be performed.

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

【図1】 本発明の一実施例によるセマフォ構造の説明
図。
FIG. 1 is an explanatory diagram of a semaphore structure according to an embodiment of the present invention.

【図2】 実施例1によるセマフォを用いた読み込み系
P命令部フローチャート図。
FIG. 2 is a flowchart diagram of a read system P command section using a semaphore according to the first embodiment.

【図3】 実施例1によるセマフォを用いた書き込み系
P命令部フローチャート図。
FIG. 3 is a flowchart of a write system P command section using a semaphore according to the first embodiment.

【図4】 実施例1によるセマフォを用いた読み込み系
V命令部フローチャート図。
FIG. 4 is a flowchart diagram of a read system V instruction unit using a semaphore according to the first embodiment.

【図5】 実施例1によるセマフォを用いた書き込み系
V命令部フローチャート図。
FIG. 5 is a flowchart diagram of a write system V instruction unit using the semaphore according to the first embodiment.

【図6】 読み込みプロセス、書き込みプロセスのファ
イルへのアクセスタイミングを示す図。
FIG. 6 is a diagram showing a timing of accessing a file by a reading process and a writing process.

【図7】 図6における(3)終了時点のセマフォ管理
テーブルとPCBを示す図。
FIG. 7 is a diagram showing a semaphore management table and a PCB at the time of ending (3) in FIG.

【図8】 図6における(4)終了時点のセマフォ管理
テーブルとPCBを示す図。
FIG. 8 is a diagram showing a semaphore management table and a PCB at the end of (4) in FIG.

【図9】 図6における(5)終了時点のセマフォ管理
テーブルとPCBを示す図。
9 is a diagram showing a semaphore management table and a PCB at the end of (5) in FIG.

【図10】 図6における(7)終了時点のセマフォ管
理テーブルとPCBを示す図。
10 is a diagram showing a semaphore management table and a PCB at the end of (7) in FIG.

【図11】 図6における(10)終了時点のセマフォ
管理テーブルとPCBを示す図。
11 is a diagram showing a semaphore management table and a PCB at the end of (10) in FIG.

【図12】 図6における(11)終了時点のセマフォ
管理テーブルとPCBを示す図。
FIG. 12 is a diagram showing a semaphore management table and a PCB at the end of (11) in FIG.

【図13】 実施例2によるセマフォを用いた読み込み
系P命令部フローチャート図。
FIG. 13 is a flowchart diagram of a read P command section using a semaphore according to the second embodiment.

【図14】 実施例2によるセマフォを用いた書き込み
系P命令部フローチャート図。
FIG. 14 is a flowchart diagram of a write system P command section using a semaphore according to the second embodiment.

【図15】 ロック中の資源の数の数え方の例を示す
図。
FIG. 15 is a diagram showing an example of how to count the number of locked resources.

【図16】 実施例8によるセマフォを用いた読み込み
系P命令部フローチャート図。
FIG. 16 is a flowchart diagram of a read system P command section using a semaphore according to the eighth embodiment.

【図17】 実施例8によるセマフォを用いた書き込み
系P命令部フローチャート図。
FIG. 17 is a flowchart diagram of a write system P command section using a semaphore according to the eighth embodiment.

【図18】 実施例9によるセマフォを用いた読み込み
系P命令部フローチャート図。
FIG. 18 is a flowchart diagram of a read P command section using a semaphore according to the ninth embodiment.

【図19】 実施例9によるセマフォを用いた書き込み
系P命令部フローチャート図。
FIG. 19 is a flowchart diagram of a write system P command section using a semaphore according to the ninth embodiment.

【図20】 実施例9における資源獲得優先度の管理テ
ーブルの説明図。
FIG. 20 is an explanatory diagram of a resource acquisition priority management table according to the ninth embodiment.

【図21】 実施例12によるセマフォを用いた読み込
み系P命令部フローチャート図。
FIG. 21 is a flowchart diagram of a read system P command section using a semaphore according to the twelfth embodiment.

【図22】 実施例12によるセマフォを用いた書き込
み系P命令部フローチャート図。
FIG. 22 is a flowchart diagram of a write system P command section using a semaphore according to the twelfth embodiment.

【図23】 実施例12における資源獲得優先度設定方
式の管理テーブルの説明図。
FIG. 23 is an explanatory diagram of a management table of a resource acquisition priority setting method according to the twelfth embodiment.

【図24】 実施例13における待ちプロセスリストの
例を示す図。
FIG. 24 is a diagram showing an example of a waiting process list according to the thirteenth embodiment.

【図25】 従来のセマフォの構造の説明図。FIG. 25 is an explanatory diagram of a structure of a conventional semaphore.

【図26】 従来のセマフォのP命令部のフローチャー
ト図。
FIG. 26 is a flowchart of the P command section of the conventional semaphore.

【図27】 従来のセマフォのV命令部のフローチャー
ト図。
FIG. 27 is a flowchart of the V instruction section of the conventional semaphore.

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

1 メモリ、2 セマフォ管理テーブル、3 read
counter、4PTR、5 ロックモード、6 プ
ロセス制御ブロック(PCB)、7 資源獲得優先度、
8 資源ロックモード、10 排他制御部、18 従来
例の排他制御部、20 読み込み系P命令部、30 書
き込み系P命令部、40 読み込み系V命令部、50
書き込み系V命令部、180 従来のセマフォ管理テー
ブル、181 待ちプロセスリストポインタ、182
value、183 従来のプロセス制御ブロック(P
CB)、184 nextポインタ、190 従来のP
命令部、200 従来のV命令部。
1 memory, 2 semaphore management table, 3 read
counter, 4PTR, 5 lock mode, 6 process control block (PCB), 7 resource acquisition priority,
8 resource lock mode, 10 exclusive control unit, 18 conventional exclusive control unit, 20 read P command unit, 30 write P command unit, 40 read V command unit, 50
Write system V command part, 180 Conventional semaphore management table, 181 Wait process list pointer, 182
value, 183 Conventional process control block (P
CB), 184 next pointer, 190 conventional P
Command part, 200 Conventional V command part.

Claims (13)

【特許請求の範囲】[Claims] 【請求項1】 以下の要素を有する共用資源の資源管理
装置 (a)読み込み系プロセスに対して共用排他的に共用資
源の獲得を実行する読み込み系命令部と、書き込み系プ
ロセスに対して排他的に共用資源の獲得を実行する書き
込み系命令部を備えた排他制御部、(b)読み込み系プ
ロセスに対して、上記排他制御部の読み込み系命令部を
実行させ、書き込み系プロセスに対して、上記排他制御
部の書き込み命令部を実行させる制御手段。
1. A resource management device for shared resources having the following elements: (a) a read instruction unit for executing exclusive acquisition of a shared resource for a read process and an exclusive write process. An exclusive control unit having a write-related instruction unit that executes acquisition of shared resources, and (b) the read-related instruction unit of the exclusive control unit is executed by the read-related process and Control means for executing the write command section of the exclusive control section.
【請求項2】 上記制御手段は、読み込み系プロセスと
書き込み系プロセスに対して資源獲得優先度を割り当
て、資源獲得優先度に基づいて、読み込み系プロセスと
書き込み系プロセスに対する上記排他制御部による資源
獲得順を決定することを特徴とする請求項1記載の資源
管理装置。
2. The control means allocates a resource acquisition priority to a read process and a write process, and acquires the resource by the exclusive control unit for the read process and the write process based on the resource acquisition priority. The resource management device according to claim 1, wherein the order is determined.
【請求項3】 上記資源獲得優先度としてプロセス固有
の属性値を用いることを特徴とする請求項2記載の資源
管理装置。
3. The resource management device according to claim 2, wherein a process-specific attribute value is used as the resource acquisition priority.
【請求項4】 上記プロセス固有の属性値としてプロセ
スのスケジューリング優先度を用いることを特徴とする
請求項3記載の資源管理装置。
4. The resource management apparatus according to claim 3, wherein the scheduling priority of the process is used as the attribute value unique to the process.
【請求項5】 プロセス固有の属性値としてプロセスの
既占有資源数を用いることを特徴とする請求項3記載の
資源管理装置。
5. The resource management device according to claim 3, wherein the number of occupied resources of the process is used as the attribute value unique to the process.
【請求項6】 プロセス固有の属性値として主メモリ上
に存在するプロセス実行イメージの主メモリ占有容量を
用いることを特徴とする請求項3記載の資源管理装置。
6. The resource management apparatus according to claim 3, wherein the main memory occupation capacity of the process execution image existing on the main memory is used as a process-specific attribute value.
【請求項7】 プロセス固有の属性値としてプロセスの
CPU使用時間を用いることを特徴とする請求項3記載
の資源管理装置。
7. The resource management apparatus according to claim 3, wherein the CPU usage time of the process is used as the attribute value unique to the process.
【請求項8】 プロセス固有の属性値としてプロセスの
処理重要度を用いることを特徴とする請求項3記載の資
源管理装置。
8. The resource management device according to claim 3, wherein the processing importance of the process is used as a process-specific attribute value.
【請求項9】 上記資源獲得優先度の値を資源獲得要求
時に明示的に指定できることを特徴とする請求項2記載
の資源管理装置。
9. The resource management device according to claim 2, wherein the value of the resource acquisition priority can be explicitly designated at the time of a resource acquisition request.
【請求項10】 上記資源獲得優先度をプロセス毎に各
資源に対応して予め登録できる手段を設けたことを特徴
とする請求項2記載の資源管理装置。
10. The resource management apparatus according to claim 2, further comprising means for registering the resource acquisition priority in advance for each resource for each process.
【請求項11】 上記資源獲得優先度の値としてプロセ
スの資源占有時間を用いることを特徴とする請求項10
記載の資源管理装置。
11. The resource occupation time of a process is used as the value of the resource acquisition priority.
The described resource management device.
【請求項12】 上記資源獲得優先度の値を任意個の尺
度の組合せで決定することを特徴とする請求項2記載の
資源管理装置。
12. The resource management device according to claim 2, wherein the value of the resource acquisition priority is determined by a combination of arbitrary scales.
【請求項13】 資源獲得優先度の設定方式を複数種類
備え、各資源毎に資源獲得優先度の設定方式を選択する
手段を設けたことを特徴とする請求項2記載の資源管理
装置。
13. The resource management apparatus according to claim 2, further comprising a plurality of resource acquisition priority setting methods, and means for selecting a resource acquisition priority setting method for each resource.
JP14344594A 1994-06-24 1994-06-24 Resource management device Pending JPH0816456A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP14344594A JPH0816456A (en) 1994-06-24 1994-06-24 Resource management device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP14344594A JPH0816456A (en) 1994-06-24 1994-06-24 Resource management device

Publications (1)

Publication Number Publication Date
JPH0816456A true JPH0816456A (en) 1996-01-19

Family

ID=15338868

Family Applications (1)

Application Number Title Priority Date Filing Date
JP14344594A Pending JPH0816456A (en) 1994-06-24 1994-06-24 Resource management device

Country Status (1)

Country Link
JP (1) JPH0816456A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7428619B2 (en) 2005-01-18 2008-09-23 Sony Computer Entertainment Inc. Methods and apparatus for providing synchronization of shared data
JP2013117852A (en) * 2011-12-02 2013-06-13 Internatl Business Mach Corp <Ibm> Device and method for acquiring lock of resource

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7428619B2 (en) 2005-01-18 2008-09-23 Sony Computer Entertainment Inc. Methods and apparatus for providing synchronization of shared data
JP2013117852A (en) * 2011-12-02 2013-06-13 Internatl Business Mach Corp <Ibm> Device and method for acquiring lock of resource

Similar Documents

Publication Publication Date Title
Hoare Monitors: An operating system structuring concept
JP6897574B2 (en) Accelerator controller, accelerator control method and program
US5826082A (en) Method for reserving resources
US9430388B2 (en) Scheduler, multi-core processor system, and scheduling method
Baker A stack-based resource allocation policy for realtime processes
JP3689336B2 (en) Method and system for arbitrating concurrent transaction streams in a database
EP2312441B1 (en) Scheduling of instructions groups for cell processors
US6438553B1 (en) Distributed job integrated management system and method
US7735087B2 (en) Task switching apparatus, method and program
EP0969382A2 (en) Method for efficient non-virtual main memory management
US8375390B2 (en) Scheduling method and scheduling apparatus
US20100153957A1 (en) System and method for managing thread use in a thread pool
JPH07319714A (en) Method and system for selective application of proper object ownership model
KR101150661B1 (en) Information processing device and memory area management method
US20150254113A1 (en) Lock Spin Wait Operation for Multi-Threaded Applications in a Multi-Core Computing Environment
JP6724908B2 (en) Accelerator control device, accelerator control method and program
US6662364B1 (en) System and method for reducing synchronization overhead in multithreaded code
US20220237016A1 (en) Apparatus for determining resource migration schedule
JP5614699B2 (en) Task assignment related method for multi-core system, apparatus thereof, system thereof, and program thereof
CN116244073A (en) Resource-aware task allocation method for hybrid key partition real-time operating system
JPH0816456A (en) Resource management device
JP2022079764A (en) Synchronous control system and synchronous control method
JP2008225641A (en) Computer system, interrupt control method and program
Audsley Resource control for hard real-time systems: A review
Xu A Semi-partitioned Model for Scheduling Mixed Criticality Multi-core Systems