JP2011118756A - Exclusive control program, exclusive control method, and information processing system - Google Patents

Exclusive control program, exclusive control method, and information processing system Download PDF

Info

Publication number
JP2011118756A
JP2011118756A JP2009276694A JP2009276694A JP2011118756A JP 2011118756 A JP2011118756 A JP 2011118756A JP 2009276694 A JP2009276694 A JP 2009276694A JP 2009276694 A JP2009276694 A JP 2009276694A JP 2011118756 A JP2011118756 A JP 2011118756A
Authority
JP
Japan
Prior art keywords
exclusive control
thread
lock
user
space
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
JP2009276694A
Other languages
Japanese (ja)
Inventor
Takashi Horikawa
隆 堀川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP2009276694A priority Critical patent/JP2011118756A/en
Publication of JP2011118756A publication Critical patent/JP2011118756A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To allow more effective utilization of capability and performance of an information processing system. <P>SOLUTION: An information processing system 1 divides a memory 2 into a user space 10 and a kernel space 20 to manage them. Execution of a critical section in a user program 11 disposed in the user space 10 by one thread competes with another thread, a kernel program 21 uses a user space atomic access function 203 to atomically access a lock word (data for exclusive control) 100 disposed in the user space 10 and determines whether executing the critical section by the one thread is possible or not. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、排他制御プログラム、排他制御方法、及び情報処理システムに関し、特に複数のスレッドによるクリティカルパスの実行に際しての排他制御を行う技術に関する。   The present invention relates to an exclusive control program, an exclusive control method, and an information processing system, and particularly to a technique for performing exclusive control when a critical path is executed by a plurality of threads.

情報処理システムでは、プロセッサ等の計算機資源を効率良く利用するため、複数のプロセスやスレッドを並列に動作させることが一般的である。   In an information processing system, a plurality of processes and threads are generally operated in parallel in order to efficiently use computer resources such as a processor.

プロセスとスレッドは、プログラムを実行する実行単位を意味するという点で同様の概念である。しかしながら、通常、プロセスは他のプロセスから独立しており、プロセス毎のメモリ空間やファイルは別個のものである。一方、スレッドは、プロセスと異なり、メモリ空間やファイルを共有する。正確には、1つのプロセスに1つ若しくは複数のスレッドが存在しているというのが正確な表現である。   Processes and threads are similar concepts in that they mean execution units that execute programs. However, in general, a process is independent of other processes, and a memory space and a file for each process are separate. On the other hand, unlike processes, threads share memory space and files. To be precise, the accurate expression is that one or more threads exist in one process.

1つのプロセスに1つのスレッドしか存在しない構成がマルチプロセス・システムであり、1つのプロセスに複数のスレッドが存在する構成がマルチスレッド・システムである。すなわち、マルチスレッド・システムにおいては、1つのプロセスに属する複数のスレッドが同一のプログラムを実行する。   A multi-process system has a configuration in which only one thread exists in one process, and a multi-thread system has a configuration in which a plurality of threads exist in one process. That is, in a multi-thread system, a plurality of threads belonging to one process execute the same program.

なお、以降の説明においては、プログラムを実行する単位をスレッドと表記するが、異なるプログラムや異なるメモリ空間を意識する場合にはプロセスと表記する。   In the following description, a unit for executing a program is expressed as a thread. However, when a different program or a different memory space is considered, it is expressed as a process.

複数のスレッドを並列に動作させるように構成された情報処理システムでは、一のスレッドによる一の処理の実行中の任意の時点で、他のスレッドによる他の処理の実行が割り込むことがある。これらの処理同士間に関連性が無い場合は、一の処理途中に他の処理が割り込んでも得られる結果に変わりはなく、問題となることはない。   In an information processing system configured to operate a plurality of threads in parallel, execution of another process by another thread may interrupt at any time during the execution of one process by one thread. If there is no relationship between these processes, the result obtained even if another process interrupts during one process does not change and does not cause a problem.

しかしながら、処理同士間に関連性が有る場合には、一の処理途中に他の処理が割り込むと得られる結果が異なり、問題となることがある。   However, when there is a relationship between processes, if another process interrupts in the middle of one process, the result obtained is different, which may cause a problem.

例えば、2つのスレッドが、同一の変数に"1"を加える処理(すなわち、変数をメモリ等から読み出して"1"を加え、その結果をメモリ等に書き戻す処理)を並列に実行するとする。この例で問題となるのは、一方のスレッドが変数を読み出してから"1"を加えた結果を書き戻すまでの間に、他方のスレッドによる処理(変数に"1"を加える処理)が割り込んだ場合である。   For example, it is assumed that two threads execute a process of adding “1” to the same variable (that is, a process of reading a variable from a memory or the like, adding “1”, and writing the result back to the memory or the like) in parallel. The problem in this example is that the processing by the other thread (processing that adds “1” to the variable) is interrupted between when one thread reads the variable and writes back the result of adding “1”. This is the case.

割り込みが生じない場合、2つのスレッドが変数に"1"を加える操作を順に行ない、以て変数の値は"2"増加する。各スレッドが行う処理の内容を考慮すると、この処理結果は正しい。   When no interruption occurs, the two threads sequentially perform an operation of adding “1” to the variable, so that the value of the variable increases by “2”. This processing result is correct considering the contents of the processing performed by each thread.

一方、割り込みが生じた場合、一方のスレッドは、他方のスレッドによる変数の更新を感知すること無く、自身が読み出した値に"1"を加えた値を変数に書き戻すことになる。従って、2つのスレッドが変数に"1"を加える操作を行なったにも関わらず変数の値は"1"増加するだけであり、正しい処理結果は得られない。   On the other hand, when an interrupt occurs, one thread writes back a value obtained by adding “1” to the value read by itself without sensing the update of the variable by the other thread. Accordingly, although the two threads perform an operation of adding “1” to the variable, the value of the variable only increases by “1”, and a correct processing result cannot be obtained.

このように処理途中で他処理に割り込まれると問題が発生する処理区間(上記の例では、変数を読み出してから加算した結果を書き戻すまでの区間)をクリティカルセクションと呼び、他処理に割り込まれないための排他制御が明示的に行われることになっている。   In this way, the processing section that causes a problem when interrupted by other processing in the middle of processing (in the above example, the section from reading the variable to writing back the result of addition) is called the critical section and interrupted by other processing. The exclusive control is not performed explicitly.

プログラム実行を担うプロセッサが1個であれば、クリティカルセクションに入る時点で他処理への切り替えを禁止し、クリティカルセクションから出る時点で他処理への切り替えを許可することで、その期間中に他処理が割り込まないことを保証できる。プロセッサが1個の場合、或るプログラムをプロセスとして実行中に他プログラムの実行(他プロセス)が割り込むのは、最初のプロセス実行中にプロセス切り替えの契機となる何らかの事象が発生し、オペレーティング・システム(OS)がプロセス切り替えを行うためである。従って、オペレーティング・システムに対して他処理(他プロセス)への切り替えを禁止するように指示しておけば、プロセス切り替え禁止状態においてプロセス切り替えの契機となる何らかの事象が発生しても、その時点ではプロセス切り替えを行わず、最初のプロセスが他プロセスへの切り替えを許可した時点でプロセス切り替えを行うように制御できる。   If one processor is responsible for program execution, switching to other processing is prohibited when entering the critical section, and switching to other processing is permitted when exiting the critical section. Can be guaranteed not to interrupt. When there is one processor, the execution of another program (another process) interrupts while executing a certain program as a process because an event that triggers process switching occurs during the first process execution, and the operating system This is because (OS) performs process switching. Therefore, if you instruct the operating system to prohibit switching to another process (other process), even if some event that triggers process switching occurs in the process switching prohibited state, at that time It is possible to control to perform process switching when the first process permits switching to another process without performing process switching.

一方、マルチプロセッサ・システムでは、他プロセスへの切り替え禁止だけでは正しい処理結果を保証できない。他プロセスへの切り換え禁止は、そのプログラムを実行している(当該他プロセスを動作させている)プロセッサに対しては有効であるが、他プロセッサによるプログラム実行には影響を与えないからである。   On the other hand, in a multiprocessor system, a correct processing result cannot be guaranteed only by prohibiting switching to another process. This is because prohibition of switching to another process is effective for a processor executing the program (operating the other process), but does not affect program execution by the other processor.

他プロセッサによるプログラム実行がクリティカルセクションに入らないようにするための排他制御として一般的に行われているのは、クリティカルセクションを実行中のプロセスが存在するか否かを示すフラグ(以下、lock word)を用いる、という対処である。なお、以降の説明おいては、クリティカルセクションの実行権(クリティカルセクションへの進入権)を、「ロック(lock)」と呼称することがある。   Generally, an exclusive control for preventing program execution by another processor from entering a critical section is a flag indicating whether or not there is a process executing the critical section (hereinafter, lock word). ) Is used. In the following description, the right to execute a critical section (right to enter a critical section) may be referred to as “lock”.

具体的には、各プロセスは、クリティカルセクションに入る時点でlock wordを確認し、下記(1)又は(2)に示す処理を実行する。
(1)lock wordが「未使用を示す値(以下、unlocked)」であれば、lock wordを「使用中を示す値(以下、locked)」に変更してクリティカルセクションを実行する。また、クリティカルセクションの実行を終了した時点でlock wordをunlockedに戻す。
(2)lock wordがlockedであれば、lock wordがunlockedになるまで待機した後、上記(1)の処理を実行する。
Specifically, each process confirms the lock word when entering the critical section, and executes the processing shown in (1) or (2) below.
(1) If the lock word is “value indicating unused (hereinafter, unlocked)”, the lock word is changed to “value indicating busy (hereinafter, locked)” and the critical section is executed. Also, when the execution of the critical section is finished, the lock word is returned to unlocked.
(2) If the lock word is locked, the process of (1) is executed after waiting until the lock word becomes unlocked.

以上の制御を行うことにより、他プロセッサが実行する処理と自プロセッサが実行する処理がクリティカルセクション上で競合するという問題は発生しない。   By performing the above control, the problem that the process executed by the other processor and the process executed by the own processor compete on the critical section does not occur.

クリティカルセクションには、1つのスレッドのみが実行可能なものの他、実行可能なスレッド数に上限があるもの(複数のスレッドにロックを与えるもの)がある。また、クリティカルセクションには、write lock(書込や更新等の処理に係るロック)とread lock(読出や参照等の処理に係るロック)という2種類のロックを与えるread−write lockが適用されることもある。write lockを獲得してクリティカルセクションを実行できるスレッド数は、"1"に制限されている。一方、read lockを獲得可能なスレッド数には上限が無く、read lockを獲得したスレッドは、write lockを獲得して処理を進めているスレッドが存在しない場合に限り、クリティカルセクションを実行できる。   Some critical sections can be executed by only one thread, and others have an upper limit on the number of executable threads (those that give a lock to a plurality of threads). In addition, a read-write lock that gives two types of locks, write lock (lock related to processing such as writing and updating) and read lock (lock related to processing such as reading and reference) is applied to the critical section. Sometimes. The number of threads that can acquire a write lock and execute a critical section is limited to “1”. On the other hand, there is no upper limit to the number of threads that can acquire a read lock, and a thread that has acquired a read lock can execute a critical section only when there is no thread that has acquired a write lock and is processing.

次に、スレッドによるクリティカルパスの実行に際しての一般的な排他制御について詳細に説明する。   Next, general exclusive control when a critical path is executed by a thread will be described in detail.

或るスレッドがクリティカルセクションに入る時点でlock wordがlockedであり、クリティカルセクションの実行を直ちに開始することができない場合、そのスレッドはlock wordがunlockedになるまで待機する。   If a lock word is locked when a thread enters the critical section and the execution of the critical section cannot be started immediately, the thread waits until the lock word becomes unlocked.

この方式には、下記(1)及び(2)に示す2種類の方式がある。
(1)lock wordがunlockedに変更されるまで、スレッドがプロセッサ資源を利用してlock wordをチェックし続けるspin loop方式。
(2)スレッドが、プロセッサ資源の利用を中断して休眠状態へ移行すると共に、クリティカルセクションを実行している他のスレッドに対して、クリティカルセクションの実行を完了した時点で起床処理を行うように依頼するblock方式(例えば、特許文献1参照)。
There are two types of methods shown in (1) and (2) below.
(1) A spin loop method in which a thread keeps checking a lock word using a processor resource until the lock word is changed to unlocked.
(2) The thread suspends the use of processor resources and shifts to the sleep state, and wakes up when another thread executing the critical section completes the execution of the critical section. Block system to request (for example, see Patent Document 1).

また、spin loop方式とblock方式とを組み合わせた方式(すなわち、最初はspin loop方式に則して待機し、一定の時間が経過するとblock方式に則して待機する方式)が採用されることも多い。   Also, a method that combines the spin loop method and the block method (that is, a method that initially waits in accordance with the spin loop method and waits in accordance with the block method after a certain period of time) may be adopted. Many.

なお、block方式を採用する場合には、クリティカルセクションの状態を管理する変数として、lock wordに加えて、待機中のスレッドが存在するか否かを示すフラグが併用されることになる。   When the block method is adopted, a flag indicating whether or not there is a waiting thread is used in addition to the lock word as a variable for managing the state of the critical section.

何れの方式を採用するにしても、スレッドは、ロック獲得を待機する間、本来の処理を実行できない。これは、情報処理システムが持つ能力や性能の有効活用を阻害する要因となる。特に、近年のマルチコア・プロセッサの普及に伴って一般化している多数のプロセッサを搭載した情報処理システムでは、このロック獲得待ちが性能ボトルネックとなる状況が多くなっており、ロック獲得待ちを効率的に行うための方法が求められている。   Whichever method is adopted, the thread cannot execute the original process while waiting for the lock acquisition. This becomes a factor that hinders effective use of the capability and performance of the information processing system. In particular, in information processing systems equipped with a large number of processors that have become common with the recent spread of multi-core processors, there is an increasing number of situations where this lock acquisition wait becomes a performance bottleneck. There is a need for a way to do this.

ところで、スレッドがクリティカルセクションに入る時点で行うlock wordの確認(読出)と、lock wordがunlockedだった場合のlockedへの変更(書込)の2操作には、クリティカルセクションと同様の扱いが必要となる。このため、マルチプロセッサ向けの機能を有するプロセッサには、これらの操作を行うための命令が用意されている。   By the way, two operations, confirmation (reading) of the lock word that is performed when a thread enters the critical section, and change to locked (writing) when the lock word is unlocked require the same treatment as the critical section. It becomes. For this reason, instructions for performing these operations are prepared in a processor having a function for a multiprocessor.

例えば、インテルのx86プロセッサには、cmpxchg命令が用意されている(非特許文献1参照)。   For example, a cmpxchg instruction is prepared for an Intel x86 processor (see Non-Patent Document 1).

このcmpxchg命令は、予約されたレジスタ(eaxレジスタ)と、レジスタ・オペランドと、メモリ・オペランドの3オペランドを使用し、下記(1)、(2−1)、及び(2−2)に示す一連の操作をアトミックに行うものである。
(1)メモリからプロセッサに、メモリ・オペランドが示すアドレスに対応する値を読み出す。
(2−1)上記(1)での読出値がeaxレジスタの値と一致する場合、メモリにレジスタ・オペランドの値を書き込む。
(2−2)上記(1)での読出値がeaxレジスタの値と一致しない場合、当該読出値をeaxレジスタに書き込む。
This cmpxchg instruction uses a reserved register (eax register), a register operand, and a memory operand, and the following series (1), (2-1), and (2-2): Is performed atomically.
(1) A value corresponding to the address indicated by the memory operand is read from the memory to the processor.
(2-1) When the read value in the above (1) matches the value of the eax register, the value of the register operand is written in the memory.
(2-2) If the read value in (1) above does not match the value in the eax register, the read value is written into the eax register.

なお、アトミックとは、上記(1)のメモリ読出操作と上記(2−1)のメモリ書込操作の間に、他のプロセッサがメモリにアクセスしないことをハードウェア動作によって保証することを意味する。また、cmpxchg命令のような命令は、一般にCAS(Compare And Swap)命令と呼称される。本願明細書では、CAS命令による一連の操作を「アトミック・アクセス」と表記する。   Note that atomic means that a hardware operation guarantees that no other processor accesses the memory between the memory read operation (1) and the memory write operation (2-1). . An instruction such as the cmpxchg instruction is generally called a CAS (Compare And Swap) instruction. In the present specification, a series of operations by the CAS instruction is referred to as “atomic access”.

上記のCAS命令を用いてロック獲得を行うには、eaxレジスタにunlocked、レジスタ・オペランドにlockedを設定すると共に、メモリ・オペランドにlock wordのアドレスを設定してCAS命令を実行する。lock wordがunlockedである場合は、上記(2−1)が実行されるので、lock wordはlockedに書き換えられ、eaxレジスタの値は変化しない。   In order to acquire a lock using the above CAS instruction, the CAS instruction is executed by setting unlocked in the eax register, setting locked in the register operand, and setting the address of the lock word in the memory operand. When the lock word is unlocked, the above (2-1) is executed, so that the lock word is rewritten to locked and the value of the eax register does not change.

一方、lock wordがlockedである場合には、上記(2−2)が実行されるので、lock wordは更新されず、eaxレジスタにはlockedが設定される。CAS命令を実行したスレッドは、CAS命令実行後のeaxレジスタの値を調べることで、ロック獲得が成功したか否かを調べることができる(すなわち、クリティカルセクションを実行するか、或いは他のスレッドによりlock wordがunlockedに変更されるのを待機するかを判断できる)。   On the other hand, when the lock word is locked, the above (2-2) is executed, so that the lock word is not updated and “locked” is set in the eax register. The thread that has executed the CAS instruction can check whether the lock acquisition has succeeded by checking the value of the eax register after the CAS instruction is executed (that is, the critical section is executed, or by another thread). It can be determined whether to wait for the lock word to be changed to unlocked).

また、他の関連技術としては、メモリをユーザ空間とカーネル空間とに分けて管理するメモリ管理技術がある(例えば、非特許文献2参照)。   As another related technique, there is a memory management technique for managing a memory by dividing it into a user space and a kernel space (for example, see Non-Patent Document 2).

この内、ユーザ空間は、アプリケーション等のユーザ・プログラムが動作するために必要な情報(命令、データ等)を配置するメモリ領域であり、各プロセスに対して独立した領域が用意されている。このユーザ空間は、通常、ページングの対象となっており、メモリ容量が逼迫してくると二時記憶装置に退避されることがある。このため、ユーザ空間に配置された情報は、実メモリ上に存在していない場合がある。   Among these, the user space is a memory area in which information (instructions, data, etc.) necessary for the operation of a user program such as an application is arranged, and an independent area is prepared for each process. This user space is usually a target of paging, and when the memory capacity becomes tight, the user space may be saved in the binary storage device. For this reason, information arranged in the user space may not exist on the real memory.

一方、カーネル空間は、物理デバイスへのアクセスやシステム管理を行うカーネル(OS)が動作するために必要な情報を配置するメモリ領域であり、全プロセスに共通した空間となっている。   On the other hand, the kernel space is a memory area in which information necessary for operating a kernel (OS) that performs access to a physical device and system management operates, and is a space common to all processes.

ユーザ・プログラムを実行するユーザモードでは、プロセスは、ユーザ空間に配置されるデータ(以下、ユーザ・データ)にアクセスできるが、カーネル空間に配置されるデータ(以下、カーネル・データ)へはアクセスできない。一方、カーネル空間に配置されるプログラム(以下、カーネル・プログラム)を実行するカーネルモードでは、プロセスは、カーネル空間に配置されたカーネル・データ、及び当該プロセスに属するユーザ空間に配置されたユーザ・データの両者にアクセスできる。   In the user mode for executing a user program, a process can access data arranged in the user space (hereinafter referred to as user data) but cannot access data arranged in the kernel space (hereinafter referred to as kernel data). . On the other hand, in the kernel mode for executing a program (hereinafter referred to as a kernel program) arranged in the kernel space, the process includes kernel data arranged in the kernel space and user data arranged in the user space belonging to the process. You can access both.

また、カーネル空間からユーザ・データにアクセスする際は、アクセス対象の情報が実メモリ上に存在しないケースが有り得るので、その状況でもシステムを正しく動作させる必要がある。このため、カーネル機能として用意されるユーザ空間読出機能及びユーザ空間書込機能を用いて、ユーザ空間とカーネル空間の間で情報のコピーを行うようになっている。カーネルは、ユーザ・データを加工する場合、ユーザ・データをユーザ空間読出機能によりカーネル空間にコピーしてから加工し、その結果をユーザ空間書込機能によりユーザ空間へ書き戻す。   In addition, when accessing user data from the kernel space, there may be a case where the information to be accessed does not exist in the real memory. Therefore, it is necessary to operate the system correctly even in such a situation. For this reason, information is copied between the user space and the kernel space using a user space read function and a user space write function prepared as kernel functions. When the user data is processed, the kernel copies the user data to the kernel space by the user space read function and writes the result back to the user space by the user space write function.

また、上記のlock wordは一般にユーザ空間に配置され、ロック獲得操作はユーザ・プログラムにおいて実施される。   In addition, the above lock word is generally arranged in the user space, and the lock acquisition operation is performed in the user program.

特開平10−161892号公報Japanese Patent Laid-Open No. 10-161892

Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2A: Instruction Set Reference, A-M, http://www.intel.com/Assets/PDF/manual/253666.pdfIntel 64 and IA-32 Architectures Software Developer's Manual Volume 2A: Instruction Set Reference, A-M, http://www.intell.com/Asset.com/Asset. Maurice J. Bach, THE DESIGN OF THE UNIX OPERATING SYSTEM, PRENTICE−HALL, INC., Englewood Cliffs, New Jersey 07632, 1986Maurice J. Bach, THE DESIGN OF THE UNIX OPERATING SYSTEM, PENTICE-HALL, INC. , Englewood Cliffs, New Jersey 07632, 1986

しかしながら、上述した従来の排他制御には、情報処理システムが持つ能力や性能を十分に活用できないという課題があった。これは、スレッドがロック競合に起因して休眠処理を依頼するためにカーネル・プログラムを呼び出してから、カーネル・プログラムが休眠処理を行ってスレッドを休眠状態へ移行するまでの間にロックが解放された場合であっても、スレッドが直ちにはロックを獲得できない(休眠状態からの復帰後でなければロック獲得操作を実行できない)ためである。   However, the above-described conventional exclusive control has a problem that the ability and performance of the information processing system cannot be fully utilized. This is because the lock is released after the thread calls the kernel program to request sleep processing due to lock contention and before the kernel program performs sleep processing and transitions the thread to the sleep state. This is because the thread cannot acquire the lock immediately even if it has occurred (the lock acquisition operation cannot be executed unless after returning from the sleep state).

従って、本発明の目的は、情報処理システムが持つ能力や性能をより有効に活用可能とすることにある。   Therefore, an object of the present invention is to make it possible to more effectively utilize the capability and performance of an information processing system.

上記の目的を達成するため、本発明の一態様に係る排他制御プログラムは、メモリをユーザ空間とカーネル空間とに分けて管理する情報処理システムに、排他制御を行わせる。この排他制御プログラムは、前記カーネル空間で実行され、前記排他制御は、一の実行単位による前記ユーザ空間に配置されたユーザ・プログラム中のクリティカルセッションの実行が他の実行単位と競合した場合、前記ユーザ空間に配置される前記競合を管理するためのデータに対してアトミックにアクセスし、前記一の実行単位による前記クリティカルセクションの実行可否を判定することを含む。   In order to achieve the above object, an exclusive control program according to an aspect of the present invention causes an information processing system that manages a memory separately into a user space and a kernel space to perform exclusive control. The exclusive control program is executed in the kernel space, and the exclusive control is performed when the execution of a critical session in the user program arranged in the user space by one execution unit competes with another execution unit. Atomically accessing the data for managing the contention arranged in the user space, and determining whether the critical section can be executed by the one execution unit.

また、本発明の一態様に係る排他制御方法は、メモリをユーザ空間とカーネル空間とに分けて管理する情報処理システムにおける排他制御方法を提供する。この排他制御方法は、一の実行単位による前記ユーザ空間に配置されたユーザ・プログラム中のクリティカルセッションの実行が他の実行単位と競合した場合、前記カーネル空間から、前記ユーザ空間に配置される前記競合を管理するためのデータに対してアトミックにアクセスし、前記一の実行単位による前記クリティカルセクションの実行可否を判定する。   An exclusive control method according to an aspect of the present invention provides an exclusive control method in an information processing system that manages a memory separately in a user space and a kernel space. In the exclusive control method, when execution of a critical session in a user program arranged in the user space by one execution unit competes with another execution unit, the exclusive space is arranged from the kernel space to the user space. Atomic access is made to data for managing conflicts, and it is determined whether or not the critical section can be executed by the one execution unit.

さらに、本発明の一態様に係る情報処理システムは、メモリをユーザ空間とカーネル空間とに分けて管理すると共に、上記の排他制御プログラムを前記カーネル空間で実行する。   Furthermore, an information processing system according to an aspect of the present invention manages a memory separately in a user space and a kernel space, and executes the exclusive control program in the kernel space.

本発明では、カーネル空間からロック獲得操作を実施する。このため、スレッドがロック競合に起因して休眠処理を要求してから休眠状態へ移行するまでの間にロックが解放された場合、スレッドは、休眠すること無く即座にロックを獲得することが可能となる。従って、スレッドは本来の処理を継続して実行でき、以て情報処理システムが持つ能力や性能をより有効に活用することが可能である。   In the present invention, a lock acquisition operation is performed from the kernel space. For this reason, if the lock is released between the time when the thread requests sleep processing due to lock contention and the transition to sleep mode, the thread can immediately acquire the lock without sleeping. It becomes. Therefore, the thread can continuously execute the original process, and thus the ability and performance of the information processing system can be utilized more effectively.

本発明の実施の形態に係る情報処理システムの構成例を示したブロック図である。It is the block diagram which showed the structural example of the information processing system which concerns on embodiment of this invention. 本発明の実施の形態に係る排他制御プログラムの概略的な動作例を示した図である。It is the figure which showed the schematic operation example of the exclusive control program which concerns on embodiment of this invention. 本発明の実施の形態に係る排他制御プログラムが有する、ユーザ空間読出機能、ユーザ空間書込機能、及びユーザ空間アトミック・アクセス機能の動作例を示したフローチャート図である。It is the flowchart figure which showed the operation example of the user space read function, the user space write function, and the user space atomic access function which the exclusive control program which concerns on embodiment of this invention has. 本発明の実施の形態に係る情報処理システムの全体動作例を示したフローチャート図である。It is the flowchart figure which showed the example of whole operation | movement of the information processing system which concerns on embodiment of this invention. 本発明の実施の形態に係る情報処理システムに用いるlock wordの構成例を示した図である。It is the figure which showed the structural example of lock word used for the information processing system which concerns on embodiment of this invention. 本発明の実施の形態に係る情報処理システムにおける通常ロック獲得操作の一例を示したフローチャート図である。It is the flowchart figure which showed an example of normal lock acquisition operation in the information processing system which concerns on embodiment of this invention. 本発明の実施の形態に係る情報処理システムにおけるシステム・コール前処理の一例を示したフローチャート図である。It is the flowchart figure which showed an example of the system call pre-processing in the information processing system which concerns on embodiment of this invention. 本発明の実施の形態に係る情報処理システムにおける、ユーザ空間アトミック・アクセス機能を用いたロック獲得操作の一例を示したフローチャート図である。It is the flowchart figure which showed an example of the lock acquisition operation using the user space atomic access function in the information processing system which concerns on embodiment of this invention. 本発明の実施の形態に係る情報処理システムにおけるロック解放処理の一例を示したフローチャート図である。It is the flowchart figure which showed an example of the lock release process in the information processing system which concerns on embodiment of this invention. 本発明の実施の形態に係る情報処理システムにおける休眠後処理の一例を示したフローチャート図である。It is the flowchart figure which showed an example of the process after a sleep in the information processing system which concerns on embodiment of this invention.

以下、本発明に係る排他制御プログラム及びこれを実行する情報処理システムの実施の形態を、図1〜図10を参照して説明する。なお、各図面において、同一要素には同一の符号が付されており、説明の明確化のため、必要に応じて重複説明は省略される。   Hereinafter, an exclusive control program according to the present invention and an information processing system that executes the exclusive control program will be described with reference to FIGS. In the drawings, the same components are denoted by the same reference numerals, and redundant description is omitted as necessary for the sake of clarity.

図1に示す本実施の形態に係る情報処理システム1は、メモリ2と、複数のプロセッサ(中央処理装置)3_1〜3_nとで構成されている。メモリ2内には、ユーザ空間10とカーネル空間20とが形成される。   An information processing system 1 according to the present embodiment shown in FIG. 1 includes a memory 2 and a plurality of processors (central processing units) 3_1 to 3_n. A user space 10 and a kernel space 20 are formed in the memory 2.

ユーザ空間10には、ユーザ・プログラム11と、ユーザ・データ12とが配置される。また、ユーザ・データ12は、排他制御用のデータであるlock word 100を含む。   A user program 11 and user data 12 are arranged in the user space 10. The user data 12 includes a lock word 100 that is data for exclusive control.

一方、カーネル空間20には、カーネル・プログラム21と、カーネル・データ22とが配置される。また、カーネル・プログラム21は、上述したユーザ空間読出機能201及びユーザ空間書込機能202に加えて、ユーザ空間アトミック・アクセス機能203を含む。ここで、ユーザ空間アトミック・アクセス機能203は、後述する如く、lock word100に対してアトミックにアクセスする。また、カーネル・プログラム21は、ユーザ空間アトミック・アクセス機能203を用いて、カーネル空間20からロック獲得操作を実行する。   On the other hand, a kernel program 21 and kernel data 22 are arranged in the kernel space 20. The kernel program 21 includes a user space atomic access function 203 in addition to the user space read function 201 and the user space write function 202 described above. Here, the user space atomic access function 203 atomically accesses the lock word 100 as will be described later. The kernel program 21 executes a lock acquisition operation from the kernel space 20 by using the user space atomic access function 203.

また、各プロセッサ3_1〜3_nは、1つ以上のスレッド(図示せず)を生成する。各スレッドは、ユーザ・プログラム11又はカーネル・プログラム21から実行すべき機械語命令を読み出し、その機械語命令で規定される処理を実行する。この際、各スレッドは、必要に応じてユーザ・データ12又はカーネル・データ22を使用する。   Each processor 3_1 to 3_n generates one or more threads (not shown). Each thread reads a machine language instruction to be executed from the user program 11 or the kernel program 21, and executes a process defined by the machine language instruction. At this time, each thread uses the user data 12 or the kernel data 22 as necessary.

なお、ユーザ・プログラム11からユーザ・データ12に対するアクセス、及びカーネル・プログラム21からカーネル・データ22に対するアクセスには、一般的な情報処理システムと同様に制限は無い。すなわち、各プロセッサ3_1〜3_nは、特別な機能を使用すること無く、機械語命令の実行により読出、書込、アトミック・アクセスを行うことができる。   The access from the user program 11 to the user data 12 and the access from the kernel program 21 to the kernel data 22 are not limited as in a general information processing system. That is, each of the processors 3_1 to 3_n can perform reading, writing, and atomic access by executing a machine language instruction without using a special function.

ユーザ・プログラム11及びカーネル・プログラム21は、概略、図2に示す如く動作する。   The user program 11 and the kernel program 21 generally operate as shown in FIG.

図2に示すように、ユーザ・プログラム11は、カーネル・プログラム21の機能を使用する場合、システム・コールを行ってカーネルモードに遷移し、以てカーネル・プログラム21による処理を実行させる。カーネル・プログラム21による処理が完了した場合、カーネル・プログラム21は、ユーザ・プログラム11にリターンしてユーザモードに復帰し、以てユーザ・プログラム11による処理を続行させる。カーネル・プログラム21は、ユーザ・データ12を使用する場合、アクセスの種類に応じて、ユーザ空間読出機能201、ユーザ空間書込機能202、又はユーザ空間アトミック・アクセス機能203を用いる。   As shown in FIG. 2, when using the function of the kernel program 21, the user program 11 makes a system call to shift to the kernel mode, and causes the kernel program 21 to execute processing. When the process by the kernel program 21 is completed, the kernel program 21 returns to the user program 11 and returns to the user mode, and thus the process by the user program 11 is continued. When using the user data 12, the kernel program 21 uses the user space read function 201, the user space write function 202, or the user space atomic access function 203 depending on the type of access.

これらの機能201〜203は、概略、図3に示す如く動作する。   These functions 201 to 203 generally operate as shown in FIG.

図3に示すように、各機能201〜203は、まず、アクセス対象領域がメモリ2中に存在するかどうかを調べる(ステップS1)。この結果、アクセス対象領域がメモリ2中に存在すると判定した場合、各機能201〜203は、自機能に予め定められたアクセス処理を実行する(ステップS2)。すなわち、ユーザ空間読出機能201は、ユーザ・データ12に対する読出アクセスを行い、ユーザ空間書込機能202は、ユーザ・データ12に対する書込アクセスを行い、ユーザ空間アトミック・アクセス機能203は、lock word100に対するアトミック・アクセスを行う。   As shown in FIG. 3, each of the functions 201 to 203 first checks whether an access target area exists in the memory 2 (step S1). As a result, when it is determined that the access target area exists in the memory 2, each of the functions 201 to 203 executes an access process predetermined for the function (step S2). That is, the user space read function 201 performs read access to the user data 12, the user space write function 202 performs write access to the user data 12, and the user space atomic access function 203 performs the lock access to the lock word 100. Perform atomic access.

一方、上記のステップS1でアクセス対象領域がメモリ2中に存在しないと判定した場合、各機能201〜203は、ページフォルト処理を実行し、以て2次記憶装置(図示せず)に退避されているメモリ領域を実メモリに戻す(ステップS3)。ページフォルト処理が成功した場合(ステップS4)、各機能201〜203は、上記のステップS2に進み、所定のアクセス処理を実行する。なお、ページフォルト処理が成功しなかった場合には、各機能201〜203は、ユーザ空間へのアクセス処理に失敗したものとして異常終了する。   On the other hand, if it is determined in step S1 that the access target area does not exist in the memory 2, each function 201 to 203 executes a page fault process and is saved in a secondary storage device (not shown). The memory area being returned is returned to the real memory (step S3). When the page fault process is successful (step S4), each of the functions 201 to 203 proceeds to the above step S2 and executes a predetermined access process. If the page fault process is not successful, the functions 201 to 203 end abnormally assuming that the access process to the user space has failed.

次に、本実施の形態の具体的な動作例を、図4〜図10を参照して詳細に説明する。   Next, a specific operation example of the present embodiment will be described in detail with reference to FIGS.

情報処理システム1で動作するスレッドは、ユーザ・プログラム11中のクリティカルセクションの実行に先立って、図4に示すロック獲得処理を実行する。具体的には、スレッドは、まず、ロック獲得失敗に備えて、リトライ回数300を"0"に初期化する(ステップS11)。   Prior to the execution of the critical section in the user program 11, the thread operating in the information processing system 1 executes the lock acquisition process shown in FIG. Specifically, the thread first initializes the number of retries 300 to “0” in preparation for a lock acquisition failure (step S11).

そして、スレッドは、ユーザモードでの通常のロック獲得操作を実行する(ステップS12)。具体的には、スレッドは、例えば図5に示す如く構成されたlock word100に対して、図6に示す処理を実行する。ここで、lock word100は、1ビットのlock bit101と、10ビットのblocked thread数102とを含む。このlock word100は、CAS命令で扱うことが可能なデータ長を有する。また、lock bit101="0"は、unlockedを意味し、lock bit101="1"は、lockedを意味する。さらに、blocked thread数102には、ロック競合により休眠状態へ移行するスレッドの数が計数される。   Then, the thread executes a normal lock acquisition operation in the user mode (step S12). Specifically, for example, the thread executes the process shown in FIG. 6 on the lock word 100 configured as shown in FIG. Here, the lock word 100 includes a 1-bit lock bit 101 and a 10-bit blocked thread number 102. The lock word 100 has a data length that can be handled by a CAS instruction. Further, lock bit 101 = “0” means unlocked, and lock bit 101 = “1” means locked. Further, the number of threads that enter the sleep state due to lock contention is counted as the number of blocked threads 102.

図6に示すように、スレッドは、まず、lock word100と同一のデータ長及びデータ構造を持つ作業用変数oldに、lock word100を代入する(ステップS31)。そして、スレッドは、変数oldのlock bitが"0"であるか否かを判定する(ステップS32)。   As shown in FIG. 6, the thread first assigns the lock word 100 to the work variable old having the same data length and data structure as the lock word 100 (step S31). Then, the thread determines whether or not the lock bit of the variable old is “0” (step S32).

この結果、lock bit="0"が成立する場合、スレッドは、lock word100と同一のデータ長及びデータ構造を持つ作業用変数newに変数oldをコピーした後(ステップS33)、変数newのlock bitを"1"に設定する(ステップS34)。   As a result, when lock bit = “0” is satisfied, the thread copies the variable old to the work variable new having the same data length and data structure as the lock word 100 (step S33), and then lock bit of the variable new. Is set to "1" (step S34).

そして、スレッドは、eaxレジスタに変数old、レジスタ・オペランドに変数new、メモリ・オペランドにlock word100のアドレスを設定して、CAS命令を実行する(ステップS35)。CAS命令が成功した場合(ステップS36)、lock word100のlock bit101に"1(locked)"が設定されるため、スレッドは、ロック獲得に成功したとして処理を終了する。CAS命令が失敗した場合(すなわち、上記のステップS32〜34を実行する間に他のスレッドによりlock word100が変更されていた場合)には、スレッドは、上記のステップS32に戻って、ロック獲得操作を再び実行する。なお、この時、変数oldには、最新のlock word100が代入されることろなる。   Then, the thread sets the variable old in the eax register, the variable new in the register operand, and the address of the lock word 100 in the memory operand, and executes the CAS instruction (step S35). When the CAS instruction is successful (step S36), since “1 (locked)” is set in the lock bit 101 of the lock word 100, the thread finishes the process on the assumption that the lock has been successfully acquired. If the CAS instruction has failed (that is, if lock word 100 has been changed by another thread while executing steps S32 to S34 above), the thread returns to step S32 above to acquire the lock operation. Run again. At this time, the latest lock word 100 is substituted for the variable old.

一方、上記のステップS32でlock bit="1"が成立した場合、スレッドは、ロック獲得に失敗したとして処理を終了する。   On the other hand, when lock bit = “1” is established in the above step S32, the thread finishes the process on the assumption that the lock acquisition has failed.

図4に戻って、上記の通常ロック獲得操作に成功した場合(ステップS13)、スレッドは、ロック獲得処理を終了し、クリティカルセクションを実行する。   Returning to FIG. 4, when the above-described normal lock acquisition operation is successful (step S13), the thread ends the lock acquisition process and executes the critical section.

一方、上記の通常ロック獲得操作に失敗した場合には、スレッドは、予め定められた閾値に達するまでリトライ回数300をインクリメントしながら(ステップS14及びS15)、上記の通常ロック獲得操作を繰り返し実行する。リトライ回数300が閾値に達した場合、スレッドは、休眠状態へ移行するためのシステム・コール(以下、休眠用システム・コールと呼称する)の起動が必要であると判断する。   On the other hand, when the normal lock acquisition operation fails, the thread repeatedly executes the normal lock acquisition operation while incrementing the number of retries 300 until reaching a predetermined threshold (steps S14 and S15). . When the number of retries 300 reaches the threshold value, the thread determines that it is necessary to activate a system call for shifting to the sleep state (hereinafter referred to as a sleep system call).

そして、スレッドは、休眠用システム・コールの起動に先立って、図7に示す前処理を実行し(ステップS16)、以てlock word100のblocked thread数102をインクリメントする。具体的には、スレッドは、まず、変数oldにlock word100を代入する(ステップS41)。そして、スレッドは、変数newに変数oldをコピーした後(ステップS42)、変数newのblocked thread数を"1"だけインクリメントする(ステップS43)。そして、スレッドは、上記のステップS35と同様にして、CAS命令を実行する(ステップS44)。CAS命令が成功した場合(ステップS45)、lock word100のblocked thread数102が"1"だけインクリメントされるため、スレッドは、休眠用システム・コールを起動する(図4のステップS17)。一方、CAS命令が失敗した場合には、スレッドは、上記のステップS42に戻って、blocked thread数102のインクリメントを再試行する。   Then, prior to the activation of the sleep system call, the thread executes the preprocessing shown in FIG. 7 (step S16), and thereby increments the number of blocked threads 102 of the lock word 100. Specifically, the thread first assigns the lock word 100 to the variable old (step S41). Then, after copying the variable old to the variable new (step S42), the thread increments the number of blocked threads of the variable new by “1” (step S43). Then, the thread executes the CAS instruction in the same manner as in the above step S35 (step S44). When the CAS instruction is successful (step S45), the number of blocked threads 102 of the lock word 100 is incremented by “1”, so that the thread activates a sleep system call (step S17 in FIG. 4). On the other hand, if the CAS instruction has failed, the thread returns to step S42 to retry incrementing the blocked thread number 102.

図4に戻って、休眠用システム・コールを起動すると、スレッドは、カーネルモードに遷移し、ユーザ空間アトミック・アクセス機能203を用いたロック獲得操作を実行する(ステップS18)。   Returning to FIG. 4, when the sleep system call is activated, the thread transitions to the kernel mode and executes a lock acquisition operation using the user space atomic access function 203 (step S <b> 18).

具体的には、図8に示すように、スレッドは、まず、変数oldにlock word100を代入する(ステップS51)。そして、スレッドは、変数oldのlock bitが"0"であるか否かを判定する(ステップS52)。   Specifically, as shown in FIG. 8, the thread first assigns lock word 100 to the variable old (step S51). Then, the thread determines whether or not the lock bit of the variable old is “0” (step S52).

この結果、lock bit="0"が成立する場合、スレッドは、変数newに変数oldをコピーした後(ステップS53)、変数newのlock bitを"1"に設定し(ステップS54)、変数newのblocked thread数を"1"だけデクリメントする(ステップS55)。そして、スレッドは、上記のステップS35と同様にして、CAS命令を実行する(ステップS56)。CAS命令が成功した場合(ステップS57)、スレッドは、ロック獲得に成功したとして処理を終了する。CAS命令が失敗した場合には、スレッドは、上記のステップS52に戻って、ロック獲得操作を再び実行する。   As a result, if lock bit = “0” is satisfied, the thread copies the variable old to the variable new (step S53), sets the lock bit of the variable new to “1” (step S54), and sets the variable new. The number of blocked threads of “1” is decremented by “1” (step S55). Then, the thread executes the CAS instruction in the same manner as in the above step S35 (step S56). If the CAS instruction is successful (step S57), the thread ends the process assuming that the lock has been successfully acquired. If the CAS instruction fails, the thread returns to step S52 to execute the lock acquisition operation again.

一方、上記のステップS52でlock bit="1"が成立した場合、スレッドは、ロック獲得に失敗したとして処理を終了する。   On the other hand, when lock bit = “1” is established in step S52 described above, the thread terminates the process on the assumption that the lock acquisition has failed.

図4に戻って、上記のユーザ空間アトミック・アクセス機能203を用いたロック獲得操作に成功した場合(ステップS19)、スレッドは、直ちにシステム・コールを終了してユーザモードに復帰し(ステップS20)、ロック獲得処理を終了する。   Returning to FIG. 4, when the lock acquisition operation using the user space atomic access function 203 is successful (step S19), the thread immediately ends the system call and returns to the user mode (step S20). The lock acquisition process ends.

これにより、スレッドは、休眠すること無く即座にロックを獲得し、クリティカルセクションを実行することができる。このため、情報処理システム1が持つ能力や性能を有効に活用できる。   As a result, the thread can immediately acquire the lock without executing sleep and execute the critical section. For this reason, the capability and performance which the information processing system 1 has can be utilized effectively.

一方、ユーザ空間アトミック・アクセス機能203を用いたロック獲得操作に失敗した場合、スレッドは、休眠処理を実行して(プロセッサ資源の利用を中断して)、休眠状態に移行する(ステップS21)。   On the other hand, when the lock acquisition operation using the user space atomic access function 203 fails, the thread executes a sleep process (interrupts the use of processor resources) and shifts to a sleep state (step S21).

この休眠状態は、ロックを獲得している他のスレッドが、クリティカルセクションの実行を終了し、ロックを解放する処理(以下、ロック解放処理と呼称する)を実行した際に解除される。   This sleep state is released when another thread that has acquired the lock finishes executing the critical section and executes a process for releasing the lock (hereinafter referred to as a lock release process).

具体的には、図9に示すように、他のスレッドは、まず、変数oldにlock word100を代入する(ステップS61)。そして、他のスレッドは、変数newに変数oldをコピーした後(ステップS62)、変数newのlock bitを"0"に設定する(ステップS63)。そして、他のスレッドは、上記のステップS35と同様にして、CAS命令を実行する(ステップS64)。   Specifically, as shown in FIG. 9, the other threads first assign the lock word 100 to the variable old (step S61). Then, the other thread copies the variable old to the variable new (step S62), and then sets the lock bit of the variable new to “0” (step S63). Then, the other threads execute the CAS instruction in the same manner as in the above step S35 (step S64).

CAS命令が成功した場合(ステップS65)、他のスレッドは、変数oldのblocked thread数が"0"であるか否かを判定する。blocked thread数="0"が成立する場合(ステップS66)、他のスレッドは、ロック解放処理を終了する。一方、blocked thread数="0"が成立しない場合、他のスレッドは、休眠状態に在るスレッドに対する起床処理を実行した後、ロック解放処理を終了する(ステップS67)。   When the CAS instruction is successful (step S65), the other threads determine whether or not the number of blocked threads of the variable old is “0”. When the number of blocked threads = “0” is satisfied (step S66), the other threads end the lock release process. On the other hand, when the number of blocked threads = “0” is not satisfied, the other threads execute the wake-up process for the thread in the sleep state, and then terminate the lock release process (step S67).

一方、CAS命令が失敗した場合には、他のスレッドは、上記のステップS62に戻って、ロック解放処理を再び実行する。   On the other hand, if the CAS instruction fails, the other thread returns to step S62 and executes the lock release process again.

図4に戻って、上記のロック解放処理により休眠状態が解除されると、スレッドは、図10に示す後処理を実行し(ステップS22)、以てlock word100のblocked thread数102をデクリメントする。具体的には、スレッドは、まず、変数oldにlock word100を代入する(ステップS71)。そして、スレッドは、変数newに変数oldをコピーした後(ステップS72)、変数newのblocked thread数を"1"だけデクリメントする(ステップS73)。そして、スレッドは、上記のステップS35と同様にして、CAS命令を実行する(ステップS44)。CAS命令が成功した場合(ステップS75)、lock word100のblocked thread数102が"1"だけデクリメントされるため、スレッドは、後処理を終了する。一方、CAS命令が失敗した場合には、スレッドは、上記のステップS72に戻って、blocked thread数102のデクリメントを再試行する。   Returning to FIG. 4, when the sleep state is released by the above-described lock release processing, the thread executes post-processing shown in FIG. 10 (step S <b> 22), and thus decrements the number of blocked threads 102 of the lock word 100. Specifically, the thread first assigns the lock word 100 to the variable old (step S71). Then, after copying the variable old to the variable new (step S72), the thread decrements the number of blocked threads of the variable new by “1” (step S73). Then, the thread executes the CAS instruction in the same manner as in the above step S35 (step S44). If the CAS instruction is successful (step S75), the number of blocked threads 102 of the lock word 100 is decremented by “1”, and the thread ends post-processing. On the other hand, if the CAS instruction has failed, the thread returns to step S72 to retry decrementing the number of blocked threads 102.

この後、スレッドは、休眠用システム・コールを終了し、ユーザモードに復帰する(図4のステップS23)。この時、スレッドは、上記のステップS20とは異なり、上記のステップS11に戻ってロック獲得処理を再び実行する。なお、スレッドは、休眠状態が解除された後、ユーザモードに復帰せずに上記のステップS18に戻り、以てユーザ空間アトミック・アクセス機能203を用いたロック獲得操作を再び実行しても良い。   Thereafter, the thread ends the sleep system call and returns to the user mode (step S23 in FIG. 4). At this time, unlike the step S20, the thread returns to the step S11 and executes the lock acquisition process again. Note that the thread may return to the above-described step S18 without returning to the user mode after the sleep state is cancelled, and thus execute the lock acquisition operation using the user space atomic access function 203 again.

なお、上記の実施の形態によって本発明は限定されるものではなく、特許請求の範囲の記載に基づき、当業者によって種々の変更が可能なことは明らかである。   Note that the present invention is not limited to the above-described embodiments, and it is apparent that various modifications can be made by those skilled in the art based on the description of the scope of the claims.

本発明は、排他制御プログラム、排他制御方法、及び情報処理システムに適用され、特に複数のスレッドによるクリティカルパスの実行に際しての排他制御を行う用途に適用される。   The present invention is applied to an exclusive control program, an exclusive control method, and an information processing system, and is particularly applied to an application for performing exclusive control when a critical path is executed by a plurality of threads.

1 情報処理システム
2 メモリ
3_1〜3_n プロセッサ
10 ユーザ空間
11 ユーザ・プログラム
12 ユーザ・データ
20 カーネル空間
21 カーネル・プログラム
22 カーネル・データ
100 lock word(排他制御用データ)
101 lock bit
102 blocked thread数
201 ユーザ空間読出機能
202 ユーザ空間書込機能
203 ユーザ空間アトミック・アクセス機能
300 リトライ回数
DESCRIPTION OF SYMBOLS 1 Information processing system 2 Memory 3_1-3_n Processor 10 User space 11 User program 12 User data 20 Kernel space 21 Kernel program 22 Kernel data 100 Lock word (exclusive control data)
101 lock bit
102 Number of blocked threads 201 User space read function 202 User space write function 203 User space atomic access function 300 Retry count

Claims (7)

メモリをユーザ空間とカーネル空間とに分けて管理する情報処理システムに、排他制御を行わせる排他制御プログラムであって、
前記排他制御プログラムは、前記カーネル空間で実行され、
前記排他制御は、一の実行単位による前記ユーザ空間に配置されたユーザ・プログラム中のクリティカルセッションの実行が他の実行単位と競合した場合、前記ユーザ空間に配置される前記競合を管理するためのデータに対してアトミックにアクセスし、前記一の実行単位による前記クリティカルセクションの実行可否を判定することを含む、排他制御プログラム。
An exclusive control program for performing exclusive control in an information processing system that manages memory separately in user space and kernel space,
The exclusive control program is executed in the kernel space,
The exclusive control is for managing the contention arranged in the user space when the execution of a critical session in the user program arranged in the user space by one execution unit competes with another execution unit. An exclusive control program comprising: accessing data atomically and determining whether or not the critical section can be executed by the one execution unit.
請求項1において、
前記排他制御は、前記一の実行単位が自身の休眠状態への移行を要求する場合に、前記競合の発生を検知することを含む、排他制御プログラム。
In claim 1,
The exclusive control program includes detecting the occurrence of the contention when the one execution unit requests a transition to its sleep state.
請求項1又は2において、
前記排他制御は、前記データが前記競合の解消を示す場合、前記一の実行単位による前記クリティカルセクションの実行が可能と判定し、前記一の処理単位に、前記クリティカルセクションの実行権を与えることを含む、排他制御プログラム。
In claim 1 or 2,
The exclusive control determines that the critical section can be executed by the one execution unit when the data indicates resolution of the conflict, and gives the execution right of the critical section to the one processing unit. Includes exclusive control program.
メモリをユーザ空間とカーネル空間とに分けて管理する情報処理システムにおける排他制御方法であって、
一の実行単位による前記ユーザ空間に配置されたユーザ・プログラム中のクリティカルセッションの実行が他の実行単位と競合した場合、前記カーネル空間から、前記ユーザ空間に配置される前記競合を管理するためのデータに対してアトミックにアクセスし、前記一の実行単位による前記クリティカルセクションの実行可否を判定する、排他制御方法。
An exclusive control method in an information processing system for managing memory by dividing it into user space and kernel space,
When the execution of a critical session in a user program arranged in the user space by one execution unit competes with another execution unit, for managing the competition arranged in the user space from the kernel space An exclusive control method for accessing data atomically and determining whether the critical section can be executed by the one execution unit.
請求項4において、
前記一の実行単位が自身の休眠状態への移行を要求する場合に、前記競合の発生を検知する、排他制御プログラム。
In claim 4,
An exclusive control program for detecting the occurrence of the contention when the one execution unit requests a transition to its sleep state.
請求項4又は5において、
前記データが前記競合の解消を示す場合、前記一の実行単位による前記クリティカルセクションの実行が可能と判定し、前記一の処理単位に、前記クリティカルセクションの実行権を与える、排他制御方法。
In claim 4 or 5,
An exclusive control method for determining that execution of the critical section by the one execution unit is possible when the data indicates resolution of the conflict, and giving the execution right of the critical section to the one processing unit.
メモリをユーザ空間とカーネル空間とに分けて管理する情報処理システムであって、
請求項1〜3のいずれか一項に記載の排他制御プログラムを前記カーネル空間で実行する、情報処理システム。
An information processing system that manages memory separately in user space and kernel space,
An information processing system that executes the exclusive control program according to claim 1 in the kernel space.
JP2009276694A 2009-12-04 2009-12-04 Exclusive control program, exclusive control method, and information processing system Pending JP2011118756A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009276694A JP2011118756A (en) 2009-12-04 2009-12-04 Exclusive control program, exclusive control method, and information processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009276694A JP2011118756A (en) 2009-12-04 2009-12-04 Exclusive control program, exclusive control method, and information processing system

Publications (1)

Publication Number Publication Date
JP2011118756A true JP2011118756A (en) 2011-06-16

Family

ID=44283986

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009276694A Pending JP2011118756A (en) 2009-12-04 2009-12-04 Exclusive control program, exclusive control method, and information processing system

Country Status (1)

Country Link
JP (1) JP2011118756A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5725162B2 (en) * 2011-03-31 2015-05-27 富士通株式会社 Exclusive control method and exclusive control program
JP7087150B1 (en) * 2021-03-26 2022-06-20 ミラクシアエッジテクノロジー株式会社 Memory control system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05233571A (en) * 1992-02-18 1993-09-10 Fujitsu Ltd Multiprocessor system
JP2006155204A (en) * 2004-11-29 2006-06-15 Fujitsu Ltd Multi-thread controller and multi-thread control method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05233571A (en) * 1992-02-18 1993-09-10 Fujitsu Ltd Multiprocessor system
JP2006155204A (en) * 2004-11-29 2006-06-15 Fujitsu Ltd Multi-thread controller and multi-thread control method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5725162B2 (en) * 2011-03-31 2015-05-27 富士通株式会社 Exclusive control method and exclusive control program
JP7087150B1 (en) * 2021-03-26 2022-06-20 ミラクシアエッジテクノロジー株式会社 Memory control system

Similar Documents

Publication Publication Date Title
CN101833475B (en) Method and device for execution of instruction block
US8468526B2 (en) Concurrent thread execution using user-level asynchronous signaling
US7962923B2 (en) System and method for generating a lock-free dual queue
US7496726B1 (en) Controlling contention via transactional timers among conflicting transactions issued by processors operating in insistent or polite mode
US7966459B2 (en) System and method for supporting phased transactional memory modes
KR100578437B1 (en) Mechanism for interrupt handling in computer systems that support concurrent execution of multiple threads
RU2501071C2 (en) Late lock acquire mechanism for hardware lock elision (hle)
US9229789B2 (en) Transparent user mode scheduling on traditional threading systems
US8539465B2 (en) Accelerating unbounded memory transactions using nested cache resident transactions
US5893157A (en) Blocking symbol control in a computer system to serialize accessing a data resource by simultaneous processor requests
WO2011096163A1 (en) Information processing system, exclusive control method, and program for exclusive control
US8978131B2 (en) Deterministic serialization of access to shared resources in a multi-processor system for code instructions accessing resources in a non-deterministic order
US20100131720A1 (en) Management of ownership control and data movement in shared-memory systems
KR102599689B1 (en) Permission to non-abort processing of transactions after exception mask update command
US20100100885A1 (en) Transaction processing for side-effecting actions in transactional memory
JP2004288162A (en) Operating system architecture using synchronous task
JP5999216B2 (en) Data processing device
JP2011118756A (en) Exclusive control program, exclusive control method, and information processing system
US7996848B1 (en) Systems and methods for suspending and resuming threads
Titos-Gil et al. Concurrent irrevocability in best-effort hardware transactional memory
CN117453413A (en) Resource application method, device, electronic equipment and storage medium
Wamhoff Exploiting Speculative and Asymmetric Execution on Multicore Architectures
JP2001256065A (en) Exclusive control method and computer system
JPH02100755A (en) Information processing system
TOZUN Conflict Avoidance in Software Transactional Memory

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20121107

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131031

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140304