Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP3511935B2 - File writing method in multi-thread program - Google Patents
[go: Go Back, main page]

JP3511935B2 - File writing method in multi-thread program - Google Patents

File writing method in multi-thread program

Info

Publication number
JP3511935B2
JP3511935B2 JP05944199A JP5944199A JP3511935B2 JP 3511935 B2 JP3511935 B2 JP 3511935B2 JP 05944199 A JP05944199 A JP 05944199A JP 5944199 A JP5944199 A JP 5944199A JP 3511935 B2 JP3511935 B2 JP 3511935B2
Authority
JP
Japan
Prior art keywords
file
thread
handle
closing
name
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.)
Expired - Fee Related
Application number
JP05944199A
Other languages
Japanese (ja)
Other versions
JP2000259432A (en
Inventor
新一 木田
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 JP05944199A priority Critical patent/JP3511935B2/en
Publication of JP2000259432A publication Critical patent/JP2000259432A/en
Application granted granted Critical
Publication of JP3511935B2 publication Critical patent/JP3511935B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、マルチスレッド・
プログラムにおける共有資源であるファイルへの排他的
な追加書込みを行うファイル追加書込み方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention
The present invention relates to a file additional writing method for performing exclusive additional writing to a file that is a shared resource in a program.

【0002】[0002]

【従来の技術】マルチタスクシステムは、複数のプログ
ラムが同時に実行可能な様に、これらのプログラムに見
かけ上、独立したメモリ空間やI/O空間などを割り当
てている。この結果、マルチタスクシステムは、それぞ
れのプログラムに対しあたかもそれだけが動作している
ように見せかける。このプログラムの実行単位をプロセ
スと言う。
2. Description of the Related Art A multitasking system apparently allocates an independent memory space or I / O space to these programs so that they can be executed simultaneously. As a result, the multitasking system makes each program appear as if it were running. The execution unit of this program is called a process.

【0003】しかし、このマルチタスクシステムは、プ
ロセスの切替処理の負荷が大いため、システム全体の速
度が低下してしまう問題がある。これを解決するために
用いられるのがマルチスレッド・プログラムのを使用し
たシステムである。このときのタスクの実行単位をスレ
ッドと呼ぶ。同一プロセス内のスレッド間では、タスク
間の切り換えにおける負荷が小さく、かつ各スレッド間
においてメモリやI/O資源等を共有しているため、切
り換えが容易に行える。
However, this multitasking system has a problem in that the speed of the entire system is reduced because the load of process switching processing is heavy. A system using a multithreaded program is used to solve this problem. The execution unit of the task at this time is called a thread. Among threads in the same process, the load of switching between tasks is small, and since the threads share memory, I / O resources, etc., switching can be easily performed.

【0004】しかしながら、マルチスレッド・プログラ
ムは複数のスレッドが並行して動作するため、ファイル
等の共有資源にアクセスする場合には、同期をとる必要
がある。このため、従来のマルチスレッド・プログラム
では、あるスレッドが共有資源であるファイルにデータ
を書込む際には、対応するファイルをオープンしてから
クローズするまでの間、他のスレッドのアクセスに対し
て排他的に動作するように制御している。
However, since a plurality of threads operate in parallel in a multi-thread program, it is necessary to synchronize when accessing a shared resource such as a file. Therefore, in a conventional multi-threaded program, when a thread writes data to a file that is a shared resource, it does not access the other thread from the time the corresponding file is opened until it is closed. It is controlled to operate exclusively.

【0005】[0005]

【発明が解決しようとする課題】しかしながら、上述し
たマルチスレッド・プログラムには、共有資源であるフ
ァイルへの書込みを行うとき、ファイルをオープンして
からクローズするまでの間、排他的な制御を行っている
ため、スレッドの並行動作ができないため、ファイルへ
の追加書込みを行うスレッドのとき、他のスレッドのフ
ァイルアクセスができないため、スレッド並行動作によ
るCPU使用効率向上等のマルチスレッドの利点が損な
われるという問題がある。
However, in the above-mentioned multi-thread program, when writing to a file which is a shared resource, exclusive control is performed from the time the file is opened until the time it is closed. Since the threads cannot operate concurrently, the threads that perform additional writing to the file cannot access the files of other threads, and the advantages of multi-threads such as the improvement of CPU usage efficiency due to the thread parallel operation are lost. There is a problem.

【0006】また、上述したマルチスレッド・プログラ
ムには、各スレッドがファイルアクセスする毎に共有資
源であるファイルをオープン/クローズしているため、
共有資源であるファイルへの追加書込みを行うとき、時
間がかかるとい問題がある。
Further, in the above-mentioned multi-thread program, the file which is a shared resource is opened / closed each time each thread accesses the file.
There is a problem that it takes time to perform additional writing to a file which is a shared resource.

【0007】本発明はこのような背景の下になされたも
ので、マルチスレッド・プログラムにおいて、スレッド
並行動作によるCPU使用効率の向上を損なわずに、共
有資源であるファイルへの追加書込みが行え、また 共
有資源であるファイルへの追加書込みを行うとき、この
ファイルのオープン/クローズの回数を減らしてスレッ
ドの動作時間を短縮するマルチスレッド・プログラムに
おけるファイル追加書込み方式を提供する。
The present invention has been made under such a background, and in a multi-thread program, additional writing to a file which is a shared resource can be performed without impairing the improvement of the CPU usage efficiency by the thread parallel operation. Further, when performing additional writing to a file which is a shared resource, there is provided a file additional writing method in a multi-thread program that reduces the number of times this file is opened / closed to shorten the thread operation time.

【0008】[0008]

【課題を解決するための手段】請求項1記載の発明は、
複数のスレッドから構成されるマルチスレッド・プログ
ラムにおけるファイル書込方式において、オープンされ
ているファイルのファイル名と、前記ファイルを示すフ
ァイルハンドルと、このファイルを使用している前記ス
レッドを示すスレッドIDとの関係を示す表を記憶する
ファイル情報保持部と、前記スレッドの制御によりオー
プンするファイルのファイル名、及びこのスレッドを示
すスレッドIDを出力するファイルオープン手段と、前
記スレッドの制御によりこのスレッドを示すスレッドI
D及びクローズするファイルに対応するファイルハンド
ルを出力するファイルクローズ手段と、前記ファイルオ
ープン手段からスレッドを識別するスレッドID及びオ
ープンするファイルのファイル名が入力されたとき、前
記ファイルに対応する前記ファイルハンドルを取得し、
このスレッドID及びこのファイル名に関連させてこの
ファイルハンドルを前記ファイル情報保持部へ記憶さ
せ、前記ファイルクローズ手段からスレッドを識別する
スレッドID及びクローズするファイルに対応するファ
イルハンドルが入力されたとき、ファイル情報保持部か
らこのファイルハンドル及びこのファイルハンドルに対
応するファイル名,スレッドIDを除去するファイル開
閉排他制御手段と、前記スレッドの制御によりこのスレ
ッドを示すスレッドID、書き込みを行うファイルを示
すファイルハンドル及びこのファイルに書込むデータを
出力するデータ書込み手段と、前記データ書込み手段か
ら入力されるスレッドID、ファイルハンドル及びファ
イルに書込むデータを受け取り、このファイルハンドル
に対応するファイルの末尾にこのデータを書込むファイ
ル書込み排他制御手段とを具備することを特徴とする。
The invention according to claim 1 is
In a file writing method in a multi-thread program including a plurality of threads, a file name of an opened file, a file handle indicating the file, and a thread ID indicating the thread using the file. A file information holding unit that stores a table indicating the relationship between the file name, a file name of a file that is opened under the control of the thread, and a file opening unit that outputs a thread ID indicating the thread, and a thread that is controlled by the thread Thread I
D and a file closing means for outputting a file handle corresponding to the file to be closed, and the file handle corresponding to the file when the thread ID for identifying the thread and the file name of the file to be opened are inputted from the file opening means To get
When this file handle is stored in the file information holding unit in association with this thread ID and this file name, and the thread ID for identifying the thread and the file handle corresponding to the file to be closed are input from the file closing means, File opening / closing exclusive control means for removing the file handle, the file name corresponding to the file handle, and the thread ID from the file information holding unit, the thread ID indicating the thread under the control of the thread, and the file handle indicating the file to be written. And a data writing means for outputting data to be written in the file, a thread ID, a file handle and data to be written in the file which are input from the data writing means, and a file corresponding to the file handle Characterized by comprising a file write exclusive control means for writing the data to the end.

【0009】請求項2記載の発明は、請求項1記載のマ
ルチスレッド・プログラムにおけるファイル追加書込み
方式において、前記ファイル開閉排他制御手段が、前記
ファイル名が記載されている前記ファイル情報保持部に
おけるファイル名の参照/更新を、前記ファイル情報保
持部に記憶されている前記スレッドID及び前記ファイ
ルハンドルに基づき排他制御し、前記ファイルのオープ
ン及びクローズを制御することを特徴とする。
According to a second aspect of the present invention, in the file addition / writing method in the multithread program according to the first aspect, the file opening / closing exclusive control means is a file in the file information holding section in which the file name is described. The name reference / update is exclusively controlled based on the thread ID and the file handle stored in the file information holding unit, and the opening and closing of the file are controlled.

【0010】請求項3記載の発明は、請求項1または請
求項2記載のマルチスレッド・プログラムにおけるファ
イル追加書込み方式において、前記ファイル開閉排他制
御手段が、前記ファイルオープン手段からスレッドID
及びファイル名を受け取り、ファイル情報保持部を参照
して、このファイル名がファイル情報保持部にないこと
を検出すると、このファイル名に対応するファイルをオ
ープンし、ファイルハンドル及びスレッド毎情報をファ
イル情報保持部に記憶してファイルハンドルを返し、ま
たこのファイル名のファイル名がファイル情報保持部に
あることを検出すると、ファイルオープンの処理を行わ
ず、スレッドIDをファイル情報保持部に記憶してファ
イルハンドルを前記ファイルオープン手段へ出力し、ま
た、前記ファイルクローズ手段から前記スレッドID及
び前記ファイルハンドルを受け取ったとき、ファイル情
報保持部を参照してこのスレッドIDを削除し、他にス
レッドIDが全く存在しない場合ファイルをクローズ
し、ファイルハンドルを前記ファイルクローズ手段へ出
力し、他にスレッドIDが全く存在しない場合、ファイ
ルをクローズせずにファイルハンドルを前記ファイルク
ローズ手段へ出力することを特徴とする。
According to a third aspect of the present invention, in the file addition / writing method in the multithreaded program according to the first or second aspect, the file opening / closing exclusive control means sends the thread ID from the file opening means.
And the file name is received, the file information holding unit is referred to, and when it is detected that this file name is not in the file information holding unit, the file corresponding to this file name is opened, and the file handle and the information for each thread are set as the file information. When the file is stored in the holding unit and a file handle is returned and it is detected that the file name of this file name is in the file information holding unit, the file ID is not stored and the thread ID is stored in the file information holding unit. When the handle is output to the file opening means, and when the thread ID and the file handle are received from the file closing means, the thread ID is deleted by referring to the file information holding unit, and the thread ID is completely deleted. If it does not exist, the file is closed and the file The output to the file closing means, if another thread ID does not exist at all, and outputs without closing the file the file handle to the file closing means.

【0011】請求項4記載の発明は、請求項1ないし請
求項3のいずれかに記載のマルチスレッド・プログラム
におけるファイル追加書込み方式において、前記ファイ
ル書込み排他制御手段が、前記ファイルをオープンして
いるスレッド以外の前記スレッドの前記ファイルへのデ
ータの書込みを、前記ファイル情報保持部に記憶されて
いる前記スレッドID及び前記ファイルハンドルに基づ
き排他制御することを特徴とする。
According to a fourth aspect of the present invention, in the file additional writing method in the multithread program according to any one of the first to third aspects, the file write exclusive control means opens the file. The writing of data to the file of the threads other than the thread is exclusively controlled based on the thread ID and the file handle stored in the file information holding unit.

【0012】[0012]

【発明の実施の形態】以下、図面を参照して本発明の実
施形態について説明する。図1は本発明の一実施形態に
よるファイル書込方式の構成を示すブロック図である。
この図において、一実施形態によるファイル書込方式
は、スレッドの指示部1,ファイルオープン手段3,フ
ァイルクローズ手段4,データ書込み手段5,ファイル
開閉排他制御手段6,ファイル書込み排他制御手段7及
びファイル情報保持部8から構成されている。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing the configuration of a file writing method according to an embodiment of the present invention.
In the figure, the file writing method according to the embodiment is such that a thread instruction unit 1, a file opening unit 3, a file closing unit 4, a data writing unit 5, a file opening / closing exclusive control unit 6, a file writing exclusive control unit 7, and a file. The information holding unit 8 is provided.

【0013】スレッドの指示部1は、マルチスレッド・
プログラムの各スレッドからの指示(スレッドID,フ
ァイル名等)をファイルオープン手段3,ファイルクロ
ーズ手段4及びデータ書込み手段5へ出力する。
The thread instruction unit 1 is a multi-thread
Instructions (thread ID, file name, etc.) from each thread of the program are output to the file opening means 3, the file closing means 4, and the data writing means 5.

【0014】ファイルオープン手段3は、マルチスレッ
ドプログラムのスレッドから、ファイルをオープンする
ためのスレッドID及びファイル名が入力される。ま
た、ファイルオープン手段3は、入力されたスレッドI
D及びファイル名をファイル開閉排他制御手段6へ出力
する。ここで、スレッドIDは、各スレッドを識別する
ための符号である。
The file opening means 3 receives a thread ID and a file name for opening a file from a thread of a multi-thread program. Further, the file opening means 3 uses the input thread I
The D and the file name are output to the file opening / closing exclusive control means 6. Here, the thread ID is a code for identifying each thread.

【0015】さらに、ファイルオープン手段3は、ファ
イル開閉排他制御手段6がスレッドID及びファイル名
に対応してが入力されると、ファイル名に対応したファ
イルハンドルを、スレッドID及びファイル名を出力し
たスレッドに出力する。ここで、ファイルハンドルと
は、ファイルオープンするファイルを、マルチスレッド
プログラム中における各ファイルを識別するファイルに
付された名前である。
Furthermore, when the file opening / closing exclusive control means 6 inputs the file ID corresponding to the thread ID and the file name, the file opening means 3 outputs the file handle corresponding to the file name, the thread ID and the file name. Output to thread. Here, the file handle is the name given to the file to be opened, which identifies each file in the multi-thread program.

【0016】ファイルクローズ手段4は、マルチスレッ
ドプログラムのスレッドから、ファイルをクローズする
ためのスレッドID及びファイルハンドルが入力され
る。また、ファイルクローズ手段は、入力されたスレッ
ドID及びファイルハンドルをファイル開閉排他制御手
段6へ出力する。
The file closing means 4 receives a thread ID and a file handle for closing a file from a thread of a multi-thread program. Further, the file closing means outputs the input thread ID and file handle to the file opening / closing exclusive control means 6.

【0017】ファイル書込み手段5は、スレッドからス
レッドID,ファイルハンドル及びファイルに書き込む
データが入力される。また、ファイル書込み手段5は、
ファイルハンドルが示すファイル2にスレッドから入力
されたデータを書き込む。
The file writing means 5 receives the thread ID, the file handle, and the data to be written in the file from the thread. Further, the file writing means 5 is
The data input from the thread is written to the file 2 indicated by the file handle.

【0018】ファイル開閉排他制御手段6は、ファイル
をオープンするため、スレッドID及びファイル名がフ
ァイルオープン手段3から入力される。また、ファイル
開閉排他制御手段6は、入力されたファイル名がファイ
ル情報保持部8に存在しているか否かの検索を行う。
The file opening / closing exclusive control means 6 inputs the thread ID and the file name from the file opening means 3 in order to open the file. Further, the file opening / closing exclusive control unit 6 searches for whether the input file name exists in the file information holding unit 8.

【0019】このとき、ファイル開閉排他制御手段6
は、ファイル情報保持部8に入力されたファイル名が存
在しない場合、新たに、入力されたファイル名をファイ
ル情報保持部8へ書き込み、対応するファイルのオープ
ンを行う。さらに、ファイル開閉排他制御手段6は、フ
ァイル情報保持部8へ書き込んだファイル名に対応した
ファイルハンドルをファイルオープン手段3へ出力す
る。
At this time, the file opening / closing exclusive control means 6
When the file name input to the file information holding unit 8 does not exist, the newly input file name is written to the file information holding unit 8 and the corresponding file is opened. Further, the file opening / closing exclusive control unit 6 outputs the file handle corresponding to the file name written in the file information holding unit 8 to the file opening unit 3.

【0020】また、ファイル開閉排他制御手段6は、フ
ァイルをクローズするため、ファイルクローズ手段4か
らスレッドID及びファイルハンドルが入力される。ま
た、ファイル開閉排他制御手段6は、ファイルハンドル
に対応するファイルのファイル名をファイル情報保持部
8から除去して、ファイルをクローズする。
The file opening / closing exclusive control means 6 receives the thread ID and the file handle from the file closing means 4 in order to close the file. The file open / close exclusive control unit 6 also removes the file name of the file corresponding to the file handle from the file information holding unit 8 and closes the file.

【0021】このとき、ファイル開閉排他制御手段6
は、他に同一のファイルを使用しているスレッドの有無
を確認して、他に使用していれば対応するファイルの除
去を行わず、ファイルのクローズを行わない。
At this time, the file opening / closing exclusive control means 6
Checks for the existence of other threads that are using the same file, and if other is used, does not remove the corresponding file and does not close the file.

【0022】ファイル情報保持部8は、ファイル名とフ
ァイルハンドルとの関係を示している。ここで、ファイ
ル名がファイル情報保持部8に存在すれば、このファイ
ル名のファイルは、オープンされている。
The file information holding unit 8 shows the relationship between the file name and the file handle. Here, if the file name exists in the file information holding unit 8, the file with this file name is open.

【0023】図2にファイル情報保持部8のデータの構
成が示されている。ファイル名欄9には、オープンされ
たファイル名、例えば「AAAA」,「BBB」,「C
CCCC」,……が書き込まれている。また、ファイル
ハンドル欄10には、ファイル名欄9のファイルに対応
したファイルハンドルが示されている。例えば、ファイ
ル名「AAAA」に対してはファイルハンドル「XX
X」が、ファイル名「BBB」に対してはファイルハン
ドル「YYY」が、ファイル名「CCCCC」に対して
はファイルハンドル「ZZZ」が、対応している。
FIG. 2 shows the data structure of the file information holding unit 8. In the file name column 9, the opened file name, for example, "AAAA", "BBB", "C"
CCCC ", ... Is written. Further, the file handle column 10 shows the file handle corresponding to the file in the file name column 9. For example, for the file name "AAAA", the file handle "XX
The file handle “YYY” corresponds to the file name “BBB”, and the file handle “ZZZ” corresponds to the file name “CCCCC”.

【0024】また、ファイル名欄9のファイル名に対応
して、スレッド毎情報欄11にこのファイルを使用して
いるスレッドのスレッドIDが示されている。例えば、
ファイル名「AAAA」に対してはスレッドID欄12
にスレッドID「ID1」,スレッドID「ID4」,
スレッドID「ID12」及び……が、ファイル名「B
BB」に対してはスレッドID欄13にスレッドID
「ID3」,スレッドID「ID8」及び……が、ファ
イル名「CCCCC」に対してはスレッドID欄13に
スレッドID「ID15」,……が、各ファイルを使用
しているスレッドとして示されている。
Further, in correspondence with the file name in the file name column 9, the thread ID of the thread using this file is shown in the thread information column 11. For example,
The thread ID column 12 for the file name "AAAA"
Thread ID “ID1”, thread ID “ID4”,
The thread IDs “ID12” and ... Are the file names “B
For "BB", enter the thread ID in the thread ID column 13.
"ID3", thread ID "ID8" and so on are shown in the thread ID column 13 for the file name "CCCCC", and thread ID "ID15" and so on are shown as threads using each file. There is.

【0025】次に、図1及び図2を参照し、一実施形態
の動作例を説明する。前提として、各スレッドによるス
レッドの指示部1からの、ファイルオプーン手段3に対
する動作指示、ファイルクローズ手段4に対する動作指
示、及び、データ書込み手段5に対する動作指示は、各
々非同期で行われる。以下に各動作を順に説明する。
Next, an operation example of one embodiment will be described with reference to FIGS. As a premise, the operation instruction to the file opening means 3, the operation instruction to the file closing means 4, and the operation instruction to the data writing means 5 from the thread instruction unit 1 by each thread are performed asynchronously. Each operation will be described below in order.

【0026】<ファイルオプーン手段3の動作>例え
ば、スレッドID「ID15」のスレッドがスレッドの
指示部1から、スレッドID「ID15」及びファイル
名「CCCCC」をファイルオープン手段3に渡したと
する。ファイルオプーン手段3は、ファイル名「CCC
CC」のファイルをオープンするため、ファイル開閉排
他制御手段6へスレッドID「ID15」及びファイル
名「CCCCC」を転送する。
<Operation of File Opening Means 3> For example, it is assumed that the thread having the thread ID “ID15” passes the thread ID “ID15” and the file name “CCCCC” from the thread instruction unit 1 to the file opening means 3. The file open means 3 uses the file name “CCC
In order to open the file "CC", the thread ID "ID15" and the file name "CCCCC" are transferred to the file opening / closing exclusive control means 6.

【0027】これにより、ファイル開閉排他制御手段6
は、ファイル情報保持部8への参照/更新を行う。この
とき、複数のスレッドが同時に、ファイル開閉排他制御
手段6を介してファイル情報保持部8にアクセスする
と、ファイル情報保持部8に記憶されているスレッド毎
の情報が破壊されたり、書き換え途中などにおける不正
なスレッド毎の情報等を参照してしまう。
As a result, the file opening / closing exclusive control means 6
References / updates the file information holding unit 8. At this time, when a plurality of threads simultaneously access the file information holding unit 8 via the file opening / closing exclusive control unit 6, the information for each thread stored in the file information holding unit 8 is destroyed, or during rewriting. Incorrect information for each thread is referenced.

【0028】このため、ファイル情報保持部8へのスレ
ッド毎の情報に対する参照/更新を行う場合には、ミュ
ーテックス(常に1つのスレッドにアクセス権を与え
る)を使用してファイル情報保持部8への各スレッドの
アクセスに同期をとる。
Therefore, when referring / updating the information for each thread to the file information holding unit 8, a mutex (always gives access right to one thread) is used to access the file information holding unit 8. Synchronize with the access of each thread.

【0029】そして、開閉排他制御手段6は、スレッド
ID「ID15」のスレッドがミューテックスの所有権
を獲得すると、ファイル情報保持部8のファイル名欄9
の一覧を参照して、受け取ったファイル名「CCCC
C」と同一のファイル名があるか否かの検索を行う。
When the thread having the thread ID “ID15” acquires the ownership of the mutex, the opening / closing exclusive control means 6 determines the file name column 9 of the file information holding unit 8.
Of the received file name "CCCC
It is searched whether or not there is the same file name as "C".

【0030】このとき、開閉排他制御手段6は、受け取
ったファイル名「CCCCC」がファイル名欄9に存在
しない場合、受け取ったファイル名「CCCCC」をフ
ァイル名欄9に追加書込みを行い、ファイル名「CCC
CC」に対応するファイル2をオープンする。
At this time, if the received file name "CCCCC" does not exist in the file name column 9, the open / close exclusive control means 6 additionally writes the received file name "CCCCC" in the file name column 9 to obtain the file name. "CCC
File 2 corresponding to "CC" is opened.

【0031】そして、開閉排他制御手段6は、ファイル
名「CCCCC」に対応したファイルハンドル「ZZ
Z」を取得し、追加したファイル名「CCCCC」に対
応したファイルハンドル欄10にこのファイルハンドル
「ZZZ」を書込む。また、開閉排他制御手段6は、ス
レッド毎情報欄11のスレッドID欄14に受け取った
スレッドID「ID15」を書込む。
Then, the opening / closing exclusive control means 6 uses the file handle "ZZ" corresponding to the file name "CCCCC".
“Z” is acquired, and this file handle “ZZZ” is written in the file handle column 10 corresponding to the added file name “CCCCC”. Further, the opening / closing exclusive control unit 6 writes the received thread ID “ID15” in the thread ID column 14 of the thread information column 11.

【0032】次に、開閉排他制御手段6は、取得したフ
ァイルハンドル「ZZZ」をファイルオープン手段3に
出力する。そして、ファイルオープン手段3は、開閉排
他制御手段6から入力されたファイルハンドル「ZZ
Z」をスレッドID「ID15」のスレッドへ出力す
る。この結果、スレッドID「ID15」のスレッド
は、ファイルハンドル「ZZZ」が入力されることによ
り、ファイル名「CCCCC」のファイルがオープンさ
れたことを確認する。
Next, the opening / closing exclusive control means 6 outputs the obtained file handle “ZZZ” to the file opening means 3. Then, the file open means 3 receives the file handle “ZZ input from the open / close exclusive control means 6.
Z ”is output to the thread with the thread ID“ ID15 ”. As a result, the thread with the thread ID “ID15” confirms that the file with the file name “CCCCC” has been opened by inputting the file handle “ZZZ”.

【0033】一方、開閉排他制御手段6は、受け取った
ファイル名「CCCCC」がファイル名欄9に存在する
場合、スレッド毎情報欄11のスレッドID欄14にス
レッドID「ID15」を追加書き込みする。これによ
り、開閉排他制御手段6は、ファイルハンドル欄10か
らファイル名「CCCCC」に対応するファイルハンド
ル「ZZZ」を取得し、このファイルハンドル「ZZ
Z」をファイルオープン手段3に出力する。
On the other hand, when the received file name “CCCCC” exists in the file name column 9, the open / close exclusive control means 6 additionally writes the thread ID “ID15” in the thread ID column 14 of the per thread information column 11. As a result, the opening / closing exclusive control means 6 obtains the file handle “ZZZ” corresponding to the file name “CCCCC” from the file handle column 10 and the file handle “ZZ”.
Z ”is output to the file opening means 3.

【0034】そして、ファイルオープン手段3は、開閉
排他制御手段6から入力されたファイルハンドル「ZZ
Z」をスレッドID「ID15」のスレッドへ出力す
る。この結果、スレッドID「ID15」のスレッド
は、ファイルハンドル「ZZZ」が入力されることによ
り、ファイル名「CCCCC」のファイルがオープンさ
れていることを確認する。
Then, the file open means 3 receives the file handle "ZZ input from the open / close exclusive control means 6."
Z ”is output to the thread with the thread ID“ ID15 ”. As a result, the thread with the thread ID “ID15” confirms that the file with the file name “CCCCC” is opened by inputting the file handle “ZZZ”.

【0035】<ファイルクローズ手段4の動作>例え
ば、スレッドID「ID3」のスレッドがスレッドの指
示部1から、スレッドID「ID3」及びファイルハン
ドル「YYY」をファイルクローズ手段4に渡したとす
る。このファイルハンドル「YYY」は、ファイル名
「BBB」のファイルのオープンにおいて、ファイルオ
ープン手段3の動作においてスレッドID「ID3」の
スレッドが取得している。
<Operation of File Closing Unit 4> For example, it is assumed that the thread with the thread ID “ID3” passes the thread ID “ID3” and the file handle “YYY” from the thread instruction unit 1 to the file closing unit 4. This file handle “YYY” is acquired by the thread with the thread ID “ID3” in the operation of the file opening means 3 when the file with the file name “BBB” is opened.

【0036】ファイル手段クローズ4は、ファイルハン
ドル「YYY」のファイルをクローズするため、ファイ
ル開閉排他制御手段6へスレッドID「ID3」及びフ
ァイルハンドル「YYY」を転送する。
The file means close 4 transfers the thread ID "ID3" and the file handle "YYY" to the file opening / closing exclusive control means 6 in order to close the file with the file handle "YYY".

【0037】このとき、ファイル開閉排他制御手段6
は、スレッドID「ID3」のスレッドがミューテック
スの所有権を獲得するまで待機する。つぎに、ファイル
開閉排他制御手段6は、ミューテックスの所有権を獲得
する
At this time, the file opening / closing exclusive control means 6
Waits until the thread with the thread ID “ID3” acquires ownership of the mutex. Next, the file opening / closing exclusive control means 6 acquires the ownership of the mutex.

【0038】そして、ファイル開閉排他制御手段6は、
ファイル情報保持部8におけるファイルハンドル欄10
の一覧を参照する。このとき、ファイル開閉排他制御手
段6は、受け取ったファイルハンドル「YYY」と一致
するファイルハンドルの検索を行う。
Then, the file opening / closing exclusive control means 6 is
File handle column 10 in the file information holding unit 8
See the list. At this time, the file opening / closing exclusive control unit 6 searches for a file handle that matches the received file handle “YYY”.

【0039】次に、ファイル開閉排他制御手段6は、一
致するファイルハンドル「YYY」を検出すると、スレ
ッド毎情報欄11において、このファイルハンドル「Y
YY」に対応するスレッドID欄13を参照する。そし
て、ファイル開閉排他制御手段6は、受け取ったスレッ
ドID「ID3」と一致するスレッドID行を検索す
る。このとき、ファイル開閉排他制御手段6は、スレッ
ドID「ID3」を検出すると、スレッドID欄13か
らこのスレッドID「ID3」を削除する。
Next, when the file opening / closing exclusive control means 6 detects the matching file handle "YYY", the file handle "Y" is displayed in the thread information column 11.
The thread ID column 13 corresponding to “YY” is referred to. Then, the file opening / closing exclusive control unit 6 searches for a thread ID line that matches the received thread ID “ID3”. At this time, the file open / close exclusive control unit 6 deletes the thread ID “ID3” from the thread ID column 13 when detecting the thread ID “ID3”.

【0040】そして、ファイル開閉排他制御手段6は、
スレッドID欄14にの一覧にスレッドID「ID3」
を除去した後、スレッドID欄14に他のスレッドのス
レッドIDが無ければ、ファイル情報保持部8のファイ
ルハンドル欄10におけるファイルハンドル「YYY」
を削除する。次に、ファイル開閉排他制御手段6は、フ
ァイルハンドル「YYY」に基づきファイル2のクロー
ズを行う。
Then, the file opening / closing exclusive control means 6 is
The thread ID “ID3” is displayed in the list in the thread ID column 14.
If there is no thread ID of another thread in the thread ID column 14 after the removal of the, the file handle “YYY” in the file handle column 10 of the file information holding unit 8
To delete. Next, the file opening / closing exclusive control means 6 closes the file 2 based on the file handle “YYY”.

【0041】一方、ファイル開閉制御手段6は、スレッ
ドID欄14にの一覧にスレッドID「ID3」を除去
した後、スレッドID欄14に他のスレッドのスレッド
ID「ID8」があるため、ファイル2をクローズせず
に、ファイルハンドル「YYY」をファイルクローズ手
段4へ出力する。
On the other hand, the file opening / closing control means 6 removes the thread ID “ID3” from the list in the thread ID column 14 and then the thread ID “ID8” of another thread in the thread ID column 14, so the file 2 The file handle “YYY” is output to the file closing means 4 without closing the file.

【0042】そして、ファイルクローズ手段4は、ファ
イル開閉制御手段6から入力されるファイルハンドル
「YYY」をスレッド「ID3」のスレッドへ出力す
る。これにより、スレッド「ID3」のスレッドは、フ
ァイルクローズ手段4が指示に対応したクローズ動作を
行ったことを認識する。
Then, the file closing means 4 outputs the file handle "YYY" input from the file opening / closing control means 6 to the thread of thread "ID3". As a result, the thread with the thread “ID3” recognizes that the file closing means 4 has performed the closing operation corresponding to the instruction.

【0043】<データ書込み手段5の動作>例えば、ス
レッドID「ID3」のスレッドがスレッドの指示部1
から、スレッドID「ID3」,ファイルハンドル「Y
YY」及びファイル名「BBB」のファイルに書き込む
データDをデータ書込み手段5に出力したとする。デー
タ書込み手段5は、ファイルハンドル「YYY」の示す
ファイルにデータDを書き込むため、ファイル書込排他
制御手段7へスレッドID「ID3」,ファイルハンド
ル「YYY」及びデータDを転送する。
<Operation of Data Writing Unit 5> For example, the thread having the thread ID “ID3” is the thread instruction unit 1
From thread ID “ID3”, file handle “Y
It is assumed that the data D to be written in the file of "YY" and the file name "BBB" is output to the data writing means 5. The data writing unit 5 transfers the thread D “ID3”, the file handle “YYY”, and the data D to the file writing exclusive control unit 7 in order to write the data D in the file indicated by the file handle “YYY”.

【0044】ファイル書込み排他制御手段7は、ファイ
ルハンドル「YYY」の示すファイル、例えばファイル
2への追加書込みを行うので、複数のスレッドが同時に
ファイル2にアクセスすると、ファイル2に記憶されて
いるデータが破壊されてしまう。
Since the file write exclusive control means 7 performs additional writing to the file indicated by the file handle "YYY", for example, file 2, when a plurality of threads access the file 2 at the same time, the data stored in the file 2 is written. Will be destroyed.

【0045】このため、ファイル書込み排他制御手段7
は、ファイル2に記憶されているデータの更新を行う場
合、ミューテックを使用して各スレッドのファイル2に
対するデータの更新動作の同期をとる。すなわち、複数
のスレッドが同時にファイル2に対するデータの更新動
作を行わない様にする。
Therefore, the file write exclusive control means 7
When updating the data stored in the file 2, the mutex is used to synchronize the data updating operation of the threads with respect to the file 2. That is, the plurality of threads are prevented from simultaneously performing the data update operation on the file 2.

【0046】そして、ファイル書込み排他制御手段7
は、ミューテックの所有権を獲得したスレッド、例えば
スレッドID「ID3」のスレッドから入力されたデー
タDを、ファイル2の末尾(現在記憶されているデータ
の最後)に追加書込みを行う。次に、ファイル書込み排
他制御手段7は、追加書込みが終了すると、ファイルハ
ンドル「YYY」をデータ書込手段5へ出力する。
File write exclusive control means 7
Performs additional writing to the end of the file 2 (the end of the currently stored data) of the data D input from the thread that has acquired the ownership of the mutech, for example, the thread with the thread ID “ID3”. Next, the file write exclusive control means 7 outputs the file handle “YYY” to the data writing means 5 when the additional writing is completed.

【0047】そして、データ書込手段5は、ファイル書
込み排他制御手段7から入力されたファイルハンドル
「YYY」をスレッドID「ID3」のスレッドへ出力
する。これにより、スレッドID「ID3」のスレッド
は、データ書込手段5が指示に対応した書込動作を行っ
たことを確認する。
Then, the data writing means 5 outputs the file handle "YYY" input from the file write exclusion control means 7 to the thread having the thread ID "ID3". As a result, the thread with the thread ID “ID3” confirms that the data writing unit 5 has performed the writing operation corresponding to the instruction.

【0048】次に、本実施形態の効果について説明す
る。本実施形態のマルチスレッド・プログラムにおける
ファイル書込方式では、排他制御を行っている間隔は、
ファイル開閉排他制御手段6がファイル情報保持部8へ
の参照/更新を行っている間と、ファイル書込み排他制
御手段7がファイル2へのデータの追加書込みを行って
いる間のみであり、ファイルをオープンしてからクロー
ズするまでの間隔よりも時間が短いため、スレッド並行
動作によるCPU使用効率を向上させることができる。
Next, the effect of this embodiment will be described. In the file writing method in the multi-thread program of this embodiment, the interval at which exclusive control is performed is
Only while the file open / close exclusive control unit 6 is referring to / updating the file information holding unit 8 and while the file write exclusive control unit 7 is additionally writing data to the file 2, Since the time is shorter than the interval from the opening to the closing, the CPU usage efficiency by the thread parallel operation can be improved.

【0049】また、本実施形態のマルチスレッド・プロ
グラムにおけるファイル書込方式では、ファイル開閉排
他制御手段6が、既にオープンされているファイルが存
在するとき、そのファイルのファイルハンドルを返すた
め、ファイルをオープンさせる処理を行う必要が無く、
ファイルのオープン回数を減らせるため、スレッド並行
動作によるCPU使用効率を向上させることができる。
Further, in the file writing method in the multi-thread program of this embodiment, when the file opening / closing exclusive control means 6 returns the file handle of an already opened file, the file is opened. You don't have to open it,
Since the number of times the file is opened can be reduced, it is possible to improve the CPU usage efficiency by the thread parallel operation.

【0050】さらに、本実施形態のマルチスレッド・プ
ログラムにおけるファイル書込方式では、同一のファイ
ルハンドルが示すファイルを使用しているスレッドの数
が2つ以上のとき、あるスレッドがファイルのクローズ
動作を行っても、他にこのファイルを使用しているスレ
ッドがあれば、ファイルがクローズされないため、ファ
イルのクローズ回数を減らせるので、スレッド並行動作
によるCPU使用効率を向上させることができる。
Further, in the file writing method in the multi-thread program of the present embodiment, when the number of threads using the file indicated by the same file handle is two or more, a thread closes the file. Even if it goes, if there are other threads using this file, the file is not closed, so the number of times the file is closed can be reduced, so that it is possible to improve the CPU usage efficiency by the thread parallel operation.

【0051】以上、本発明の一実施形態を図面を参照し
て詳述してきたが、具体的な構成はこの実施形態に限ら
れるものではなく、本発明の要旨を逸脱しない範囲の設
計変更等があっても本発明に含まれる。
Although one embodiment of the present invention has been described in detail above with reference to the drawings, the specific configuration is not limited to this embodiment, and design changes within the scope not departing from the gist of the present invention. Even so, it is included in the present invention.

【0052】[0052]

【発明の効果】オープンされているファイルのファイル
名と、前記ファイルを示すファイルハンドルと、このフ
ァイルを使用している前記スレッドを示すスレッドID
との関係を示す表を記憶するファイル情報保持部と、前
記スレッドの制御によりオープンするファイルのファイ
ル名、及びこのスレッドを示すスレッドIDを出力する
ファイルオープン手段と、前記スレッドの制御によりこ
のスレッドを示すスレッドID及びクローズするファイ
ルに対応するファイルハンドルを出力するファイルクロ
ーズ手段と、前記ファイルオープン手段からスレッドを
識別するスレッドID及びオープンするファイルのファ
イル名が入力されたとき、前記ファイルに対応する前記
ファイルハンドルを取得し、このスレッドID及びこの
ファイル名に関連させてこのファイルハンドルを前記フ
ァイル情報保持部へ記憶させ、前記ファイルクローズ手
段からスレッドを識別するスレッドID及びクローズす
るファイルに対応するファイルハンドルが入力されたと
き、ファイル情報保持部からこのファイルハンドル及び
このファイルハンドルに対応するファイル名,スレッド
IDを除去するファイル開閉排他制御手段と、前記スレ
ッドの制御によりこのスレッドを示すスレッドID、書
き込みを行うファイルを示すファイルハンドル及びこの
ファイルに書込むデータを出力するデータ書込み手段
と、前記データ書込み手段から入力されるスレッドI
D、ファイルハンドル及びファイルに書込むデータを受
け取り、このファイルハンドルに対応するファイルの末
尾にこのデータを書込むファイル書込み排他制御手段と
を具備するため、排他制御を行っている間隔がファイル
情報保持部への参照/更新の間と、ファイルへの追加書
込みの間とのみであるので、ファイルをオープンしてか
らクローズするまでの間よりも時間が短いため、マルチ
スレッド・プログラムにおいて、共有資源であるファイ
ルへの追加書込みを行う場合、スレッド並行動作による
CPU使用効率を向上させることが可能である。
The file name of the opened file, the file handle indicating the file, and the thread ID indicating the thread using the file
And a file information holding unit that stores a table indicating the relationship between the thread name, a file name of a file that is opened under the control of the thread, and a file opening unit that outputs a thread ID indicating the thread, and a thread that controls the thread. When the thread ID for identifying the thread and the file name of the file to be opened are input from the file opening means, the file closing means for outputting the thread ID and the file handle corresponding to the file to be closed, and the file corresponding to the file Acquires a file handle, stores this file handle in the file information holding unit in association with this thread ID and this file name, and supports the thread ID for identifying the thread from the file closing means and the file to be closed. File opening / closing exclusive control means for removing this file handle, the file name corresponding to this file handle, and the thread ID from the file information holding unit when the file handle is input, and the thread ID indicating this thread under the control of the thread. , A file handle indicating a file to be written, data writing means for outputting data to be written in the file, and a thread I input from the data writing means
D, a file handle, and file write exclusive control means for receiving the data to be written in the file and writing this data at the end of the file corresponding to this file handle, so that the interval at which exclusive control is performed holds the file information. Since it is only between the reference / update to the part and the additional write to the file, the time is shorter than the time between opening and closing the file. When performing additional writing to a certain file, it is possible to improve the CPU usage efficiency by the thread parallel operation.

【0053】また、本発明によれば、ファイル開閉排他
制御手段が、既にオープンされているファイルが存在す
るとき、そのファイルのファイルハンドルを返すため、
ファイルをオープンさせる処理を行う必要が無く、ファ
イルのオープン回数が減少し、かつ、同一のファイルハ
ンドルが示すファイルを使用しているスレッドの数が2
つ以上のとき、あるスレッドがファイルのクローズ動作
を行っても、他にこのファイルを使用しているスレッド
があれば、ファイルがクローズされないので、ファイル
のクローズ回数が減少するためスレッドの動作時間を短
縮させることが可能である。
Further, according to the present invention, the file open / close exclusive control means returns the file handle of the file when the file already opened exists.
There is no need to open the file, the number of times the file is opened is reduced, and the number of threads using the file indicated by the same file handle is 2
If one thread performs a file close operation when there are more than two files, the file will not be closed if there are other threads that are using this file. It can be shortened.

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

【図1】 本発明の一実施形態によるマルチスレッド・
プログラムにおけるファイル書込方式の構成を示すブロ
ック図である。
FIG. 1 illustrates a multi-threaded thread according to an embodiment of the present invention.
It is a block diagram which shows the structure of the file writing system in a program.

【図2】 図1におけるファイル情報保持部8のデータ
構成を示す概念図である。
FIG. 2 is a conceptual diagram showing a data structure of a file information holding unit 8 in FIG.

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

1 スレッドの指示部 2 ファイル 3 ファイルオープン手段 4 ファイルクローズ手段 5 データ書込み手段 6 ファイル開閉排他制御手段 7 ファイル書込み排他制御手段 8 ファイル情報保持部 9 ファイル名欄 10 ファイルハンドル欄 11 スレッド毎情報欄 12,13,14 スレッドID欄 1 Thread instruction part 2 files 3 File open means 4 File closing means 5 Data writing means 6 File open / close exclusive control means 7 File write exclusive control means 8 File information storage 9 File name column 10 File handle column 11 Thread information field 12, 13, 14 Thread ID column

───────────────────────────────────────────────────── フロントページの続き (58)調査した分野(Int.Cl.7,DB名) G06F 9/46 G06F 12/00 ─────────────────────────────────────────────────── ─── Continuation of the front page (58) Fields surveyed (Int.Cl. 7 , DB name) G06F 9/46 G06F 12/00

Claims (4)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 複数のスレッドから構成されるマルチス
レッド・プログラムにおけるファイル書込方式におい
て、 オープンされているファイルのファイル名と、前記ファ
イルを示すファイルハンドルと、このファイルを使用し
ている前記スレッドを示すスレッドIDとの関係を示す
表を記憶するファイル情報保持部と、 前記スレッドの制御によりオープンするファイルのファ
イル名、及びこのスレッドを示すスレッドIDを出力す
るファイルオープン手段と、 前記スレッドの制御によりこのスレッドを示すスレッド
ID及びクローズするファイルに対応するファイルハン
ドルを出力するファイルクローズ手段と、 前記ファイルオープン手段からスレッドを識別するスレ
ッドID及びオープンするファイルのファイル名が入力
されたとき、前記ファイルに対応する前記ファイルハン
ドルを取得し、このスレッドID及びこのファイル名に
関連させてこのファイルハンドルを前記ファイル情報保
持部へ記憶させ、前記ファイルクローズ手段からスレッ
ドを識別するスレッドID及びクローズするファイルに
対応するファイルハンドルが入力されたとき、ファイル
情報保持部からこのファイルハンドル及びこのファイル
ハンドルに対応するファイル名,スレッドIDを除去す
るファイル開閉排他制御手段と、 前記スレッドの制御によりこのスレッドを示すスレッド
ID、書き込みを行うファイルを示すファイルハンドル
及びこのファイルに書込むデータを出力するデータ書込
み手段と、 前記データ書込み手段から入力されるスレッドID、フ
ァイルハンドル及びファイルに書込むデータを受け取
り、このファイルハンドルに対応するファイルの末尾に
このデータを書込むファイル書込み排他制御手段とを具
備することを特徴とするマルチスレッド・プログラムに
おけるファイル追加書込み方式。
1. In a file writing method in a multi-thread program including a plurality of threads, a file name of an open file, a file handle indicating the file, and the thread using the file A file information holding unit that stores a table that shows the relationship with the thread ID that indicates the thread, a file name of a file that is opened under the control of the thread, and a file opening unit that outputs the thread ID that indicates this thread, and the thread control By the file closing means for outputting the thread ID indicating this thread and the file handle corresponding to the file to be closed, and when the thread ID for identifying the thread and the file name of the file to be opened are input from the file opening means, The file handle corresponding to a file is acquired, the file handle is stored in the file information holding unit in association with the thread ID and the file name, and the thread ID for identifying the thread from the file closing unit and the file to be closed When a file handle corresponding to is input, this file handle, a file name corresponding to this file handle, and a file open / close exclusive control means for removing the thread ID from the file information holding unit, and this thread is indicated by the control of the thread. A thread ID, a file handle indicating a file to be written, and data writing means for outputting data to be written to this file; and a thread ID, a file handle and data to be written to the file, which are input from the data writing means. Receiving, file additional writing method in a multi-threaded program that the end of the file corresponding to the file handle, characterized by comprising a file write exclusive control means for writing the data.
【請求項2】 前記ファイル開閉排他制御手段が、前記
ファイル名が記載されている前記ファイル情報保持部に
おけるファイル名の参照/更新を、前記ファイル情報保
持部に記憶されている前記スレッドID及び前記ファイ
ルハンドルに基づき排他制御し、前記ファイルのオープ
ン及びクローズを制御することを特徴とする請求項1記
載のマルチスレッド・プログラムにおけるファイル追加
書込み方式。
2. The file opening / closing exclusive control means refers to / updates the file name in the file information holding unit in which the file name is written, and refers to the thread ID and the thread ID stored in the file information holding unit. The additional file writing method in the multi-thread program according to claim 1, wherein exclusive control is performed based on a file handle to control opening and closing of the file.
【請求項3】 前記ファイル開閉排他制御手段が、前記
ファイルオープン手段からスレッドID及びファイル名
を受け取り、ファイル情報保持部を参照して、このファ
イル名がファイル情報保持部にないことを検出すると、
このファイル名に対応するファイルをオープンし、ファ
イルハンドル及びスレッド毎情報をファイル情報保持部
に記憶してファイルハンドルを返し、またこのファイル
名のファイル名がファイル情報保持部にあることを検出
すると、ファイルオープンの処理を行わず、スレッドI
Dをファイル情報保持部に記憶してファイルハンドルを
前記ファイルオープン手段へ出力し、また、前記ファイ
ルクローズ手段から前記スレッドID及び前記ファイル
ハンドルを受け取ったとき、ファイル情報保持部を参照
してこのスレッドIDを削除し、他にスレッドIDが全
く存在しない場合ファイルをクローズし、ファイルハン
ドルを前記ファイルクローズ手段へ出力し、他にスレッ
ドIDが全く存在しない場合、ファイルをクローズせず
にファイルハンドルを前記ファイルクローズ手段へ出力
することを特徴とする請求項1または請求項2記載のマ
ルチスレッド・プログラムにおけるファイル追加書込み
方式。
3. The file opening / closing exclusive control unit receives the thread ID and the file name from the file opening unit, refers to the file information holding unit, and detects that this file name is not in the file information holding unit.
When the file corresponding to this file name is opened, the file handle and the information for each thread are stored in the file information holding unit and a file handle is returned, and it is detected that the file name of this file name exists in the file information holding unit, File I is not processed and thread I
D is stored in the file information holding unit, a file handle is output to the file opening unit, and when the thread ID and the file handle are received from the file closing unit, the thread is referred to by referring to the file information holding unit. If the ID is deleted and no other thread ID exists, the file is closed, the file handle is output to the file closing means, and if no other thread ID exists, the file handle is closed without closing the file. The file additional writing method in the multi-thread program according to claim 1 or 2, wherein the file is output to a file closing means.
【請求項4】 前記ファイル書込み排他制御手段が、前
記ファイルをオープンしているスレッド以外の前記スレ
ッドの前記ファイルへのデータの書込みを、前記ファイ
ル情報保持部に記憶されている前記スレッドID及び前
記ファイルハンドルに基づき排他制御することを特徴と
する請求項1ないし請求項3のいずれかに記載のマルチ
スレッド・プログラムにおけるファイル追加書込み方
式。
4. The file write exclusive control means writes the data to the file of the thread other than the thread that has opened the file, the thread ID and the thread ID stored in the file information holding unit. The file additional writing method in the multi-thread program according to any one of claims 1 to 3, wherein exclusive control is performed based on a file handle.
JP05944199A 1999-03-05 1999-03-05 File writing method in multi-thread program Expired - Fee Related JP3511935B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP05944199A JP3511935B2 (en) 1999-03-05 1999-03-05 File writing method in multi-thread program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP05944199A JP3511935B2 (en) 1999-03-05 1999-03-05 File writing method in multi-thread program

Publications (2)

Publication Number Publication Date
JP2000259432A JP2000259432A (en) 2000-09-22
JP3511935B2 true JP3511935B2 (en) 2004-03-29

Family

ID=13113388

Family Applications (1)

Application Number Title Priority Date Filing Date
JP05944199A Expired - Fee Related JP3511935B2 (en) 1999-03-05 1999-03-05 File writing method in multi-thread program

Country Status (1)

Country Link
JP (1) JP3511935B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4241485B2 (en) 2004-04-15 2009-03-18 ソニー株式会社 Information processing apparatus, information processing method, program, and recording medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000194574A (en) 1998-12-28 2000-07-14 Nec Corp Asynchronous input/output system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000194574A (en) 1998-12-28 2000-07-14 Nec Corp Asynchronous input/output system

Also Published As

Publication number Publication date
JP2000259432A (en) 2000-09-22

Similar Documents

Publication Publication Date Title
RU2433453C2 (en) Optimising software transactional memory operations
CN101542437B (en) Optimization of software transactional memory operations
US7653791B2 (en) Realtime-safe read copy update with per-processor read/write locks
US20090006403A1 (en) Efficiently boosting priority of read-copy update readers while resolving races with exiting and unlocking processes
CN101446918B (en) Method for realizing debugging of single function by user state debugger and system thereof
JP2001147819A (en) Optimization device and recording medium
JP2010524133A (en) Transactional memory using buffered writes and forced serialization order
JPH1131081A (en) Method and computer system for performing thread synchronization in an object-based system and computer program product therefor
JPH1115726A (en) Computer control method, apparatus, system, and computer program product
JPH04229355A (en) Data access method and data processing system
JPH06187232A (en) Control method of access management of common data
JP3511935B2 (en) File writing method in multi-thread program
US10209997B2 (en) Computer architecture for speculative parallel execution
JPH04139545A (en) Data base updating processing system
US10049127B1 (en) Meta-transactional synchronization
JPH04260947A (en) Method for access processing of shared file
JPS63173144A (en) Control system for actual time garbage collection
Liu et al. Improvement Based on Data Version Management in TM
JPH03255533A (en) Symbol managing system in programming language processing system
JPS63109540A (en) Inter-process communication control system
JPH05165756A (en) Channel controller with macro processing function

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20031216

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20031229

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080116

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090116

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100116

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees