JP2012113487A - Multithread processor - Google Patents
Multithread processor Download PDFInfo
- Publication number
- JP2012113487A JP2012113487A JP2010261361A JP2010261361A JP2012113487A JP 2012113487 A JP2012113487 A JP 2012113487A JP 2010261361 A JP2010261361 A JP 2010261361A JP 2010261361 A JP2010261361 A JP 2010261361A JP 2012113487 A JP2012113487 A JP 2012113487A
- Authority
- JP
- Japan
- Prior art keywords
- access
- thread
- processing
- task
- instruction
- 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
Links
Images
Landscapes
- Multi Processors (AREA)
Abstract
Description
本発明は、複数のスレッドが各自に処理を行うマルチスレッド処理装置に関し、特に、複数のスレッドによりハードウエア・マルチスレッディング処理を行うマルチスレッド処理装置に関する。 The present invention relates to a multi-thread processing apparatus in which a plurality of threads perform processing on each of them, and particularly to a multi-thread processing apparatus that performs hardware multi-threading processing by a plurality of threads.
近年、プロセッサの性能向上に伴い、複数の機能を一つのプロセッサにより実現させるための技術が研究・実用化されている。例えば、車両に搭載される車載制御装置の分野では、ある車載機器を制御する制御装置と他の車載機器を制御する制御装置(例えば変速機の制御装置とエンジンの制御装置等)を統合して、コンピュータ・ハードウエアを縮小し、コストや重量の低減を図る動きが見られる。 In recent years, techniques for realizing a plurality of functions by a single processor have been researched and put into practical use as the performance of the processor has been improved. For example, in the field of in-vehicle control devices mounted on vehicles, a control device that controls a certain in-vehicle device and a control device that controls other in-vehicle devices (for example, a transmission control device and an engine control device) are integrated. There is a trend to reduce computer hardware and reduce costs and weight.
こうしたハードウエア統合の一手法として、ハードウエア・マルチスレッディング処理と称されるものが知られている。ハードウエア・マルチスレッディング処理は、命令バッファや演算結果の格納場所(レジスタ)等を異にする複数のスレッドが、命令デコーダや演算回路等のハードウエアの一部を共有して処理を行なうものである。 One method of hardware integration is known as hardware multithreading processing. In hardware multithreading processing, multiple threads with different instruction buffers and operation result storage locations (registers) share part of the hardware such as instruction decoders and arithmetic circuits. .
ハードウエア・マルチスレッディング処理を行うマルチスレッド処理装置には、通常のコンピュータと同様、RAM等の記憶装置やI/O等のアクセス対象が存在する。こうしたアクセス対象には、一のスレッドのみがアクセス可能となるように制御される。このため、複数のスレッドが、時分割で並行処理している最中に同一のアクセス対象にアクセスしようとした場合、後にアクセス要求を出したスレッドが処理待ち状態となる。このため、処理待ち状態となったスレッドに対して供給されるクロックが無駄となる場合があった。 A multi-thread processing device that performs hardware multi-threading processing includes a storage device such as a RAM and an access target such as an I / O, as in a normal computer. Such an access target is controlled so that only one thread can access it. For this reason, when a plurality of threads try to access the same access target while performing parallel processing in a time-sharing manner, the thread that issued an access request later enters a processing wait state. For this reason, there is a case where the clock supplied to the thread waiting for processing is wasted.
一方、特許文献1には、上位装置からのライト命令に対応して下位装置であるディスクドライブ装置に対しライト命令のタスクを実行するディスクコントローラについて記載されている。このディスクコントローラでは、ライト命令の実行中のエラーを発見したときに、優先度の高い代替処理用タスクを発生させて、エラー処理を行わせるものとしている。
On the other hand,
しかしながら、上記特許文献1に記載のディスクコントローラは、エラーが発生した場合にのみ代替処理を発生させるため、エラーが発生しない通常処理状態において、処理効率を向上させることができない。
However, since the disk controller described in
また、上記特許文献1に記載のディスクコントローラにおける時分割マルチタスクシステムは、そもそもハードウエア・マルチスレッディングを前提としていない上、代替処理用タスクは、あくまでエラー処理を行うものであり、ハードウエア・マルチスレッディング処理を行うマルチスレッド処理装置において共有アクセス対象へのアクセスを代替処理するものではない。
In addition, the time division multitask system in the disk controller described in
本発明はこのような課題を解決するためのものであり、処理効率を向上させることが可能なマルチスレッド処理装置を提供することを、主たる目的とする。 The present invention is for solving such problems, and a main object of the present invention is to provide a multithread processing apparatus capable of improving the processing efficiency.
上記目的を達成するための本発明の一態様は、
複数のスレッドによりハードウエア・マルチスレッディング処理が行われるマルチスレッド処理装置であって、
前記複数のスレッドは、特定の共有アクセス対象へのアクセス処理を行う際には、該特定の共有アクセス対象へのアクセス処理を行う専用スレッドに、前記特定の共有アクセス対象へのアクセス処理の代行を依頼することを特徴とする、
マルチスレッド処理装置である。
In order to achieve the above object, one embodiment of the present invention provides:
A multi-thread processing device in which hardware multi-threading processing is performed by a plurality of threads,
When the plurality of threads perform an access process to a specific shared access target, a proxy thread that performs the access process to the specific shared access target is delegated to the specific shared access target. It is characterized by requesting,
A multi-thread processing device.
この本発明の一態様によれば、特定の共有アクセス対象へのアクセス処理を行う際には、該特定の共有アクセス対象へのアクセス処理を行う専用スレッドに、アクセス処理の代行を依頼するため、アクセス処理の代行を依頼したスレッドは、当該アクセス処理が終了するまでの間、他の一般処理を行うことができる。この結果、処理効率を向上させることができる。 According to this aspect of the present invention, when performing access processing to a specific shared access target, a dedicated thread that performs access processing to the specific shared access target is requested to perform access processing proxy. The thread that has requested access processing proxy can perform other general processing until the access processing ends. As a result, the processing efficiency can be improved.
本発明の一態様において、
前記複数のスレッドは、前記専用スレッドに前記特定の共有アクセス対象へのアクセス処理の代行を依頼する際に、前記専用スレッドが起動していない場合には前記専用スレッドの起動指示を行うと共に前記アクセス処理の代行に係るタスクの追加を行い、前記専用スレッドが起動している場合には前記アクセス処理の代行に係るタスクの追加を行うことを特徴とするものとしてもよい。
In one embodiment of the present invention,
The plurality of threads, when requesting the dedicated thread to perform access processing for the specific shared access target, if the dedicated thread is not activated, instructs the dedicated thread to start and the access It is also possible to add a task related to a proxy for processing and add a task related to the proxy for the access processing when the dedicated thread is activated.
また、本発明の一態様において、
前記複数のスレッド、及び前記専用スレッドに対する実行時間の割り当て比率を変更可能であることを特徴とするものとすると、好適である。
In one embodiment of the present invention,
It is preferable that the allocation ratio of execution time to the plurality of threads and the dedicated thread can be changed.
こうすれば、代行依頼されるアクセス処理が、どの程度の実行時間を要するのかに応じて、複数のスレッド、及び専用スレッドに対する実行時間の割り当て比率を適切に決定することができる。 By doing this, it is possible to appropriately determine the allocation ratio of execution time to a plurality of threads and dedicated threads according to how much execution time is required for the access process requested for the substitution.
この場合、
前記実行時間の割り当て比率の変更は、前記複数のスレッドのうち、前記特定の共有アクセス対象へのアクセス処理の代行を依頼するスレッドによって行われることを特徴とするものとすると、更に好適である。代行依頼されるアクセス処理が、どの程度の実行時間を要するのかを最もよく把握しているのは、当該代行依頼を行うスレッドだからである。
in this case,
It is more preferable that the change of the execution time allocation ratio is performed by a thread that requests substitution of access processing to the specific shared access target among the plurality of threads. It is the thread that makes the proxy request that best understands how long the access process requested by the proxy requires.
本発明によれば、処理効率を向上させることが可能なマルチスレッド処理装置を提供することができる。 According to the present invention, it is possible to provide a multithread processing apparatus capable of improving processing efficiency.
以下、本発明を実施するための形態について、添付図面を参照しながら実施例を挙げて説明する。 DESCRIPTION OF EMBODIMENTS Hereinafter, embodiments for carrying out the present invention will be described with reference to the accompanying drawings.
以下、図面を参照し、本発明の一実施例に係るマルチスレッド処理装置1について説明する。
A
[構成]
図1は、本発明の一実施例に係るマルチスレッド処理装置1のシステム構成例である。マルチスレッド処理装置1は、主要な構成として、プログラムメモリ10と、命令フェッチバス15と、命令フェッチユニット20と、命令バッファ22#1〜22#nと、命令デコーダ24と、命令発行部26と、レジスタ28#1〜28#nと、演算器30と、LSU32と、制御装置40と、特定共有アクセス対象50と、データバス55と、を備える。
[Constitution]
FIG. 1 is a system configuration example of a
なお、本実施例では、二以上の任意の数であるスレッド数(後述するアクセス専用スレッドを含む)がnであるとし、「#」の後の数字がスレッドナンバーを示すものとする。また、図1に示す構成は、ハードウエア・マルチスレッディング処理を行うための一般的な構成を例示したものであり、ハードウエア・マルチスレッディング処理を行うことが可能な構成であれば、任意の構成要素を置換、削除、追加等してよい。 In this embodiment, it is assumed that the number of threads (including an access dedicated thread described later) that is an arbitrary number of 2 or more is n, and the number after “#” indicates the thread number. The configuration shown in FIG. 1 exemplifies a general configuration for performing hardware multithreading processing, and any configuration element can be used as long as it can perform hardware multithreading processing. Replace, delete, add, etc.
ハードウエア・マルチスレッディング処理とは、複数のスレッドが、命令デコーダや演算回路等のハードウエアの一部を共有して処理を行なうものである。スレッドとは、ハードウエアを部分的に共有して処理を行なう仮想的な処理主体をいう。本実施例では、命令バッファやレジスタはスレッド毎に用意されているが、その他の構成要素はスレッド間で共用されるものとする。 The hardware multithreading process is a process in which a plurality of threads share a part of hardware such as an instruction decoder and an arithmetic circuit. A thread is a virtual processing entity that performs processing while partially sharing hardware. In this embodiment, an instruction buffer and a register are prepared for each thread, but other components are shared between threads.
プログラムメモリ10は、例えばフラッシュROM(Read Only Memory)であり、各スレッドが実行するプログラム(命令列)を格納する。プログラムメモリ10は、命令フェッチユニット20から命令の格納場所を示すアドレスが入力されると、当該アドレスに格納された命令を出力する。
The
命令フェッチユニット20は、スレッド毎のプログラムカウンタを内蔵し、命令フェッチバス15を介してプログラムメモリ10から命令をフェッチし、命令バッファ22#1〜22#nのうち、スレッドに対応した命令バッファに格納する。
The
すなわち、スレッド#1が実行する命令をフェッチした場合は命令バッファ22#1に命令を格納し、スレッド#2が実行する命令をフェッチした場合は命令バッファ22#2に命令を格納する。
That is, when an instruction executed by
命令バッファ22#1〜22#nは、例えばFIFO(First In, First Out)に従って命令を入出力するように制御される。
The
命令デコーダ24は、いずれかの命令バッファから供給される命令を解読(デコード)し、命令発行部26に出力する。命令デコーダ24による解読結果は、例えば、演算の種別、ソースオペランド、結果の格納場所等である。
The
命令発行部26は、命令デコーダ24から入力された命令に従ってレジスタ28#1〜28#nから演算対象値等を取得し、演算器30やLSU32に出力する。
The instruction issuing
演算器30は、スレッドの要求に応じて、四則演算その他の演算処理を行う。一方、LSU32は、スレッドの要求に応じて、ストア命令やロード命令を実行する。
The
制御装置40は、これらの動作全体を制御する。具体的には、内部クロックの立ち上がり等に応じて、命令フェッチユニット20、命令デコーダ24、命令発行部26、演算器30、LSU32等を作動させる。
The
また、制御装置40は、スレッドの切り替えを制御している。例えば、スレッド#1の処理を1クロック分行わせると、次にスレッド#2の処理を1クロック分行わせ、次にスレッド#1の処理を1クロック分行わせる等の切り替え制御を行っている。これらのスレッド処理時間の割り当ては、任意に設定することが可能であり、制御装置40は、その設定状態を保持するための設定保持用レジスタ42を内蔵するものとしてよい。
The
特定共有アクセス対象50は、データバス55を介してLSU32等によりアクセスされる特定の機器群であり、例えばEEPROM(Electrically Erasable and Programmable Read Only Memory)やRAM(Random Access Memory)等のデータメモリ、I/O、CAN(Controller Area Network)コントローラ等が該当し得る。I/Oとは、例えばI/Oポートやその制御装置を含む。
The specific shared
[アクセス代行依頼]
本実施例におけるスレッドは、複数のタスク(ある程度の機能的まとまりを有する命令群をいう)を、並行して、或いは所望の順序で実行可能となっている。
[Access proxy request]
The thread in this embodiment is capable of executing a plurality of tasks (indicating a group of instructions having a certain functional unit) in parallel or in a desired order.
ところで、スレッドが実行するタスクには、演算器30による演算を行ってレジスタ28#1〜28#nに格納する等、処理時間が比較的短く、且つデータバス55に対するアクセスを含まないものと、データバス55を介して特定共有アクセス対象50にアクセスする、処理時間の比較的長いものとが混在する。
By the way, the tasks executed by the thread include operations that are relatively short in processing time and do not include access to the data bus 55, such as performing calculations by the
本実施例におけるスレッドは、特定共有アクセス対象50へのアクセス処理を行う際には、特定共有アクセス対象50へのアクセス処理を行う専用スレッドに、アクセス処理の代行を依頼する。以下、係る専用スレッドを「アクセス専用スレッド」と称する。
When performing the access process to the specific shared
なお、図1では示していないが、特定共有アクセス対象50以外にも、データバス55その他のバスを介してアクセスするアクセス対象(以下、「非特定アクセス対象」と称する)が存在してもよく、この非特定アクセス対象について各スレッドは、アクセス専用スレッドにアクセス処理の代行を依頼しないものとしてよい。
Although not shown in FIG. 1, in addition to the specific shared
非特定アクセス対象が存在する場合、種々のアクセス対象を、特定共有アクセス対象50と非特定アクセス対象のいずれとして扱うかは、システムの仕様に応じて任意に決定してよい。
When there are non-specific access targets, it may be arbitrarily determined depending on the system specifications whether to handle various access targets as the specific shared
図2は、スレッド#1、#2、及びアクセス専用スレッド#kが、それぞれ複数のタスクを実行している状態を模式的に示す図である。本図においてスレッド#1により実行されるタスク10、及びスレッド#2により実行されるタスク21は、特定共有アクセス対象50へのアクセス処理であり、スレッド#1により実行されるタスク11、及びスレッド#2により実行されるタスク20は、特定アクセス処理以外の処理である。以下、特定共有アクセス対象50へのアクセス処理を「特定アクセス処理」と称し、それ以外の処理を「一般処理」と称する。一般処理は、上記非特定アクセス対象へのアクセス処理を含むものとしてもよいし、含まないものとしてもよい。
FIG. 2 is a diagram schematically showing a state in which the
図2において、破線矢印は、従来のマルチスレッド処理装置におけるデータアクセスを示している。従来のマルチスレッド処理では、各スレッドが独自に特定共有アクセス対象50へのアクセス処理を行っていた。このため、後述するように、無駄なクロックがスレッドに割り当てられ、処理効率が低下する場合があった。
In FIG. 2, broken line arrows indicate data access in the conventional multithread processing apparatus. In conventional multithread processing, each thread independently performs access processing to the specific shared
これに対し、本実施例のマルチスレッド処理装置では、アクセス専用スレッドでない各スレッドは(以下、「各スレッド」と表記した場合、アクセス専用スレッドを除外するものとする)、特定共有アクセス対象50へのアクセス処理を行う際にはアクセス専用スレッド#kにアクセス処理の代行を依頼し、アクセス専用スレッド#kのみが特定共有アクセス対象50へのアクセス処理を行うように制御される。図2における実線は、本実施例のマルチスレッド処理装置1におけるデータアクセスを示している。
On the other hand, in the multi-thread processing apparatus of this embodiment, each thread that is not an access dedicated thread (hereinafter referred to as “each thread” excludes an access dedicated thread) is transferred to the specific shared
この結果、アクセス処理の代行を依頼したスレッドは、当該アクセス処理が終了するまでの間、他の一般処理を行うことができる。従って、処理効率を向上させることができる。 As a result, the thread that requested access processing proxy can perform other general processing until the access processing ends. Therefore, processing efficiency can be improved.
[処理フロー]
以下、各スレッドがアクセス専用スレッド#kにアクセス処理の代行を依頼する際の処理の流れ、及びアクセス専用スレッド#kにおける処理の流れについて説明する。
[Processing flow]
Hereinafter, the flow of processing when each thread requests the access dedicated thread #k to perform access processing proxy and the flow of processing in the access dedicated thread #k will be described.
図3は、各スレッドが、アクセス専用スレッド#kにアクセス処理の代行を依頼する際の処理の流れを示すフローチャートである。本フローは、各スレッドが特定共有アクセス対象50にアクセスしようとするタイミングで開始される。
FIG. 3 is a flowchart showing the flow of processing when each thread requests the access dedicated thread #k to perform access processing proxy. This flow is started when each thread tries to access the specific shared
まず、各スレッドは、アクセス専用スレッド#kが起動済みであるか否かを判定する(S100)。 First, each thread determines whether or not the access dedicated thread #k has been activated (S100).
アクセス専用スレッドが起動済みでない場合は、アクセス専用スレッド#kを起動するように制御装置40に指示する(S102)。
If the access dedicated thread has not been activated, the
そして、自スレッド用のアクセス処理タスクを追加するようにアクセス専用スレッド#kに通知する(S104)。 Then, the access dedicated thread #k is notified to add an access processing task for the own thread (S104).
このように、各スレッドは、アクセス専用スレッド#kが起動済みでない場合はアクセス専用スレッド#kの起動及びタスクの追加を指示し、アクセス専用スレッド#kが既に起動済みである場合はタスクの追加のみを指示する。 In this way, each thread instructs activation of the access dedicated thread #k and addition of a task when the access dedicated thread #k has not been activated, and adds a task when the access dedicated thread #k has already been activated. Only instruct.
図4は、アクセス専用スレッド#kにより実行される処理の流れを示すフローチャートである。本フローは、アクセス専用スレッド#kに動作クロックが割り当てられた度に繰り返し実行される。 FIG. 4 is a flowchart showing a flow of processing executed by the access dedicated thread #k. This flow is repeatedly executed every time an operation clock is assigned to the access dedicated thread #k.
まず、当該動作クロックにおいて、実行中のアクセス処理タスクが終了したか否かを判定する(S200)。当該動作クロックにおいて、実行中のアクセス処理タスクが終了しなかった場合は、本フローの1ルーチンを終了する。 First, it is determined whether or not the access processing task being executed is completed in the operation clock (S200). If the access processing task being executed has not ended in the operation clock, one routine of this flow is ended.
実行中のアクセス処理タスクが終了した場合は、別のアクセス処理タスクが待ち状態となっているか否かを判定する(S202)。別のアクセス処理タスクが待ち状態となっている場合は、当該アクセス処理タスクを終了し、次回のルーチンでは待ち状態となっているアクセス処理タスクを実行する(S204)。 When the access processing task being executed is completed, it is determined whether another access processing task is in a waiting state (S202). If another access processing task is in a waiting state, the access processing task is terminated, and the access processing task in a waiting state is executed in the next routine (S204).
ここで、アクセス処理タスクは、アクセス専用スレッドが有する待ちキュー等に格納され、FIFOに従って順に実行されるものとしてもよいが、各タスクからの割り込み指示によって即時実行されるように設定することもできる。 Here, the access processing task may be stored in a waiting queue or the like possessed by the access-dedicated thread and executed in order according to the FIFO. However, the access processing task may be set to be executed immediately in response to an interrupt instruction from each task. .
一方、別のアクセス処理タスクが待ち状態となっていない場合は、当該アクセス処理タスクを終了すると共に、アクセス専用スレッド#k自体を終了する(S206)。 On the other hand, if another access processing task is not in a waiting state, the access processing task is terminated and the access dedicated thread #k itself is terminated (S206).
この際に、アクセス専用スレッド#kを終了するのではなく、アイドルタスクとして存続させてもよい(クロック割り当てを非常に低くして存続させる)。こうすれば、アクセス専用スレッド#kの起動及び終了に要する時間や負荷等を低減することができる。 At this time, instead of ending the access dedicated thread #k, it may be continued as an idle task (clock allocation is kept very low). In this way, it is possible to reduce the time and load required for starting and ending the access dedicated thread #k.
[動作比率の変更]
また、本実施例のマルチスレッド処理装置1では、アクセス処理の代行依頼、或いはアクセス専用スレッドの起動及び終了に伴って、スレッドの動作比率を任意に変更することができる。例えば、アクセス処理の代行が発生する以前にスレッド#1とスレッド#2が1:1で動作していたところ、クロック割り当てを余り必要としないアクセス処理の代行依頼が発生した場合には、スレッド#1とスレッド#2とアクセス専用スレッド#kの動作比率を1:1:1に設定し、クロック割り当てを多く必要とするアクセス処理の代行依頼が発生した場合には、スレッド#1とスレッド#2とアクセス専用スレッド#kの動作比率を1:1:3に設定する等してよい。こうすれば、装置全体の処理効率を維持すると共に、処理の順序性を確保することが可能となる。
[Change operation ratio]
Further, in the
係る動作比率の設定は、例えば設定保持用レジスタ42の内容を書き換えることによって可能となる。設定される動作比率は、アクセス処理の代行依頼を行うスレッドから制御装置40に通知され、制御装置40において、直ちに当該アクセス処理の代行が行われるならば通知された動作比率に従って設定保持用レジスタ42の内容を書き換え、待ち状態となるならば当該アクセス処理の代行が行われるタイミングで通知された動作比率に従って設定保持用レジスタ42の内容を書き換える。
The operation ratio can be set by rewriting the contents of the
[動作比較]
以下、従来のマルチスレッド処理装置との動作の相違について説明する。ここでは、図2と同じ前提条件を用いる。すなわち、スレッド#1により実行されるタスク10、及びスレッド#2により実行されるタスク21は、特定共有アクセス対象50へのアクセス処理であり、スレッド#1により実行されるタスク11、及びスレッド#2により実行されるタスク20は、特定アクセス処理以外の一般処理である。なお、従来のマルチスレッド処理装置においては「特定共有アクセス対象」等の概念は存在しないが、ここでは同列に記載するものとする。図5〜図10において、「指1」、「指2」と表記されている部分は、Write指示等の指示が行われることを示している。また、上線が付された数字で表記されている部分は、クロック時間の消費(単位は半クロック)を示している。また、「遊」と表記されている部分は、CPU処理が無駄に消費されていることを示している。すなわち、遊びクロックである。
[Operation comparison]
The difference in operation from the conventional multithread processing apparatus will be described below. Here, the same preconditions as in FIG. 2 are used. That is, the
(クロック割り当ての必要性が低いアクセスに関して)
図5〜図7は、特定共有アクセス対象50がEEPROMやI/Oである場合のように、外部ペリフェラルの実行時間においてCPUの処理を必要としない時間が生じる場合の動作例、すなわち、アクセス処理タスクの実行に対するクロック割り当てを余り多くする必要がない場合の動作例を示している。
(For access with low clock allocation requirement)
5 to 7 show an operation example in the case where a time not requiring the CPU processing occurs in the execution time of the external peripheral as in the case where the specific shared
より具体的には、図5〜7では、タスク10、21がEEPROM(図5〜7では「E2P」と略記した)に書き込みを行い、タスク11、20が一般処理を行うものとする。EEPROMへの書き込みは、Write指示に2クロックを要する他、13クロック分の時間を消費するものとする。但し、当該13クロック分の時間内において、アクセス処理タスクによる処理は不要である。
More specifically, in FIGS. 5 to 7,
図5は、従来のマルチスレッド処理装置による動作例を示している。 FIG. 5 shows an operation example of a conventional multithread processing apparatus.
まず、時刻T0において、タスク10によるEEPROMへのアクセスが開始される。上記のように、Write指示と、13クロック分の時間経過をもって、時刻T2に書き込み処理が終了する。この期間において、他タスクによるRAMへのアクセスは禁止される(排他区間)。この書き込み処理の間にも、タスク10にクロックが割り当てられ続けるため、遊びクロックが13クロック分生じることになる。
First, at time T0, the
タスク10による書き込み処理の途中における時刻T1において、タスク21によるEEPROMへの書き込み要求がなされたものとする(図では「排他要求」と表記した)。この場合、タスク10による書き込み処理が終了するまでの間、タスク21は待ち状態となり、従って、スレッド#2全体が待ち状態となる。この待ち状態の間に、タスク21にクロックが割り当てられ続けるため、遊びクロックが10クロック分生じることになる。
Assume that a write request to the EEPROM by the
時刻T2に至ると、タスク21によるEEPROMへのアクセスが開始される。Write指示と、13クロック分の時間経過をもって、時刻T3に書き込み処理が終了する。この書き込み処理の間に、タスク21にクロックが割り当てられ続けるため、遊びクロックが13クロック分生じることになる。
When the time T2 is reached, the
ここでタスク11は一般処理であるため、タスク21と並行して実行可能である。このため、時刻T2〜T3の間、タスク11は実行されている。タスク20に関しては、タスク21の終了後に実行が開始される。
Here, since the task 11 is a general process, it can be executed in parallel with the
これらの結果、図5に示す動作例において、遊びクロックは合計36クロック分、生じたことになる。 As a result, in the operation example shown in FIG. 5, a total of 36 clocks are generated.
図6は、本実施例のマルチスレッド処理装置1による動作例を示している。
FIG. 6 shows an operation example by the
本図では、アクセス専用スレッド#kが起動した後の、スレッド#1、スレッド#2、アクセス専用スレッド#kのクロック割り当て比率は、1:1:1に設定されるものとする。
In this figure, it is assumed that the clock allocation ratio of the
まず、時刻T10において、スレッド#1によりアクセス専用スレッドの起動指示、及び自己のためのアクセス処理タスク10*を追加するように指示がなされ、アクセス専用スレッド#kによるタスク10*がWrite指示を実行する。13クロック分の時間経過をもって、時刻T12に書き込み処理が終了する。この書き込み処理の間に、タスク10*にクロックが割り当てられ続けるが、図5に比してクロック割り当て比率が低下しているため、遊びクロックは8クロック分しか生じないことになる。
First, at time T10, an instruction to start an access dedicated thread and an
時刻T10と時刻T12の間において、スレッド#1はタスク11を実行することができる。ここでは、9クロック分の処理を経てタスク11の実行が終了するものとする。
アクセス専用スレッドのタスク10*による書き込み処理の途中における時刻T11において、タスク21は、アクセス専用スレッド#kに対して、自己のためのアクセス処理タスク21*を追加するように指示する。この場合、タスク10*による書き込み処理が終了するまでの間、タスク21*は待ち状態となるが、スレッド#2は次のクロックから一般タスク20を開始することができる。ここでは、15クロック分の処理を経てタスク20の実行が終了するものとする。
At time T11 in the middle of the write process by the
時刻T12に至ると、タスク21*によるEEPROMへのアクセスが開始される。Write指示と、13クロック分の時間経過をもって、時刻T13に書き込み処理が終了する。この書き込み処理の間に、タスク21にクロックが割り当てられ続けるため、遊びクロックが8クロック分生じることになる。
When the time T12 is reached, access to the EEPROM by the
これらの結果、図6に示す動作例において、遊びクロックは合計16クロック分、生じたことになり、従来のマルチスレッド処理装置に比して遊びクロックの発生が抑制されている。また、処理結果の観点からも、時刻T3において従来のマルチスレッド処理装置はタスク20が漸く開始した状態であるのに対し、時刻T3とほぼ同時刻である時刻T13において、本実施例のマルチスレッド処理装置1は、タスク20の処理を終了している。
As a result, in the operation example shown in FIG. 6, a total of 16 idle clocks are generated, and the generation of idle clocks is suppressed as compared with the conventional multi-thread processing apparatus. Also, from the viewpoint of processing results, the conventional multithread processing apparatus is in a state where the
これらより、本実施例のマルチスレッド処理装置1では、図5に動作例を示した従来のマルチスレッド処理装置に比して、処理効率が向上していることが分かる。
From these, it can be seen that the processing efficiency is improved in the
図7は、本実施例のマルチスレッド処理装置1による他の動作例を示している。
FIG. 7 shows another operation example by the
本図では、アクセス専用スレッド#kが起動した後の、スレッド#1、スレッド#2、アクセス専用スレッド#kのクロック割り当て比率は、2:2:1に設定されるものとする。すなわち、アクセス専用スレッド#kに割り当てるクロック比率を図6の動作例に比して低下させている。
In this figure, it is assumed that the clock allocation ratio of the
この場合、図6の動作例と、処理の実行順はほぼ同じとなる。クロック割り当て比率が低下するタスク10*、21*の処理が終了する時刻は図6の動作例に比して若干遅くなるが、タスク11、20による処理に、より多くのクロックを割り当てることが可能となる(それぞれ10クロック、19クロック分の処理が可能である様子を図示した)。また、遊びクロックの発生は、図6の動作例に比して少なく、合計10クロック分となっている。
In this case, the processing execution order is almost the same as the operation example of FIG. The time at which the processing of
(クロック割り当ての必要性が高いアクセスに関して)
図8〜図10は、特定共有アクセス対象50がRAMである場合のように、書き込みや読み出しについてCPUの処理を必要とする場合の動作例、すなわち、アクセス処理タスクの実行にクロック割り当てを多く必要とする場合の動作例を示している。
(For access with high clock allocation requirement)
8 to 10 are examples of operations when CPU processing is required for writing and reading as in the case where the specific shared
より具体的には、図8〜10では、タスク10、21がRAMに書き込みを行い、タスク11、20が一般処理を行うものとする。RAMへの書き込みは、15クロック分の時間を消費するものとする。当該15クロック分の時間内においては、アクセス処理タスクによる処理が不要となる。
More specifically, in FIGS. 8 to 10,
図8は、従来のマルチスレッド処理装置による動作例を示している。 FIG. 8 shows an operation example of a conventional multithread processing apparatus.
まず、時刻T20において、タスク10によるRAMへのアクセスが開始される。上記のように、15クロック分の時間経過をもって、時刻T22に書き込み処理が終了する。この期間において、他タスクによるRAMへのアクセスは禁止される(排他区間)。
First, at time T20, access to the RAM by the
タスク10による書き込み処理の途中における時刻T21において、タスク21によるRAMへの書き込み要求がなされたものとする(図では「排他要求」と表記した)。この場合、タスク10による書き込み処理が終了するまでの間、タスク21は待ち状態となり、従って、スレッド#2全体が待ち状態となる。この待ち状態の間に、タスク21にクロックが割り当てられ続けるため、遊びクロックが10クロック分生じることになる。
It is assumed that a write request to the RAM by the
時刻T22に至ると、タスク21によるRAMへのアクセスが開始される。15クロック分の時間経過をもって、時刻T23に書き込み処理が終了する。
When the time T22 is reached, access to the RAM by the
ここでタスク11は一般処理であるため、タスク21と並行して実行可能である。このため、時刻T22〜T23の間、タスク11は実行されている。タスク20に関しては、タスク21の終了後に実行が開始される。
Here, since the task 11 is a general process, it can be executed in parallel with the
これらの結果、図8に示す動作例において、遊びクロックは合計10クロック分、生じたことになる。 As a result, in the operation example shown in FIG. 8, a total of 10 idle clocks are generated.
図9は、本実施例のマルチスレッド処理装置1による動作例を示している。
FIG. 9 shows an operation example by the
本図では、アクセス専用スレッド#kが起動した後の、スレッド#1、スレッド#2、アクセス専用スレッド#kのクロック割り当て比率は、1:1:2に設定されるものとする。
In this figure, it is assumed that the clock allocation ratio of the
まず、時刻T30において、スレッド#1によりアクセス専用スレッドの起動指示、及び自己のためのアクセス処理タスク10*を追加するように指示がなされ、アクセス専用スレッド#kによるタスク10*がRAMへの書き込みを開始する。15クロック分の時間経過をもって、時刻T32に書き込み処理が終了する。
First, at time T30, an instruction to start an access dedicated thread and an
時刻T30と時刻T32の間において、スレッド#1はタスク11を実行することができる。本図では、タスク11、20の実行に係るクロック数については省略する。
アクセス専用スレッドのタスク10*による書き込み処理の途中における時刻T31において、タスク21は、アクセス専用スレッド#kに対して、自己のためのアクセス処理タスク21*を追加するように指示する。この場合、タスク10*による書き込み処理が終了するまでの間、タスク21*は待ち状態となるが、スレッド#2は次のクロックから一般タスク20を開始することができる。
At time T31 in the middle of the writing process by the
時刻T32に至ると、タスク21*によるRAMへのアクセスが開始される。15クロック分の時間経過をもって、時刻T33に書き込み処理が終了する。
When the time T32 is reached, access to the RAM by the
これらの結果、図9に示す動作例において、遊びクロックは生じないため、従来のマルチスレッド処理装置に比して遊びクロックの発生が抑制されている。また、処理結果の観点からも、時刻T23において従来のマルチスレッド処理装置はタスク20が漸く開始した状態であるのに対し、時刻T23とほぼ同時刻である時刻T33において、本実施例のマルチスレッド処理装置1は、タスク20の処理を11クロック分終了している。
As a result, since no idle clock is generated in the operation example shown in FIG. 9, the generation of the idle clock is suppressed as compared with the conventional multi-thread processing apparatus. Also, from the viewpoint of processing results, the conventional multithread processing apparatus is in a state where the
これらより、本実施例のマルチスレッド処理装置1では、図8に動作例を示した従来のマルチスレッド処理装置に比して、処理効率が向上していることが分かる。
From these, it can be seen that the processing efficiency is improved in the
図10は、本実施例のマルチスレッド処理装置1による他の動作例を示している。
FIG. 10 shows another operation example by the
本図では、アクセス専用スレッド#kが起動した後の、スレッド#1、スレッド#2、アクセス専用スレッド#kのクロック割り当て比率は、1:1:4に設定されるものとする。すなわち、アクセス専用スレッド#kに割り当てるクロック比率を図9の動作例に比して低下させている。
In this figure, it is assumed that the clock allocation ratio of the
この場合、図9の動作例と、処理の実行順はほぼ同じとなる。タスク11、20の処理が終了する時刻は図9の動作例に比して若干遅くなるが、タスク10*、21*による処理に、より多くのクロックを割り当てることが可能となる。また、遊びクロックは、図9の動作例と同様、発生しない。
In this case, the execution order of processing is almost the same as the operation example of FIG. The time at which the processing of
また、図6、7の動作例と図9、10の動作例を比較すると、アクセス専用スレッドに割り当てられるクロックの比率が、図9、10の動作例の方が高くなっている。これは、書き込み等にクロックの割り当てが必要なアクセスと、そうでないアクセスでクロック割り当て比率を適切に設定している様子を示すものである。通常、実行されるアクセス処理においてクロック割り当てが多く必要であるか否かは、当該アクセス処理に係るタスクが把握しているため、前述のように、アクセス処理の代行依頼を行うスレッドから制御装置40にクロック割り当て比率が通知されると好適であるものとした。
Further, comparing the operation examples of FIGS. 6 and 7 with the operation examples of FIGS. 9 and 10, the ratio of clocks allocated to the access dedicated thread is higher in the operation examples of FIGS. This shows a state in which the clock allocation ratio is appropriately set for an access that requires clock allocation for writing or the like and an access that does not. Usually, the task related to the access process knows whether or not a large number of clock allocations are required in the access process to be executed. Therefore, as described above, the
[まとめ]
以上説明した本実施例のマルチスレッド処理装置1によれば、特定共有アクセス対象50へのアクセス処理を行う際には、特定共有アクセス対象50へのアクセス処理を行うアクセス専用スレッド#kに、アクセス処理の代行を依頼するため、アクセス処理の代行を依頼したスレッドは、当該アクセス処理が終了するまでの間、他の一般処理を行うことができる。この結果、処理効率を向上させることができる。
[Summary]
According to the
また、複数のスレッド#1…やアクセス専用スレッド#kに対する実行時間の割り当て比率を変更可能となっているため、代行依頼されるアクセス処理が、どの程度の実行時間を要するのかに応じて、複数のスレッド#1…やアクセス専用スレッド#kに対する実行時間の割り当て比率を適切に決定することができる。
In addition, since the execution time allocation ratio for the plurality of
更に、割り当て比率の決定は、代行依頼されるアクセス処理が、どの程度の実行時間を要するのかを最もよく把握している、当該代行処理を行うスレッドによってなされるため、実行時間の割り当て比率を、より適切に決定することができる。 Furthermore, since the determination of the allocation ratio is made by the thread that performs the proxy process that best knows how much execution time the access process requested for the proxy requires, the allocation ratio of the execution time is It can be determined more appropriately.
以上、本発明を実施するための最良の形態について実施例を用いて説明したが、本発明はこうした実施例に何等限定されるものではなく、本発明の要旨を逸脱しない範囲内において種々の変形及び置換を加えることができる。 The best mode for carrying out the present invention has been described above with reference to the embodiments. However, the present invention is not limited to these embodiments, and various modifications can be made without departing from the scope of the present invention. And substitutions can be added.
1 マルチスレッド処理装置
10 プログラムメモリ
15 命令フェッチバス
20 命令フェッチユニット
22#1〜22#n 命令バッファ
24 命令デコーダ
26 命令発行部
28#1〜28#n レジスタ
30 演算器
32 LSU
40 制御装置
50 特定共有アクセス対象
55 データバス
#1、#2、#k スレッド
DESCRIPTION OF
40
Claims (4)
前記複数のスレッドは、特定の共有アクセス対象へのアクセス処理を行う際には、該特定の共有アクセス対象へのアクセス処理を行う専用スレッドに、前記特定の共有アクセス対象へのアクセス処理の代行を依頼することを特徴とする、
マルチスレッド処理装置。 A multi-thread processing device in which hardware multi-threading processing is performed by a plurality of threads,
When the plurality of threads perform an access process to a specific shared access target, a proxy thread that performs the access process to the specific shared access target is delegated to the specific shared access target. It is characterized by requesting,
Multi-thread processing unit.
前記複数のスレッドは、前記専用スレッドに前記特定の共有アクセス対象へのアクセス処理の代行を依頼する際に、前記専用スレッドが起動していない場合には前記専用スレッドの起動指示を行うと共に前記アクセス処理の代行に係るタスクの追加を行い、前記専用スレッドが起動している場合には前記アクセス処理の代行に係るタスクの追加を行うことを特徴とする、
マルチスレッド処理装置。 The multi-thread processing apparatus according to claim 1,
The plurality of threads, when requesting the dedicated thread to perform access processing for the specific shared access target, if the dedicated thread is not activated, instructs the dedicated thread to start and the access Adding a task related to the proxy of the process, and adding the task related to the proxy of the access process when the dedicated thread is activated,
Multi-thread processing unit.
前記複数のスレッド、及び前記専用スレッドに対する実行時間の割り当て比率を変更可能であることを特徴とする、
マルチスレッド処理装置。 The multi-thread processing apparatus according to claim 1 or 2,
The allocation ratio of the execution time to the plurality of threads and the dedicated thread can be changed,
Multi-thread processing unit.
前記実行時間の割り当て比率の変更は、前記複数のスレッドのうち、前記特定の共有アクセス対象へのアクセス処理の代行を依頼するスレッドによって行われることを特徴とする、
マルチスレッド処理装置。 The multi-thread processing apparatus according to claim 3,
The change in the execution time allocation ratio is performed by a thread that requests substitution of access processing to the specific shared access target among the plurality of threads.
Multi-thread processing unit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010261361A JP2012113487A (en) | 2010-11-24 | 2010-11-24 | Multithread processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010261361A JP2012113487A (en) | 2010-11-24 | 2010-11-24 | Multithread processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2012113487A true JP2012113487A (en) | 2012-06-14 |
Family
ID=46497645
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010261361A Pending JP2012113487A (en) | 2010-11-24 | 2010-11-24 | Multithread processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2012113487A (en) |
-
2010
- 2010-11-24 JP JP2010261361A patent/JP2012113487A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5411587B2 (en) | Multi-thread execution device and multi-thread execution method | |
US9208113B2 (en) | Deferred inter-processor interrupts | |
US20030158885A1 (en) | Method and apparatus for controlling the processing priority between multiple threads in a multithreaded processor | |
US20080040730A1 (en) | Event-based bandwidth allocation mode switching method and apparatus | |
JP6240745B2 (en) | System and method for running multiple hypervisors | |
JP5498505B2 (en) | Resolving contention between data bursts | |
JP2006343872A (en) | Multithreaded central operating unit and simultaneous multithreading control method | |
JP2007133456A (en) | Semiconductor device | |
US20150082082A1 (en) | Information processing device, information processing method, and storage medium storing program for executing information processing method | |
CN105988400B (en) | Microcontroller unit | |
Mische et al. | How to enhance a superscalar processor to provide hard real-time capable in-order smt | |
US20180293095A1 (en) | Semiconductor device | |
JP2006092042A (en) | Information processor and context switching method | |
JP2007109057A (en) | Processor | |
JP2011170619A (en) | Multithread processor | |
WO2006129767A1 (en) | Multithread central processing device and simultaneous multithreading control method | |
JP2009193378A (en) | Vector processing device | |
US9946665B2 (en) | Fetch less instruction processing (FLIP) computer architecture for central processing units (CPU) | |
JP2005521937A (en) | Context switching method and apparatus in computer operating system | |
US7904703B1 (en) | Method and apparatus for idling and waking threads by a multithread processor | |
JP2012113487A (en) | Multithread processor | |
Ward | Sharing non-processor resources in multiprocessor real-time systems | |
JP2011070290A (en) | Data processor | |
US20150363227A1 (en) | Data processing unit and method for operating a data processing unit | |
JP2010176403A (en) | Multithread processor device |