[go: up one dir, main page]

JPH03154945A - Shared memory management method - Google Patents

Shared memory management method

Info

Publication number
JPH03154945A
JPH03154945A JP1292310A JP29231089A JPH03154945A JP H03154945 A JPH03154945 A JP H03154945A JP 1292310 A JP1292310 A JP 1292310A JP 29231089 A JP29231089 A JP 29231089A JP H03154945 A JPH03154945 A JP H03154945A
Authority
JP
Japan
Prior art keywords
shared memory
task
logical
control table
address
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
JP1292310A
Other languages
Japanese (ja)
Inventor
Naomichi Nonaka
尚道 野中
Keiichi Nakane
啓一 中根
Teiji Kuwabara
禎司 桑原
Hiroyuki Koreeda
浩行 是枝
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP1292310A priority Critical patent/JPH03154945A/en
Publication of JPH03154945A publication Critical patent/JPH03154945A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。
(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は各タスクが独立した論理アドレス空間を持つマ
ルチタスクシステムにおけるタスク間共有メモリの管理
方式に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a method for managing shared memory between tasks in a multitasking system in which each task has an independent logical address space.

〔従来の技術〕[Conventional technology]

複数個のタスクが並行動作するマルチタスクシステムに
おいて、それらタスク間でのデータの受は渡しを実現す
る方法の一つとして、複数タスクからアクセス可能な共
有メモリを設け、共有メモリに対してデータの読み書き
を行うことでタスク相互間の交信を行う方法が知られて
いる。このような共有メモリを実現するために、システ
ム、では共有メモリに対するアクセスの可能性、及び、
アクセスの確実性を保障する機構を提供する必要がある
In a multitasking system where multiple tasks operate in parallel, one way to transfer data between these tasks is to provide a shared memory that can be accessed by multiple tasks, and transfer data to the shared memory. A method of communicating between tasks by reading and writing is known. In order to realize such a shared memory, the system considers the possibility of access to the shared memory and
It is necessary to provide a mechanism to ensure reliable access.

アクセス可能性とは、共有メモリに対して、他の共有で
ないメモリと同様に内容の読み書きが行えることを言い
、アクセス確実性とは、ある一連の共有メモリアクセス
が不可分であり、その間は他のタスクによる共有メモリ
アクセスは行われないことを言う。尚、アクセス確実性
は特に共有メモリに限って必要な機能ではなく、タスク
が持つ種々の資源を使用する際に必要となる機能であり
、一般には、タスク間の相互排除(mILtual e
xclusion)問題として知られている。
Accessibility refers to the fact that the contents of shared memory can be read and written in the same way as other non-shared memory, and access certainty refers to the fact that a series of shared memory accesses is atomic and that other This means that shared memory access by tasks is not performed. Note that access reliability is not a function that is necessary only for shared memory, but is a function that is necessary when using various resources possessed by tasks.
xclusion) problem.

さて、タスク毎に固有の独立した論理アドレス空間を持
ち、全タスクに共通したタスクのグローバルアドレス空
間を持たないマルチタスクシステムにおいて、共有メモ
リを実現する場合、従来は以下に示す様な方式が利用さ
れていた。
Now, when implementing shared memory in a multitasking system where each task has its own independent logical address space and does not have a task global address space common to all tasks, the following methods have traditionally been used. It had been.

まず、アクセス可能性については、論理的なシステム資
源である共有メモリをタスク固有のアドレス空間の一部
に割付けて論理−物理アドレスマツ、ピンクを変更する
ことで実現する。複数のタスクが同一の共有メモリをそ
れぞれ自らのアドレス空間に割付けることで、任意のタ
スク間でのメモリの共有が行える。このように、共有メ
モリを固有のアドレス空間の一部に割付けることを共有
メモリをアタッチすると呼ぶ。
First, accessibility is achieved by allocating shared memory, which is a logical system resource, to a part of the task-specific address space and changing the logical-physical address space. By allocating the same shared memory to multiple tasks in their own address spaces, memory can be shared among arbitrary tasks. Allocating shared memory to a part of a unique address space in this way is called attaching shared memory.

また、アクセス確実性については、特に、共有メモリ専
用の機構は設けずに、タスク間の相互排除を実現する汎
用の機構であるセマフォを利用して実現する。
Furthermore, access reliability is achieved by using semaphores, which are general-purpose mechanisms that realize mutual exclusion between tasks, without providing a mechanism specifically for shared memory.

このようなシステムには、例えば、米国のAT&T社に
よって開発されたUNIXオペレーティングシステム等
が存在する。
Examples of such systems include the UNIX operating system developed by AT&T of the United States.

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

上記従来技術は広大な論理アドレス空間を持つミニコン
等のシステムを念頭において開発された技術であり、小
さな論理アドレス空間しか持たないマイクロプロセッサ
を用いたシステムでは、各タスクに固有なプログラムや
データがそのタスクの論理アドレス空間の大部分を占め
てしまい、共有メ)、モリをいくつもアタッチするため
に論理アドレス空間を割くことは不可能であるという問
題があった。
The above conventional technology was developed with systems such as minicomputers that have a vast logical address space in mind, and in systems using microprocessors that have only a small logical address space, programs and data specific to each task are This problem occupies most of the task's logical address space, making it impossible to allocate the logical address space to attach multiple memories (shared memory).

本発明の目的は、論理アドレス空間の大きさが比較的小
さなシステムでも、複数の共有メモリを同−論理アドレ
スへとマツピング可能とすることで、多数の共有メモリ
を利用可能とすることにある。
An object of the present invention is to make it possible to use a large number of shared memories by making it possible to map a plurality of shared memories to the same logical address even in a system where the size of the logical address space is relatively small.

〔課題を解決するための手段〕[Means to solve the problem]

上記目的を達成するために、 本発明はシステム資源である共有メモリを管理するため
の共有メモリ管理チーフルと、タスクと共有メモリとの
対応関係を管理するためのアタッチ管理テーブルと、タ
スクと共有メモリの対応付けを行うためのアタッチ手段
と、共有メモリの排他アクセスを開始するためのロック
手段と、共有メモリの排他アクセスを終了するためのア
ンロック手段とを設けることを特徴とする。
To achieve the above object, the present invention provides a shared memory management table for managing shared memory, which is a system resource, an attached management table for managing the correspondence between tasks and shared memory, and a shared memory management table for managing shared memory, which is a system resource. The present invention is characterized in that it includes an attaching means for making the association, a locking means for starting exclusive access to the shared memory, and an unlocking means for terminating the exclusive access to the shared memory.

〔作 用〕[For production]

共有メモリ管理テーブルは、主メモリ上での共有メモリ
の位置、大きさ、及び、状態を保持する。
The shared memory management table holds the location, size, and state of shared memory on main memory.

アタッチ管理テーブルは、タスクが共有メモリをアタッ
チした際の、共有メモリのタスク論理アドレス空間上で
の位置を保持する。
The attach management table holds the position of the shared memory in the task logical address space when the task attaches the shared memory.

アンクチ手段はタスクが共有メモリをアタッチする際に
実行され、アタッチ管理テーブルに共有メモリのタスク
論理アドレス空間上での位置を格納する。タスクがアタ
ッチ手段を実行した時点では論理−物理アドレスマツピ
ングの切換えは行わない。
The anti-quench means is executed when a task attaches a shared memory, and stores the position of the shared memory on the task logical address space in the attach management table. At the time when the task executes the attach means, the logical-physical address mapping is not switched.

ロック手段は、タスクが共有メモリに対するアクセスを
始める前に実行され、共有メモリ管理テーブルの状態を
ロック中に変更し、また、共有メモリ管理テーブル及び
アタッチ管理テーブルの値に基づいて、タスクの論理−
物理アドレスマツピングを変更し、タスクが共有メモリ
をアクセス可能とする。この際、ロックを行う共有メモ
リの状態が既にロック中であった場合は、ロック処理を
失敗とすることで、共有メモリアクセスの相互排他を実
現する。
The locking means is executed before the task starts accessing the shared memory, changes the state of the shared memory management table to locked, and also changes the logic of the task based on the values of the shared memory management table and the attachment management table.
Change physical address mapping to allow tasks to access shared memory. At this time, if the state of the shared memory to be locked is already locked, the locking process is set to fail, thereby achieving mutual exclusion of shared memory access.

アンロック手段はタスクが共有メモリに対するアクセス
を終えた後に実行され、共有メモリ管理テーブルの状態
を非ロツク中とし、他のタスクによりロックが可能な状
態とするとともに、タスクの論理−物理アドレスマツピ
ングを変換し、共有メモリアクセスを不可能とする。
The unlocking means is executed after the task finishes accessing the shared memory, and sets the state of the shared memory management table to unlocked so that it can be locked by other tasks, and also changes the logical-physical address mapping of the task. , making shared memory access impossible.

タスクはアタッチ手段を実行した後、共有メモリに対し
てアクセスを行う際は、ロック手段実行、共有メモリア
クセス、アンロック手段実行という一連の処理として排
他アクセスを行う。
When the task accesses the shared memory after executing the attaching means, it performs exclusive access as a series of processes of executing the locking means, accessing the shared memory, and executing the unlocking means.

アタッチ手段ではアドレスマツピングの変更は行わず、
ロック手段でアドレスマツピングの変更を行うために、
アタッチ手段では複数の共有メモリを同−論理アドレス
に割付けることが可能であり、また、その割付けられた
アドレスはアタッチ管理テーブルに格納されているため
、ロック手段ではアタッチ管理テーブルを参照すること
で論理−物理アドレスマツピングを変更することが可能
となる。
The attach method does not change the address mapping,
To change address mapping using locking means,
The attach means can allocate multiple shared memories to the same logical address, and the allocated addresses are stored in the attach management table, so the lock means can refer to the attach management table. It becomes possible to change the logical-physical address mapping.

〔実稗例〕[Example]

以下−9本発明の一実旅例を図面を用いて説明する。 Below, a practical example of the present invention will be described with reference to the drawings.

第1図は本実施例に係るハードウェアのブロック図であ
る。
FIG. 1 is a block diagram of hardware according to this embodiment.

本実施例のハードウェアは、データ処理を行うCPU 
(処理装置)1、CPU1が実行するプログラムやデー
タを記憶する主メモリ2、プログラムやデータを格納す
る二次記憶装置であるノ・−ドディスク(以下El)と
略す)3、及び、フロッピ4、文字や機能を入力するキ
ーボード5、処理結果等を表示するデイスプレィ7、処
理結果等を印刷するプリンタ8.CPU1の出力するメ
モリアドレスである論理アドレスを主メモリ2をアクセ
スする際に使用されるメモリアドレスである物理アドレ
スに変換するアドレス変換器9より構成される。
The hardware of this embodiment is a CPU that performs data processing.
(Processing device) 1, main memory 2 that stores programs and data executed by the CPU 1, node disk (hereinafter referred to as El) 3, which is a secondary storage device that stores programs and data, and floppy disk 4 , a keyboard 5 for inputting characters and functions, a display 7 for displaying processing results, etc., and a printer 8 for printing processing results, etc. It is comprised of an address converter 9 that converts a logical address, which is a memory address output by the CPU 1, into a physical address, which is a memory address used when accessing the main memory 2.

第3図にアドレス変換器の説明図を示す。アドレス変換
器9はマツピングテーブル91及び加算器92により構
成される。入力された論理アドレス値はインデックス部
とオフセット部とに分割され、インデックス部の値をマ
ツピングテーブル91を用いて変換した値とオフセット
部の値を加算することによって対応する物理アドレス値
が算出される。
FIG. 3 shows an explanatory diagram of the address converter. The address converter 9 is composed of a mapping table 91 and an adder 92. The input logical address value is divided into an index part and an offset part, and the corresponding physical address value is calculated by adding the value obtained by converting the value of the index part using the mapping table 91 and the value of the offset part. Ru.

第4図に論理アドレスから物理アドレスへの変換方法の
説明図を示す。れビットの論理アドレス値は、kビット
のインデックス部と(ルーA)ビットのオフセット部に
分割され、インデックス部の値はマツピングテーブル9
1のエントリ番号となる。
FIG. 4 shows an explanatory diagram of a method of converting a logical address to a physical address. The logical address value of the bit is divided into an index part of k bits and an offset part of (rou A) bits, and the value of the index part is stored in the mapping table 9.
The entry number is 1.

マツピングテーブル91は2に個のエントリを持つ配列
であり、各エントリには物理アドレスのベース値が格納
されている。そして、このベース値と論理アドレスのオ
フセット部の値とを加算することでmビットの物理アド
レス値が計算される。
The mapping table 91 is an array having 2 entries, and each entry stores a base value of a physical address. Then, by adding this base value and the value of the offset part of the logical address, an m-bit physical address value is calculated.

第2図に本発明の説明図を示す。FIG. 2 shows an explanatory diagram of the present invention.

個々のタスクは独立した論理アドレス空間を持ち、通常
は他のタスクのアドレス空間内をアクセスすることはで
きない。
Each task has an independent logical address space, and normally cannot access the address space of other tasks.

共有メモリは番号(共有メモリ番号)により区別され、
物理空間上では各々重ならない位置に存在する。
Shared memory is distinguished by a number (shared memory number).
They exist in non-overlapping positions in physical space.

タスクは自らの論理空間の一部に共有メモリをアン、ク
チする。第1図の例ではタスクAが共有メモリ#1と#
2、タスクBは共有メモリ#2と#6をアタッチしてい
る。各タスクとも、二つの共有メモリを同一アドレスに
アタッチしているが、論理−物理アドレスマツピングは
変わっていないため、別に矛盾は生じない。
A task removes shared memory from part of its logical space. In the example in Figure 1, task A has shared memory #1 and #
2. Task B has attached shared memories #2 and #6. Although each task attaches two shared memories to the same address, the logical-physical address mapping remains unchanged, so no contradiction occurs.

実際に共有メモリをアクセスする際は、アクセス処理の
前後をロック処理とアンロック処理ではさんで、アクセ
スの排他性を確保する。ロック処理では排他制御に加え
て論理−物理アドレスマツピングの切換え処理を行い、
タスクが共有メモリをアクセスすることを可能とする。
When actually accessing the shared memory, lock processing and unlock processing are performed before and after the access processing to ensure exclusivity of access. In lock processing, in addition to exclusive control, logical-physical address mapping switching processing is performed,
Allows tasks to access shared memory.

次に、本実施例で使用するデータ構造を示す。Next, the data structure used in this example is shown.

本実施例では、タスク制御ブロック(以下TCBと略す
)20.共有メモリ管理テーブル(以下SMBと略す)
60、アタッチ管理チーフル(以下ATEと略す)35
の三種類のデータ構造を使用する。
In this embodiment, a task control block (hereinafter abbreviated as TCB) 20. Shared memory management table (hereinafter abbreviated as SMB)
60, Attach Management Chiful (hereinafter abbreviated as ATE) 35
We use three types of data structures:

第5図にTCB 20の構成を示す。TCB 20はタ
スクと一対一に対応したデータ構造であり、リンクポイ
ンタ2001、タスク優先度2002、タスク状態20
03、レジスタ退避2004 、ATEポインタ200
5、ロック数カウンタ2006の各フィールドが存在す
る。
FIG. 5 shows the configuration of the TCB 20. The TCB 20 is a data structure that corresponds one-to-one with tasks, and includes a link pointer 2001, task priority 2002, and task status 20.
03, Register save 2004, ATE pointer 200
5. Each field of the lock number counter 2006 exists.

リンクポインタ2001は他のTCB 20のアドレス
を保持し、レディキューや種々の待ち行列を作成するた
めに使用される。
Link pointer 2001 holds addresses of other TCBs 20 and is used to create ready queues and various queues.

タスク優先度2002はタスクが実行される際の優先度
を示す。
Task priority 2002 indicates the priority at which a task is executed.

タスク状態2003は、実行可能/待ちといったタスク
をスケジュールする際に必要な情報が格納される。
The task status 2003 stores information necessary for scheduling a task, such as executable/waiting.

レジスタ退避2004はタスク処理の中断/再開を正し
く行うために必要なCPU 1の内部レジスタの値が格
納される。実行するタスクを切換える際は、処理が中断
されるタスクのTCE 25内のレジスタ退避2004
に中断時点でのCPU 1の内部レジスタの値が退避さ
れ、再開するタスクのTCB 25内のレジスタ退避2
004の内容をCPU 1の内部レジスタへと回復する
ことで、中断時のタスク実行環境を再現し、再開が正し
く行われる。
The register save 2004 stores the values of internal registers of the CPU 1 necessary for correctly suspending/resuming task processing. When switching the task to be executed, save the register 2004 in the TCE 25 of the task whose processing is interrupted.
The value of the internal register of CPU 1 at the time of interruption is saved, and the value of register 2 in TCB 25 of the restarted task is saved.
By restoring the contents of 004 to the internal register of the CPU 1, the task execution environment at the time of interruption is reproduced, and restart is performed correctly.

複数のタスクを次々と切換えながら時分側条lシステム
の動作方式としては広く知られた方式であるため、詳細
な説明は省略する。
Since this is a widely known method of operating the time/minute side track system, which switches between a plurality of tasks one after another, a detailed explanation will be omitted.

ATBポインタ2005は後述するATE 35のアド
レスを示し、タスクの共有メモリアタッチ状態を管理す
るために使用する。
The ATB pointer 2005 indicates the address of the ATE 35, which will be described later, and is used to manage the shared memory attachment state of the task.

ロック数カウンタ2006はタスクがロック中の共有メ
モリの数を示す。この値はロック処理、及び、アンロッ
ク処理時に更新され、ロック処理のデノドロツタ回避に
利用される。
A lock number counter 2006 indicates the number of shared memories locked by a task. This value is updated during lock processing and unlock processing, and is used to avoid dropouts during lock processing.

第6図にSMB 30の構成を示す。SMB 30は共
有メモリと一対一に対応したデータ構成であり、先頭ア
ドレス5001 、共有メモリ長3002 、 ATB
ポインタ3003 、共有メモリ状Q 3004の各フ
ィールドが存在する。
FIG. 6 shows the configuration of the SMB 30. The SMB 30 has a data configuration that corresponds one-to-one with the shared memory, including a start address 5001, shared memory length 3002, and ATB.
There are fields such as a pointer 3003 and a shared memory type Q 3004.

先頭アドレス5001は共有メモリの物理空間上での先
頭アドレス値を保持する。
The start address 5001 holds the start address value in the physical space of the shared memory.

共有メモリ長3002は共有メモリの長さを保持する。The shared memory length 3002 holds the length of the shared memory.

ATBポインタ3003は後述するATB 35のアド
レスを保持し、共有メモリに対してアタッチを行ってい
るタスクを管理するために使用する。
The ATB pointer 3003 holds the address of the ATB 35, which will be described later, and is used to manage tasks attaching to the shared memory.

共有メモリ状態3004はその共有メモリがロック中か
否かという状態を保持する。
A shared memory status 3004 holds the status of whether the shared memory is locked or not.

次に、第7図にATE 35の構成を示す。ATB 3
5はタスクと共有メモリの対応関係を管理するデータ構
造であり、リンクポインタa 3501、TCBポイン
タ6502、リンクポインタb 3503、SMBポイ
ンタ3504 、アタッチアドレス3505の各フィー
ルドが存在する。
Next, FIG. 7 shows the configuration of the ATE 35. ATB 3
5 is a data structure for managing the correspondence between tasks and shared memory, and includes fields of link pointer a 3501, TCB pointer 6502, link pointer b 3503, SMB pointer 3504, and attach address 3505.

リンクポインタ、 3501は他のATE 35のアド
レスを保持し、ATB 35のタスクに対するリストを
形成する。一方、リンクポインタ63503も同様にA
TE 35のアドレス保持し、ATB 35の共有メモ
リに対するリストを形成する。、ATB 35のタスク
に対するリストの先頭はTCB 20内のATEポイン
タ2005か示すATB 35であり、共有メモリに対
するリストの先頭はSMB 20内のATBポインタ6
006が示すATB35である。
A link pointer, 3501, holds the addresses of other ATEs 35 and forms a list for the ATB 35's tasks. On the other hand, the link pointer 63503 is also A
Holds the address of TE 35 and forms a list for shared memory of ATB 35. , the head of the list for tasks in ATB 35 is ATB 35 pointing to ATE pointer 2005 in TCB 20, and the head of the list for shared memory is ATB pointer 6 in SMB 20.
006 is the ATB35 indicated.

TCBポインタ5502はそのATBS5が属するタス
ク側リストを保持するタスクのTCE 20のアドレス
を示す。
TCB pointer 5502 indicates the address of the task's TCE 20 that holds the task side list to which the ATBS 5 belongs.

同様に、SHEポインタ6504はそのATB 35が
属する共有メモリ側リストを保持する共有メモリのSM
E 30のアドレスを示す。
Similarly, the SHE pointer 6504 points to the shared memory SM which holds the shared memory side list to which the ATB 35 belongs.
Indicates the address of E30.

アタッチアドレス6505はTCBポインタ35o2が
示すタスクがSMBポインタ3504の示す共有メモリ
をアタッチする際のタスク論理空間上での共有メモリの
先頭アドレスを保持する。
The attach address 6505 holds the start address of the shared memory in the task logical space when the task indicated by the TCB pointer 35o2 attaches the shared memory indicated by the SMB pointer 3504.

タスクと共有メモリの関係は、タスクは複数個の共有メ
モリをアタッチ可能であり、また、共有メモリは複数の
タスクからアタッチされることができるという多対多の
対応関係となるため、ATB35をタスク側リストと共
有メモリ側リストという二重のリスト構造によって結び
つけることで、多対多の対応関係を表現する。
The relationship between tasks and shared memory is a many-to-many relationship in which a task can attach multiple pieces of shared memory, and shared memory can be attached from multiple tasks. A many-to-many correspondence is expressed by linking through a double list structure: a side list and a shared memory side list.

TCB 20、SMB 50 、 ATB 35間の関
連を第8図に示す。第8図はタスクAが共有メモリ#1
と#2なアタッチし、タスクBが共有メモリ#2をアタ
ッチしている場合の各データ間の関連を例として示した
次に1本実施例におけるアタッチ処理、ロック処理、ア
ンロック処理の内容について説明する。
The relationship between TCB 20, SMB 50, and ATB 35 is shown in FIG. In Figure 8, task A is shared memory #1.
and #2, and the relationship between each data when task B attaches shared memory #2 is shown as an example.Next, the contents of attach processing, lock processing, and unlock processing in this embodiment are explained below. explain.

第9図はアタッチ処理の流れ図である。FIG. 9 is a flowchart of the attach process.

アタッチ処理はアタッチの対象となる共有メモリ番号、
及び、その共有メモリのタスク論理空間上でのアタッチ
アドレスを引き数として実行される。
The attach process uses the shared memory number to be attached,
And, it is executed using the attach address on the task logical space of the shared memory as an argument.

まず、ステップ5001でATB 35を1つ獲得し、
ステップ5002で獲得したATB 35のアタッチア
ドレス5505に引き数として指定されたアタッチアド
レスの値を格納する。
First, obtain one ATB 35 in step 5001,
The value of the attach address specified as an argument is stored in the attach address 5505 of the ATB 35 obtained in step 5002.

次ニ、ステップ5003でアタッチを行うタスクの持つ
ATBリストの先頭に獲得したATB55をつなぐ。
Next, in step 5003, the acquired ATB 55 is connected to the head of the ATB list held by the task to be attached.

具体的には、TCE 20のATBポインタ2005に
獲得したATE55のアドレスを格納し、獲得ATB 
35のリンクポインタa 3501にTCE 20のA
TBポインタ2005の旧格納値を格納し、TCBポイ
ンタ3502にてタッチを行うタスクのTCB 20の
アドレスを格納する。
Specifically, the address of the acquired ATE55 is stored in the ATB pointer 2005 of the TCE 20, and the acquired ATB
35 link pointer a TCE 20 A to 3501
The old stored value of the TB pointer 2005 is stored, and the address of the TCB 20 of the task performing the touch with the TCB pointer 3502 is stored.

続いてステップ5004でアタッチされる共有メモリ9
妨つATBリストの先頭に獲得したATB55をつなぐ
。この場合も同様にSMB 30のATBポインタ60
06に獲得したATB 35のアドレスを格納し、獲得
ATB 35のリンクポインタb 3503にSMB 
30のATBポインタ6003の旧格納値を格納し、S
MBポインタ3504にアタッチされる共有メモリのS
HE 30のアドレスを格納する。
Subsequently, the shared memory 9 attached in step 5004
Connect the acquired ATB55 to the top of the blocking ATB list. In this case as well, the ATB pointer 60 of SMB 30
Store the address of the acquired ATB 35 in 06 and send the SMB to the link pointer b 3503 of the acquired ATB 35.
The old stored value of ATB pointer 6003 of 30 is stored, and S
S of shared memory attached to MB pointer 3504
Stores the address of HE 30.

以上がアタッチ処理の内容である。次に、ロック処理の
流れ図を第10図に示す。
The above is the content of the attach process. Next, a flowchart of the locking process is shown in FIG.

ロック処理はロックを行う1つ以上の共有メモリ番号を
引き数として実行される。あるタスクがある共有メモリ
をロックしていると、他のタスクはその共有メモリのロ
ックが行えずに待ちとなるが、二つのタスクが、それぞ
ハ、同じ複数個の共有メモリをロックする場合、一つず
つロックを行っていたのでは互いに他のタスクがアンロ
ックするのを待つデッドロック状態が生じる可能性があ
るため、複数個の共有メモリを一回のロック処理でロッ
クできるようにし、また、ロック中は全てアンロックす
るまで他の共有メモリのロックを行ロック処理では、ま
す、ステップ6001でTCB 20のロック数カウン
タ2006の値を調べ 0であれば、スラップ6002
へと進んでロック処理を続行し、0でない場合は、ステ
ップ6011へと進み、ロック処理が失敗したことをタ
スクに通知して処理を終了する。
Lock processing is executed using one or more shared memory numbers to be locked as arguments. When one task locks a certain shared memory, other tasks cannot lock the shared memory and wait. However, if two tasks each lock the same multiple pieces of shared memory. , locking one task at a time may lead to a deadlock situation where each task waits for another task to unlock it, so it is possible to lock multiple shared memories in one locking process. Also, during row lock processing, lock other shared memories until they are all unlocked.In step 6001, check the value of the lock number counter 2006 of the TCB 20. If it is 0, slap 6002
If the value is not 0, the process proceeds to step 6011, notifies the task that the lock process has failed, and ends the process.

ステップ6002では引き数として指定された共有メモ
リのタスク論理空間上でのマツピングに重複があるかど
うかをチエツクする。論理空間上での先頭位置はATB
 35のアタッチアドレス3505 、共有メモリの大
きさはSHE 30の共有メモリ長3002から求めて
チエツクを行う。チエツク結果として重なりがあった場
合は、ステップ6011へ進んでロック処理を失敗とし
て終了し、重なりがなかった場合はステップ6006へ
進ム。
In step 6002, it is checked whether there is any overlap in the mapping of the shared memory specified as an argument on the task logical space. The first position in the logical space is ATB
The attach address 3505 of SHE 35 and the size of the shared memory are determined from the shared memory length 3002 of SHE 30 and checked. If there is an overlap as a result of the check, the process proceeds to step 6011, where the lock processing is terminated as a failure, and if there is no overlap, the process proceeds to step 6006.

ステップ6003ではロックの対象となる共有メモリの
SMB !10の共有メモリ状態3004の値を調べ。
In step 6003, SMB! of the shared memory to be locked is selected. Check the value of shared memory status 3004 of 10.

対象共有メモリが全て非ロック中状態かどうかを判定す
る。一つでもロック中状態の共有メモリが有メモリロッ
ク待ちとする。この待ち状態は後述するアンロック処理
によりて解除され、処理が再開すると、再び、ステップ
6003へと戻って再度判定を行う。
Determine whether all target shared memory is unlocked. It is assumed that at least one shared memory is in the locked state and is waiting for a memory lock. This waiting state is released by unlock processing to be described later, and when the processing is restarted, the process returns to step 6003 and the determination is made again.

対象タスクが全て非ロック中状態であった場合はステッ
プ6004へと進み、引き数で指定された共有メモリか
ら一つを選択する。
If all the target tasks are in the unlocked state, the process advances to step 6004, and one of the shared memories specified by the argument is selected.

次に、ステップ6005で選択した共有メモリのSHE
 30の共有メモリ状態6004をロック中とし、ステ
ップ6006で論理−物理アドレスマツピングを変更し
て対象共有メモリがタスクよりアクセス可能トスる。マ
ツピング変更はArn55のアタッチアドレス3505
に格納されている論理アドレスが、SHE 30の先頭
アドレス3001に格納されている物理アドレスを示す
ようにマツピングテーブル91の内容を変更することに
よって行う。
Next, the SHE of the shared memory selected in step 6005 is
The shared memory status 6004 of No. 30 is set to locked, and the logical-physical address mapping is changed in step 6006 to make the target shared memory accessible to the task. Mapping change is Arn55 attach address 3505
This is done by changing the contents of the mapping table 91 so that the logical address stored in the first address 3001 of the SHE 30 indicates the physical address stored in the first address 3001 of the SHE 30.

次に、ステップ6007で引き数に指定された共有メモ
リ全てにステップ6005〜6006の処理を行ったか
どうかを判定し、゛まだ、残っていればステップ600
4へと戻って次の共有メモリに対して処理な行う。
Next, in step 6007, it is determined whether the processes of steps 6005 and 6006 have been performed on all the shared memories specified as arguments.
Return to step 4 and perform processing on the next shared memory.

指定された共有メモリ全てに対して処理が行われるとス
テップ6008へ進み、TCB 20のロック数カウン
タ2006にロックした共有メモリ数を設定する。
When all the specified shared memories have been processed, the process advances to step 6008, and the number of locked shared memories is set in the lock number counter 2006 of the TCB 20.

そして、ステップ6009でタスクにロック処理の成功
を通知し、ロック処理を終了する。以上がロック処理の
内容である。
Then, in step 6009, the task is notified of the success of the locking process, and the locking process is ended. The above is the content of the lock processing.

次に、アンロック処理の流れ図を第11図に示す。Next, a flowchart of the unlocking process is shown in FIG.

アンロック処理はアンロックを行う1つ以上の共有メモ
リ管理を引き数として実行される。
The unlocking process is executed using one or more shared memory managers to be unlocked as arguments.

まず、ステップ7001で引き数で指定された共有メモ
リから一つを処理対象として選択する。
First, in step 7001, one of the shared memories specified by the argument is selected as a processing target.

次に、ステップ7002で対象共有メモリの5MB50
の共有メモリ状態3004の値を非ロツク中とし、続い
て、ステップ7006で論理−物理アドレスマツピング
を変更して対象共有メモリがタスクによりアクセス不可
能な状態とする。マツピング変更はATE 35のアタ
ッチアドレス6505に格納されている論理アドレスが
無効なアドレスを示すようにマツピングテーブル91の
内容を変更することによって行う。
Next, in step 7002, 5MB50 of the target shared memory is
The value of the shared memory status 3004 of the task is set to unlocked, and then, in step 7006, the logical-physical address mapping is changed to make the target shared memory inaccessible by the task. The mapping change is performed by changing the contents of the mapping table 91 so that the logical address stored in the attach address 6505 of the ATE 35 indicates an invalid address.

一つの共有メモリに対する処理が終わるとステップ70
04に進み、指定された全ての共有メモリに対して処理
が行われたかどうかを判定し、まだ、残っていればステ
ップ7001へと戻って次の共有メモリに対して処理を
行う。
When processing for one shared memory is completed, step 70
The process advances to step 04, and it is determined whether or not all the specified shared memories have been processed. If there are any remaining shared memories, the process returns to step 7001 to process the next shared memory.

指定された共有メモリ全てに対してステップ7002〜
7006の処理を行うとステップ7005に進み、TC
B 20のロック数カウンタ2006の値をアンロック
した共有メモリの数だけ減らす。
Steps 7002~ for all specified shared memories
After processing 7006, the process advances to step 7005, where the TC
Decrement the value of the lock number counter 2006 of B 20 by the number of unlocked shared memories.

次に、ステップ7006で共有メモリロック待ちタスク
の待ちを解除し、アンロック処理を終了する。
Next, in step 7006, the shared memory lock waiting task is released from waiting, and the unlocking process is ended.

本実施例によれば、タスクは自らの論理アドレス空間上
に複数個の共有メモリを重ね合わせてアタッチすること
が可能となる。重なり合った共有メモリのいずれをアク
セスするかは共有メモリをロックする際に特定できるた
めに重ね合わせてアタッチしても処理に矛盾は生じない
。従って、タスクの論理アドレス空間が大きくなくても
多数の共有メモリを利用可能となる。
According to this embodiment, a task can attach a plurality of shared memories in a superimposed manner onto its own logical address space. Since which of the overlapping shared memories is to be accessed can be specified when the shared memories are locked, there will be no inconsistency in the processing even if the shared memories are attached overlappingly. Therefore, a large number of shared memories can be used even if the logical address space of a task is not large.

〔発明の効果〕〔Effect of the invention〕

本発明によれば、複数個の共有メモリを同−論理アドレ
ス上にアタッチ可能であるため、タスク毎の論理アドレ
ス空間の大きさが小さくても多数の共有メモリを使用す
ることが可能となる。
According to the present invention, since a plurality of shared memories can be attached to the same logical address, it is possible to use a large number of shared memories even if the size of the logical address space for each task is small.

また、同−論理アドレス上にアタッチしてアクセスを行
う際に、タスクが行う処理は、重ならないアドレスに共
有メモリをアタッチしてアクセスを行う場合と同−手j
@であり、タスクに特別な処理を行わせることなく同−
論理アドレスへの共有メモリアタッチ機能が実現できる
Furthermore, when accessing by attaching shared memory to the same logical address, the processing performed by a task is the same as when accessing by attaching shared memory to non-overlapping addresses.
@, and the same - without causing the task to perform any special processing.
A shared memory attach function to a logical address can be realized.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例のハードウェアのブロック図
、第2図は本発明の説明図、第3図はアドレス変換器の
説明図、第4図は論理−物理アドレス変換方法の説明図
、 1i145図はタスク制御ブロックの説明図、第6
図は共有メモリ管理テーブル(SMB )の説明図、縞
7図はアタッチ管理テーブル(ArB)の説明図、第8
図はデータ関連ブロック図、第9図はアタッチ処理のフ
ローチャート、第10図はロック処理のフローチャート
、第11図はアンロック処理のフローチャートである。 1 ・・・・・・・・・・・ CPU 2・・・・・・・・・・主メモリ 9・・・・・・・・・・・アドレス変換器20・・・・
・・・・・タスク制御ブロック(TCB )30・・・
・・・・・・共有メモリ管理テーブル(SMB )35
・・・・・・・・・アタッチ管理チーフル(ATB)η
δ図 凭4図 、5 402− 〒5図 CB ?n 閑6図 牙7図 犀8図
Fig. 1 is a block diagram of hardware according to an embodiment of the present invention, Fig. 2 is an explanatory diagram of the present invention, Fig. 3 is an explanatory diagram of an address converter, and Fig. 4 is an explanation of a logical-physical address conversion method. Figure 1i145 is an explanatory diagram of the task control block, No. 6
The figure is an explanatory diagram of the shared memory management table (SMB), the 7th stripe is an explanatory diagram of the attach management table (ArB), and the 8th
9 is a flowchart of attach processing, FIG. 10 is a flowchart of lock processing, and FIG. 11 is a flowchart of unlock processing. 1 ・・・・・・・・・・・・ CPU 2 ・・・・・・・ Main memory 9 ・・・・・・・・・ Address converter 20
...Task control block (TCB) 30...
...Shared memory management table (SMB) 35
・・・・・・・・・Attach management full (ATB) η
δ figure 4, 5 402- 〒5 figure CB? n Kankan 6 illustrations tusks 7 illustrations rhinoceros 8 illustrations

Claims (1)

【特許請求の範囲】 1、タスク毎に独自の論理アドレス空間を持たせてマル
チタスク処理を行うデータ処理装置において、 共有メモリの物理アドレス空間での位置及び状態を管理
する第一の制御テーブルと、 共有メモリとタスクの対応を管理する第二の制御テーブ
ルと、 前記第二の制御テーブルを用いて前記タスクと前記共有
メモリの対応付けを行う第一の手段と、 前記第一の制御テーブルおよび前記第二の制御テーブル
を用いて、前記タスクの前記共有メモリの排他アクセス
の開始を行うとともに、前記タスクの論理アドレス空間
のマッピングを変更して前記タスクによる前記共有メモ
リのアクセスを可能にする第二の手段と、 前記第一の制御テーブルおよび前記第二の制御テーブル
を用いて、前記タスクの前記共有メモリの排他アクセス
の終了を行うとともに、前記タスクの論理アドレス空間
のマッピングを変更して前記タスクによる前記共有メモ
リのアクセスを不可能にする第三の手段とを備えたこと
を特徴とする共有メモリ管理方式。 2、タスク毎に独自の論理アドレス空間を持たせてマル
チタスク処理を行うデータ処理装置において、 前記タスク間の共有メモリをアクセスする際には、前記
共有メモリのタスク論理アドレス空間での位置を決める
アタッチ手段と、前記共有メモリのアクセスの排他制御
を行うためのロック手段とアンロック手段とを用いてア
クセスを行い、アタッチ手段では前記タスクの論理−物
理アドレスマッピングの変更は行わず、ロック手段で前
記タスクの論理−物理アドレスマッピングの変更を行う
ことを特徴とする共有メモリ管理方式。 5、請求項1において、 前記第二の制御テーブルが、前記第一の制御テーブル及
び前記タスクの状態を管理するための第三の制御テーブ
ルの双方から各々独立した2通りのリスト構造によって
つながれる共有メモリ管理方式。
[Scope of Claims] 1. In a data processing device that performs multi-task processing by providing each task with its own logical address space, a first control table that manages the position and state of a shared memory in a physical address space; , a second control table for managing the correspondence between the shared memory and the task, a first means for associating the task and the shared memory using the second control table, the first control table, and A second control table that uses the second control table to initiate exclusive access of the task to the shared memory and to change the mapping of the logical address space of the task to enable the task to access the shared memory. (2) using the first control table and the second control table to terminate the exclusive access of the task to the shared memory and to change the mapping of the logical address space of the task; and third means for disabling access to the shared memory by a task. 2. In a data processing device that performs multitask processing by giving each task its own logical address space, when accessing shared memory between the tasks, the position of the shared memory in the task logical address space is determined. Access is performed using an attaching means, a locking means and an unlocking means for performing exclusive control of access to the shared memory, the attaching means does not change the logical-physical address mapping of the task, and the locking means does not change the logical-physical address mapping of the task. A shared memory management method characterized by changing the logical-physical address mapping of the task. 5. In claim 1, the second control table is connected by two independent list structures from both the first control table and a third control table for managing the state of the task. Shared memory management method.
JP1292310A 1989-11-13 1989-11-13 Shared memory management method Pending JPH03154945A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1292310A JPH03154945A (en) 1989-11-13 1989-11-13 Shared memory management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1292310A JPH03154945A (en) 1989-11-13 1989-11-13 Shared memory management method

Publications (1)

Publication Number Publication Date
JPH03154945A true JPH03154945A (en) 1991-07-02

Family

ID=17780115

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1292310A Pending JPH03154945A (en) 1989-11-13 1989-11-13 Shared memory management method

Country Status (1)

Country Link
JP (1) JPH03154945A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000347940A (en) * 1999-06-08 2000-12-15 Matsushita Electric Ind Co Ltd Memory management device
JP2009065713A (en) * 2008-12-08 2009-03-26 Ricoh Co Ltd Image forming apparatus, shared memory arbitrating method, program and recording medium
JP2014071855A (en) * 2012-10-02 2014-04-21 Fujitsu Semiconductor Ltd Access control circuit and access control method
US10936410B2 (en) 2015-05-26 2021-03-02 Semiconductor Energy Laboratory Co., Ltd. Memory system and information processing system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000347940A (en) * 1999-06-08 2000-12-15 Matsushita Electric Ind Co Ltd Memory management device
JP2009065713A (en) * 2008-12-08 2009-03-26 Ricoh Co Ltd Image forming apparatus, shared memory arbitrating method, program and recording medium
JP2014071855A (en) * 2012-10-02 2014-04-21 Fujitsu Semiconductor Ltd Access control circuit and access control method
US10936410B2 (en) 2015-05-26 2021-03-02 Semiconductor Energy Laboratory Co., Ltd. Memory system and information processing system

Similar Documents

Publication Publication Date Title
US4399504A (en) Method and means for the sharing of data resources in a multiprocessing, multiprogramming environment
US7962923B2 (en) System and method for generating a lock-free dual queue
US8316190B2 (en) Computer architecture and method of operation for multi-computer distributed processing having redundant array of independent systems with replicated memory and code striping
US6823511B1 (en) Reader-writer lock for multiprocessor systems
US4480304A (en) Method and means for the retention of locks across system, subsystem, and communication failures in a multiprocessing, multiprogramming, shared data environment
JP4586019B2 (en) Parallel recovery with non-failing nodes
US6560627B1 (en) Mutual exclusion at the record level with priority inheritance for embedded systems using one semaphore
US5727209A (en) Apparatus and method for achieving reduced overhead mutual-exclusion and maintaining coherency in a multiprocessor system utilizing execution history and thread monitoring
US6463532B1 (en) System and method for effectuating distributed consensus among members of a processor set in a multiprocessor computing system through the use of shared storage resources
US6862595B1 (en) Method and apparatus for implementing a shared message queue using a list structure
US20020087736A1 (en) Parallel dispatch wait signaling method, method for reducing contention of highly contended dispatcher lock, and related operating systems, multiprocessor computer systems and products
US20160085601A1 (en) Transparent user mode scheduling on traditional threading systems
US8978131B2 (en) Deterministic serialization of access to shared resources in a multi-processor system for code instructions accessing resources in a non-deterministic order
JPH01188965A (en) Data processing
JPH1165863A (en) Shared resource management method
JP2003186746A (en) Hardware execution control method of access to memory in computer using hardware execution semaphore and other similar hardware execution serializing and prioritizing mechanisms
JPH07191944A (en) System and method for prevention of deadlock in instruction to many resources by multiporcessor
CN111857993A (en) Method for calling user mode function in kernel mode
US5682507A (en) Plurality of servers having identical customer information control procedure functions using temporary storage file of a predetermined server for centrally storing temporary data records
US5790868A (en) Customer information control system and method with transaction serialization control functions in a loosely coupled parallel processing environment
US5495614A (en) Interface control process between using programs and shared hardware facilities
US5630133A (en) Customer information control system and method with API start and cancel transaction functions in a loosely coupled parallel processing environment
Tsigas et al. Non-blocking data sharing in multiprocessor real-time systems
Luchangco et al. On the uncontended complexity of consensus
JP2685530B2 (en) How to manage shared data