JP2008225710A - Computer system and process-switching method used in the system - Google Patents
Computer system and process-switching method used in the system Download PDFInfo
- Publication number
- JP2008225710A JP2008225710A JP2007061114A JP2007061114A JP2008225710A JP 2008225710 A JP2008225710 A JP 2008225710A JP 2007061114 A JP2007061114 A JP 2007061114A JP 2007061114 A JP2007061114 A JP 2007061114A JP 2008225710 A JP2008225710 A JP 2008225710A
- Authority
- JP
- Japan
- Prior art keywords
- register
- register set
- memory
- computer system
- sets
- 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
Abstract
Description
この発明は、コンピュータシステム及び該システムで用いられるプロセス切替え方法に係り、詳しくは、複数のレジスタセットを備える(組込みシステムを含む)コンピュータシステム及び該システムで用いられるプロセス切替え方法に関する。 The present invention relates to a computer system and a process switching method used in the system, and more particularly to a computer system (including an embedded system) having a plurality of register sets and a process switching method used in the system.
この種のレジスタセットは、CPU(中央演算処理装置)の内部にあって、制御部によって処理される入出力データや、演算部の計算結果を一時記憶するための記憶装置であり、例えば、データレジスタやアドレスレジスタ等の汎用レジスタとプログラムカウンタやインデッククスレジスタ等の専用レジスタとの組からなっている。
ところで、従来の(組込みシステムを含む)コンピュータシステムでは、(同一プログラム内で関数コール呼び出し時の効率化を図ることを目的とするものを除けば、)レジスタセットは1セットのみしか保持しておらず、このため、マルチタスクOS(オペレーティング・システム)でのプログラムの処理単位としてのプロセスの切替えや、特権モード・非特権モード゛の切替えの度にレジスタの内容をメモリ(主記憶装置)に格納(退避)したり、あるいは、メモリの内容をレジスタに復帰(回復)させる処理が必要となるため、その分、本来の処理やデータ転送もそれだけ遅くなるので問題となっていた。
This type of register set is a storage device inside the CPU (Central Processing Unit) for temporarily storing input / output data processed by the control unit and calculation results of the calculation unit. It consists of a set of general-purpose registers such as registers and address registers and dedicated registers such as program counters and index registers.
By the way, in a conventional computer system (including an embedded system), only one register set is held (except for the purpose of improving the efficiency at the time of calling a function call in the same program). Therefore, the contents of the register are stored in the memory (main storage device) each time the process is switched as a program processing unit in the multitasking OS (operating system) or the privileged mode / non-privileged mode is switched. Since processing for saving (saving) or restoring (restoring) the contents of the memory to the register is necessary, the original processing and data transfer are delayed accordingly, which is a problem.
そこで、この種のプロセス切替え時のオーバヘッド(システム全体の負荷)を削減するために、例えば、特許文献1に記載の管理装置、特許文献2に記載のオペレーティング・システムの処理方式及び特許文献3に記載の中央処理装置が提供されている。
Therefore, in order to reduce this type of process switching overhead (overall system load), for example, the management apparatus described in Patent Document 1, the operating system processing method described in
特許文献1の管理装置では、1セットの汎用レジスタ群を備え、プログラムが使用した汎用レジスタの内容のみをメモリ(主記憶装置)に退避したり、メモリの内容をレジスタに復帰させることで、退避処理及び復帰処理を少なくして、オーバヘッドを削減するようにしている。 The management device of Patent Document 1 includes a set of general-purpose registers, and saves only the contents of the general-purpose registers used by the program to the memory (main storage device) or restores the contents of the memory to the registers. Processing and return processing are reduced to reduce overhead.
また、特許文献2に記載のオペレーティング・システムの処理方式では、プロセッサの持つレジスタウインドウ制御機構、もしくは類似した機構を操作し、アプリケーションソフトウェアのスレッドが一部の汎用レジスタを使用できないことにすることにより、スレッド間のコンテキストスイッチにおいて、退避、復帰するレジスタ数を少なくし、コンテキストスイッチのオーバヘッド時間を短縮するようにしている。
In addition, in the operating system processing method described in
特許文献3に記載の中央処理装置は、命令処理装置とメモリ(主記憶装置)と、複数のレジスタ群とから構成され、複数のプログラムの内容をそれぞれ個別のレジスタ群に保持して時分割処理を実行することで、プロセスの切替え時、レジスタ群に保存した内容をメモリに退避したり、メモリの内容をレジスタに復帰させる処理をなくし、これにより、中央処理装置の処理効率の向上を図るようにしている。
しかしながら、特許文献1の管理装置では、基本的に1セットの汎用レジスタ群しか設置されていないので、同時に実行可能なプロセスの数が増加した場合には、オーバヘッドの削減はそれほど期待できないので、不都合である。加えて、特許文献2に記載のオペレーティング・システムの処理方式では、アプリケーションソフトウェアのスレッドが一部の汎用レジスタを使用できない構成なので、ユーザプロセスの増加には対応できない、という不具合がある。
However, since the management apparatus of Patent Document 1 basically has only one set of general-purpose register groups, if the number of processes that can be executed simultaneously increases, the overhead cannot be reduced so much. It is. In addition, the operating system processing method described in
また、特許文献3の中央処理装置では、複数のレジスタ群が設けられているので、特許文献1や特許文献2の技術に較べれば、オーバヘッドの削減を期待できるものの、同時に実行可能なプロセスの数が、レジスタ群の設置数に制限されるので、同時に実行すべきプロセス数が、レジスタ群の設置数を超えるときは、マルチタスク制御が不可能又は混乱するので、不具合である。
Since the central processing unit of
この発明は、上述の事情に鑑みてなされたもので、レジスタセットの設置数の範囲であれば、プロセス切替え時のオーバヘッドを確実に削減できると共に、同時に実行すべきプロセス数が、レジスタセットの設置数を超えるときでも、円滑にマルチタスク制御ができるコンピュータシステム及び該システムで用いられるプロセス切替え方法を提供することを目的としている。 The present invention has been made in view of the above circumstances. If the number of register sets is within the range, the overhead at the time of process switching can be surely reduced, and the number of processes to be executed at the same time can be reduced. It is an object of the present invention to provide a computer system capable of smoothly performing multitask control even when the number exceeds, and a process switching method used in the system.
上記課題を解決するために、請求項1記載の発明は、複数のレジスタをセットとして備える複数のレジスタセットと、ユーザプログラムやデータを格納するメモリと、前記レジスタセットと前記メモリとに直結されてこれらを制御する制御部とを備えるコンピュータシステムにおけるプロセス切替え方法に係り、前記制御部が、前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、いずれか一のレジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行することを特徴としている。 In order to solve the above problem, the invention according to claim 1 is directly connected to a plurality of register sets each including a plurality of registers as a set, a memory for storing a user program and data, and the register set and the memory. The present invention relates to a process switching method in a computer system including a control unit that controls these, wherein the control unit sets a plurality of process spaces in the memory, sets a register save area for each process space, and A plurality of register sets are used for each process (processing unit of user program) to execute each process in parallel with switching, and a plurality of processes developed for each process space of the memory When the process to be executed does not use any register set, The stored contents of one of the register sets is stored in the corresponding register save area in the memory and the register set is released, and then the process to be executed using the released register set is performed. It is characterized by executing.
請求項2記載の発明は、複数のレジスタをセットとして備える複数のレジスタセットと、ユーザプログラムやデータを格納するメモリと、前記レジスタセットと前記メモリとに直結されてこれらを制御する制御部とを備えるコンピュータシステムにおけるプロセス切替え方法に係り、前記制御部が、前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、前記複数のレジスタセットのうち、最も不使用期間が長い(又は最終使用時刻が最も古い)レジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行することを特徴としている。
The invention according to
請求項3記載の発明は、請求項1又は2記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記レジスタセットが、複数の汎用レジスタを備えてなることを特徴としている。 A third aspect of the present invention relates to a process switching method in the computer system according to the first or second aspect, wherein the register set includes a plurality of general purpose registers.
また、請求項4記載の発明は、請求項1又は2記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記レジスタセットが、多目的に利用できる複数の汎用レジスタと、特別の目的で利用する単数又は複数の専用レジスタとを備えてなることを特徴としている。
The invention according to claim 4 relates to a process switching method in the computer system according to
また、請求項5記載の発明は、請求項1又は2記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記制御部が、どのレジスタセットを選択して前記プロセスを実行させるかを決定するレジスタセット選択機能と、実行されるプロセス毎にユニークに付与されるプロセスIDに基づいて、当該プロセスIDによって識別される前記プロセス空間が前記メモリ上のどのアドレスに格納されているかを決定するプロセス空間計算機能とを備えていることを特徴としている。
The invention according to claim 5 relates to a process switching method in the computer system according to
また、請求項6記載の発明は、請求項1又は5記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記各レジスタセットが、当該レジスタセットを最後に使用したプロセスIDを格納するための最終プロセスID記憶領域とを有していることを特徴としている。
The invention according to
また、請求項7記載の発明は、請求項2、3、4又は5記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記各レジスタセットが、当該レジスタセットを最後に使用したプロセスIDを格納するための最終プロセスID記憶領域と、当該レジスタセットを使用し終わった直後の時刻を格納するための最終使用時刻記憶領域とを有し、前記制御部は、前記最終使用時刻記憶領域に格納されている前記直後の時刻を参照して、どのレジスタセットが、最も不使用期間が長い(又は最終使用時刻が最も古い)レジスタセットであるかを判断することを特徴としている。
The invention according to
また、請求項8記載の発明は、請求項1又は2記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記メモリ内には、前記レジスタセットの個数よりも多い個数の前記プロセス空間が設定されることを特徴としている。
The invention according to claim 8 relates to a process switching method in the computer system according to
また、請求項9記載の発明は、請求項1又は2記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記制御部が、所定のプロセスについては、複数の前記レジスタセットを使用して当該所定のプロセスを実行することを特徴としている。
The invention according to claim 9 relates to a process switching method in the computer system according to
また、請求項10記載の発明は、請求項1又は2記載のコンピュータシステムにおけるプロセス切替え方法に係り、前記制御部が、所定のプロセスについては、実行可能モジュールに格納された使用レジスタセット数に基づいて、複数の前記レジスタセットを選択し使用して当該所定のプロセスを実行することを特徴としている。
The invention according to claim 10 relates to a process switching method in the computer system according to
また、請求項11記載の発明は、複数のレジスタをセットとして備える複数のレジスタセットと、ユーザプログラムやデータを格納するメモリと、前記レジスタセットと前記メモリとに直結されてこれらを制御する制御部とを備えると共に、プロセスを切替える機能を備えるコンピュータシステムに係り、前記制御部が、前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、いずれか一のレジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行する構成になされている、ことを特徴としている。 The invention according to claim 11 is a plurality of register sets including a plurality of registers as a set, a memory for storing a user program and data, and a control unit that is directly connected to and controls the register set and the memory. The control unit sets a plurality of process spaces in the memory, sets a register save area for each process space, and A register set is used for each process (processing unit of the user program), and each process is executed in parallel with switching, and among the plurality of processes developed for each process space of the memory If the process you are trying to run does not use any of the register sets, After storing the stored contents of one register set in the corresponding register save area in the memory and releasing the register set, the process to be executed is executed using the released register set. It is characterized by being composed.
また、請求項12記載の発明は、複数のレジスタをセットとして備える複数のレジスタセットと、ユーザプログラムやデータを格納するメモリと、前記レジスタセットと前記メモリとに直結されてこれらを制御する制御部とを備えると共に、プロセスを切替える機能を備えるコンピュータシステムに係り、前記制御部が、前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、前記複数のレジスタセットのうち、最も不使用期間が長い(又は最終使用時刻が最も古い)レジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行する構成になされている、ことを特徴としている。 According to a twelfth aspect of the present invention, a plurality of register sets including a plurality of registers as a set, a memory for storing a user program and data, and a control unit that is directly connected to and controls the register set and the memory The control unit sets a plurality of process spaces in the memory, sets a register save area for each process space, and A register set is used for each process (processing unit of the user program), and each process is executed in parallel with switching, and among the plurality of processes developed for each process space of the memory When the process to be executed does not use any register set, After storing the stored contents of the register set having the longest non-use period (or the oldest last use time) in the corresponding register save area in the memory and releasing the register set, It is characterized in that the process to be executed is executed using the released register set.
また、請求項13記載の発明は、請求項11又は12記載のコンピュータシステムに係り、前記レジスタセットが、複数の汎用レジスタを備えてなることを特徴としている。 A thirteenth aspect of the invention relates to the computer system of the eleventh or twelfth aspect, wherein the register set includes a plurality of general purpose registers.
また、請求項14記載の発明は、請求項11又は12記載のコンピュータシステムに係り、前記レジスタセットが、多目的に利用できる複数の汎用レジスタと、特別の目的で利用する単数又は複数の専用レジスタとを備えてなることを特徴としている。 The invention according to claim 14 relates to the computer system according to claim 11 or 12, wherein the register set includes a plurality of general-purpose registers that can be used for various purposes, and a single or a plurality of dedicated registers that are used for special purposes. It is characterized by comprising.
また、請求項15記載の発明は、請求項11又は12記載のコンピュータシステムに係り、前記制御部が、どのレジスタセットを選択して前記プロセスを実行させるかを決定するレジスタセット選択手段と、実行されるプロセス毎にユニークに付与されるプロセスIDに基づいて、当該プロセスIDによって識別される前記プロセス空間が前記メモリ上のどのアドレスに格納されているかを決定するプロセス空間計算手段とを備えていることを特徴としている。 The invention according to claim 15 relates to the computer system according to claim 11 or 12, wherein the control unit determines which register set is selected to execute the process, and execution. And a process space calculation means for determining in which address on the memory the process space identified by the process ID is stored based on a process ID uniquely assigned to each process. It is characterized by that.
また、請求項16記載の発明は、請求項11又は12記載のコンピュータシステムに係り、前記各レジスタセットが、当該レジスタセットを最後に使用したプロセスIDを格納するための最終プロセスID記憶領域とを有していることを特徴としている。 The invention according to claim 16 relates to the computer system according to claim 11 or 12, wherein each of the register sets has a final process ID storage area for storing a process ID that last used the register set. It is characterized by having.
また、請求項17記載の発明は、請求項12、13、14又は15記載のコンピュータシステムに係り、前記各レジスタセットが、当該レジスタセットを最後に使用したプロセスIDを格納するための最終プロセスID記憶領域と、当該レジスタセットを使用し終わった直後の時刻を格納するための最終使用時刻記憶領域とを有し、前記制御部は、前記最終使用時刻記憶領域に格納されている前記直後の時刻を参照して、どのレジスタセットが、最も不使用期間が長い(又は最終使用時刻が最も古い)レジスタセットであるかを判断することを特徴としている。 The invention according to claim 17 relates to the computer system according to claim 12, 13, 14 or 15, wherein each of the register sets stores a final process ID for storing a process ID that last used the register set. A storage area and a last use time storage area for storing a time immediately after the use of the register set is completed, and the control unit stores the time immediately after the last use time storage area. , It is characterized in that it is determined which register set is the register set having the longest non-use period (or the oldest last use time).
また、請求項18記載の発明は、請求項11又は12記載のコンピュータシステムに係り、前記メモリ内には、前記レジスタセットの個数よりも多い個数の前記プロセス空間が設定されていることを特徴としている。 The invention according to claim 18 relates to the computer system according to claim 11 or 12, characterized in that a larger number of the process spaces than the number of the register sets are set in the memory. Yes.
また、請求項19記載の発明は、請求項11又は12記載のコンピュータシステムに係り、前記制御部が、所定のプロセスについては、複数の前記レジスタセットを使用して当該所定のプロセスを実行することを特徴としている。 The invention according to claim 19 relates to the computer system according to claim 11 or 12, wherein, for the predetermined process, the control unit executes the predetermined process using a plurality of the register sets. It is characterized by.
また、請求項20記載の発明は、請求項11又は12記載のコンピュータシステムに係り、前記制御部が、所定のプロセスについては、実行可能モジュールに格納された使用レジスタセット数に基づいて、複数の前記レジスタセットを選択し使用して当該所定のプロセスを実行することを特徴としている。 The invention according to claim 20 relates to the computer system according to claim 11 or 12, wherein the control unit, for a predetermined process, uses a plurality of register sets based on the number of used register sets stored in the executable module. The predetermined process is executed by selecting and using the register set.
また、請求項21記載の発明は、請求項19又は21記載のコンピュータシステムに係り、前記所定のプロセスを実行する際に使用される前記レジスタセットの個数を格納するレジスタセット数記憶領域が付加されていることを特徴としている。 The invention according to claim 21 relates to the computer system according to claim 19 or 21, wherein a register set number storage area for storing the number of register sets used when executing the predetermined process is added. It is characterized by having.
この例の構成によれば、複数のレジスタセットを備え、前記レジスタセットの設置数の範囲であれば、前記複数のレジスタセットをプロセス毎に使用して、切替えを交えて、各プロセスを併行して実行できるので、プロセス切替え時のオーバヘッドを確実に削減できると共に、同時に実行すべきプロセス数が、レジスタセットの設置数を超えるときでも、いずれか一のレジスタセットの記憶内容を、メモリ内の対応するレジスタ退避エリアに格納して当該レジスタセットを開放し、開放された当該レジスタセットを使用できるようにしたので、円滑にマルチタスク制御を実施できる。 According to the configuration of this example, a plurality of register sets are provided, and if the number of the register sets is within the range, the plurality of register sets are used for each process, and each process is performed concurrently with switching. As a result, the overhead during process switching can be reliably reduced, and even if the number of processes to be executed simultaneously exceeds the number of installed register sets, the stored contents of one of the register sets can be handled in the memory. Since the register set is released by being stored in the register saving area to be used and the released register set can be used, multitask control can be performed smoothly.
CPUは、複数のレジスタセットを備えている。演算制御部4Aは、プロセス(ユーザプログラムの処理単位)毎に各レジスタセットを使用し、プロセスを時分割で切替えて、各プロセスを併行して実行する。メモリ内には、レジスタセットの個数よりも多い個数のプロセス空間が設定されている。
The CPU includes a plurality of register sets. The
図1は、この発明の第1実施例であるコンピュータシステムの要部構成を示す電気的ブロック図、また、図2は、同第1実施例であるコンピュータシステムの要部構成(以下、コンピュータ本体ともいう)をより詳細に示す電気的ブロック図である。
この例のコンピュータ本体は、図1に示すように、プログラム制御によるマルチタスク切替えにより、複数のプロセス(ユーザプログラムの処理単位)を併行して実行するとCPU(中央演算処理装置)1と、システムタイマ2と、CPU1Aが直接アクセスできるROMやRAM等のメモリ(主記憶装置)3とから概略構成されている。
FIG. 1 is an electrical block diagram showing a main part configuration of a computer system according to a first embodiment of the present invention. FIG. 2 shows a main part configuration of the computer system according to the first embodiment (hereinafter referred to as a computer main body). It is also an electrical block diagram showing in more detail.
As shown in FIG. 1, the computer main body of this example has a CPU (central processing unit) 1 and a system timer when a plurality of processes (user program processing units) are executed in parallel by multitask switching by program control. 2 and a memory (main storage device) 3 such as a ROM or a RAM that can be directly accessed by the
上記CPU1Aは、同図に示すように、命令解釈、制御信号の生成及び論理演算を行う演算制御部4Aと、該演算制御部4Aに直結されて、演算結果や入出力データを一時記憶しておくためのレジスタ部5とから概略構成されている。
As shown in the figure, the
上記レジスタ部5は、図2に示すように、オペレーティングシステム(OS)やシステム運用管理プログラム等の特別な権限を持ったプログラムが実行されるときに使用される特権モード用レジスタ部6と、プロセス(マルチタスクOSでのプログラムの処理単位)が実行されるときに使用され、かつ、オーバヘッド削減のために、複数のレジスタセットを備える非特権モード用レジスタ部7とからなっている。
As shown in FIG. 2, the register unit 5 includes a privilege
上記非特権モード用レジスタ部7は、図2に示すように、複数のレジスタセット(この例では、4つのレジスタセット)71、72、73、74を保持し、さらに、「最終プロセスID」記憶領域711、721、731、741と、「最終使用時刻」記憶領域712、722、732、742とが付加されている。
As shown in FIG. 2, the non-privileged
各レジスタセット71、72、73、74は、フリップ・フロップ回路からなる複数のレジスタ、例えば、データレジスタやアドレスレジスタ等の複数の汎用レジスタとプログラムカウンタやステイタスレジスタやインデッククスレジスタ等の複数の専用レジスタとの組からなっている。 Each register set 71, 72, 73, 74 has a plurality of registers composed of flip-flop circuits, for example, a plurality of general purpose registers such as a data register and an address register, and a plurality of dedicated registers such as a program counter, a status register, and an index register. It consists of a pair with a register.
また、上記最終プロセスIDの記憶領域711、721、731、741は、当該レジスタセット71、72、73、74を最後に使用したプロセスIDが格納され、また、最終使用時刻の記憶領域712、722、732、742は、当該レジスタセット71、72、73、74を使用し終わった直後の時刻が格納されるようになっている。
The last process
上記システムタイマ2は、時を刻んでシステム時刻を生成し、生成したシステム時刻をCPUに提供する。システム時刻は、コンピュータシステムに唯一の存在であり、提供するシステム時刻の単位は、マシンクロックのようにコンピュータシステムが持つ最も細かい時刻精度である。
The
上記メモリ3には、(ユーザプログラムの処理単位としての)プロセスや関連するデータを格納するために、複数のプロセス空間(この例では、5つのプロセス空間)31、32、33、34、35が設定されていて、各プロセス空間31、32、33、34、35には、対応するレジスタイメージ(レジスタセットの記憶内容)が格納されるレジスタ退避エリア311、322、333、344、355が設定されている。
In the
上記演算制御部4Aは、CPU1Aが特権モードで動作しているか、非特権モードで動作しているかを示すCPU動作モードフラグ41Aと、プロセスを非特権モード用レジスタ部7の中のどのレジスタセット71、72、73、74を選択してプロセスを実行させるかを決定するレジスタセット選択手段42と、実行されるプロセスごとにユニークに付与されるプロセスID(IDentification)に基づいて、そのプロセスIDで指定されるプロセス空間31、32、33、34、35がメモリ3上のどのアドレスに格納されているかを決定するプロセス空間計算手段43とを備えている。
The
この例の演算制御部4Aは、CPU動作モードフラグ41Aとレジスタセット選択手段42とプロセス空間計算手段43を用いて、メモリ3内のプロセス空間31、32、33、34、35毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセット71、72、73、74をも使用していないときは、各レジスタセット71、72、73、74内に設定されている「最終使用時刻」記憶領域712、722、732、742を参照して、複数のレジスタセット71、72、73、74のうち、最終使用時刻が最も古い(すなわち、最も不使用期間が長い)レジスタセット71、72、73、74の記憶内容(レジスタイメージ)を、メモリ3内の対応するレジスタ退避エリア311、322、333、344、355に格納して当該レジスタセット71、72、73、74を開放した後、開放された当該レジスタセットを使用して、当該実行しようとするプロセスを実行する構成となっている。
The
次に、図2を参照して、この例の動作について説明する。
システム起動後、ユーザプログラムが全く動作していない状況では、非特権モード用レジスタ7は、全て初期状態(0クリア)である。ここで、同図に示すように、メモリ3のプロセス空間31に展開されているプロセスID:1のプロセス(ユーザプログラム)が実行される場合の動作について説明する。
Next, the operation of this example will be described with reference to FIG.
In a situation where the user program is not operating at all after the system is started, all the non-privileged mode registers 7 are in the initial state (0 cleared). Here, as shown in the figure, the operation when the process (user program) with the process ID: 1 developed in the
動作例1
まず、CPU動作モードフラグ41Aに非特権モードである旨のフラグがセットされ、これにより、CPU1Aが非特権モードで動作する。すると、レジスタセット選択手段42は、プロセス空間31に展開されているプロセスID:1のプロセス(ユーザプログラム)をどのレジスタセット71、72、73、74を選択(使用)して実行するかを決定する。決定に当っては、各レジスタセット71、72、73、74の最終プロセスIDの記憶領域711、721、731、741を参照し、プロセスID:1が格納されているレジスタセットがあれば、そのレジスタセットを使用してプログラムが実行される。
このときは、プロセス切替えによるメモリ2へのレジスタセット記憶内容の退避処理もメモリ2からのレジスタセット記憶内容の復帰処理も不要となるので、オーバヘッドは生じない。
Operation example 1
First, a flag indicating the non-privileged mode is set in the CPU
At this time, neither processing for saving the contents of the register set stored in the
動作例2
もし、最終プロセスIDの記憶領域711、721、731、741を参照した結果、プロセスID:1が格納されているレジスタセットがなければ、各レジスタセット71、72、73、74の「最終使用時刻」記憶領域712、722、732、742を参照して、時刻が一番古いレジスタセットを選択使用してプログラムが実行される。
Operation example 2
If there is no register set in which process ID 1 is stored as a result of referring to the
今の場合は、非特権モード用レジスタ部7は全て初期状態なので、レジスタセット選択手段42は、レジスタセット71を選択すると共に、レジスタセット71用の「最終プロセスID」記憶領域711にプロセスIDの“1”を格納する。このときも、プロセス切替えによるメモリ2へのレジスタセット記憶内容の退避処理もメモリ2からのレジスタセット記憶内容の復帰処理も不要となるので、オーバヘッドは生じない。
In this case, all of the non-privileged
動作例3
次にプロセスID:1のプロセス(ユーザプログラム)がCPU1Aを開放するのに伴い、プロセス切替えを行う場合、CPU1Aは、システムタイマ2から現在時刻を取得し、取得した現在時刻の値をレジスタセット71用の「最終使用時刻」記憶領域712に格納する。この状態で、プロセスID:1のプロセスが再度実行される際には、レジスタセット選択手段42により、レジスタセット71が選択され、プロセスID:1のプロセス(ユーザプログラム)が実行されることになる。このときも、プロセス切替えによるメモリ2へのレジスタセット記憶内容の退避処理もメモリ2からのレジスタセット記憶内容の復帰処理も不要となるので、オーバヘッドは生じない。
Operation example 3
Next, when the process (user program) with the process ID: 1 releases the
動作例4
次に、図2に示す非特権モード用レジスタ部7において、レジスタセット71用の「最終プロセスID」記憶領域711にプロセスID:1、レジスタセット72用の「最終プロセスID」記憶領域721にプロセスID:2、レジスタセット73用の「最終プロセスID」記憶領域731にプロセスID:3、及びレジスタセット74用の「最終プロセスID」記憶領域741にプロセスID:4が格納されている状態で、プロセスID:1、プロセスID:2、プロセスID:3、プロセスID:4のプロセス(ユーザプログラム)が時分割で切替えられて実行される場合の動作について説明する。
Operation example 4
Next, in the non-privileged
レジスタセット選択手段42は、時分割で。プロセス空間31に展開されているプロセスID:1のプロセス(ユーザプログラム)、プロセスID:2のプロセス、プロセスID:3のプロセス、プロセスID:4のプロセスをどのレジスタセット71、72、73、74を選択(使用)して実行するかを決定する。決定に当っては、各レジスタセット71、72、73、74の最終プロセスIDの記憶領域711、721、731、741を参照する。今の場合は、プロセスID:1、プロセスID:2、プロセスID:3及びプロセスID:4が格納されているレジスタセット71、72、73、74は全て存在するので、これらのレジスタセット71、72、73、74を使用して各プロセスが実行される。このときは、プロセス切替えによるメモリ2へのレジスタセット記憶内容の退避処理もメモリ2からのレジスタセット記憶内容の復帰処理も不要となるので、オーバヘッドは生じない。
The register set selection means 42 is time-shared. Which register set 71, 72, 73, 74 is a process (user program) of process ID: 1, a process of process ID: 2, a process of process ID: 3, and a process of process ID: 4 deployed in the
動作例5
次に、図2に示す非特権モード用レジスタ部7において、レジスタセット71用の「最終プロセスID」記憶領域711に“1”、レジスタセット72用の「最終プロセスID」記憶領域721に“2”、レジスタセット73用の「最終プロセスID」記憶領域731に“3”、及びレジスタセット74用の「最終プロセスID」記憶領域741に“4”が格納されている状態で、プロセスID:5のプロセス(ユーザプログラム)が実行される場合の動作について説明する。
Operation example 5
Next, in the non-privileged
レジスタセット選択手段42は、上記規則に従って、プロセスID:5が、いずれかのレジスタセット用の「最終プロセスID」記憶領域711、721、731、741に格納されているか否かを判断する。今の場合は、いずれの「最終プロセスID」記憶領域に格納されているID値も“5”でないため、レジスタセット選択手段42は、プロセスID:5が、いずれかのレジスタセット用の「最終プロセスID」記憶領域711、721、731、741にも格納されていないと判断する。
The register
レジスタセット選択手段42は、次に、各レジスタセットの「最終使用時刻」記憶領域712、722、732、742を参照し、一番古い時刻が格納されているレジスタセットを選択する。
Next, the register set selection means 42 refers to the “last use time”
今の場合、レジスタセット71用の「最終使用時刻」記憶領域712が一番古いと仮定すると、プロセスID:5のプロセス(ユーザプログラム)が、レジスタセット71を使用して実行されることになる。このままプロセスを実行すると、プロセスID:1が使用していたレジスタセット71のイメージが破壊されるため、プロセス空間計算手段43は、レジスタセット71の「最終プロセスID」記憶領域711(今の場合、“1”が格納されている)から、プロセスID:1用のレジスタ退避エリア311のアドレスを計算し、レジスタセット71のレジスタイメージをプロセスID:1用のレジスタ退避エリア311に格納する。それゆえ、動作例5の場合には、プロセス切替えによるメモリ2へのレジスタセット記憶内容の退避処理及びメモリ2からのレジスタセット記憶内容の復帰処理が必要となるので、オーバヘッドが生じる。
In this case, assuming that the “last use time”
このように、この第1実施例の構成によれば、CPU1Aの内部に複数のレジスタセットレジスタセット71、72、73、74を保持し、プロセス切替え時であっても、必要最低限でメモリへの退避・復帰処理を行うため、プロセス切替え時のオーバヘッドを削減できる。また、この例の構成によれば、メモリ3内には、レジスタセット71、72、73、74の個数よりも多い個数のプロセス空間31、32、33、34、35が設定されているので、同時に実行すべきプロセス数が、レジスタセットの設置数を超えるときでも、いずれか一のレジスタセットの記憶内容を、メモリ内の対応するレジスタ退避エリアに格納して当該レジスタセットを開放し、開放された当該レジスタセットを使用できるようにしたので、前記実行しようとするプロセスを実行する円滑にマルチタスク制御ができる。
As described above, according to the configuration of the first embodiment, a plurality of register sets 71, 72, 73, 74 are held in the
図3は、この発明の第2実施例であるコンピュータシステムの要部構成を示す電気的ブロック図である。
この例のコンピュータシステムの構成が、上述の第1実施例のそれと大きく異なるところは、同図に示すように、CPU動作モ−ドフラグ41Bに使用レジスタセット数記憶領域8を設け、単一のプロセス(ユーザプログラム)が、CPU1Bが保持する複数のレジスタセット(例えば、2つのレジスタセットレジスタセット71、72)を用いて処理を実行できるようにした点である。
FIG. 3 is an electrical block diagram showing the main configuration of the computer system according to the second embodiment of the present invention.
The configuration of the computer system of this example is greatly different from that of the first embodiment described above, as shown in the figure, a CPU
ここで、上記使用レジスタセット数記憶領域8は、CPU動作モ−ドフラグ41Bに使用するレジスタセット数を格納できる記憶領域である。
Here, the used register set number storage area 8 is a storage area capable of storing the number of register sets used for the CPU
この例の構成において、実行可能モジュールに予め使用するレジスタセット数を格納(コンパイラがコンパイル時に設定)しておく。そして、プロセスが実行される際には、実行可能モジュール内に格納されている使用レジスタセット数を読み込み、CPU動作モードフラグ41Bの使用レジスタセット数記憶領域8に設定する。レジスタセット選択手段42は、使用レジスタセット数記憶領域8を参照して、必要とするレジスタセット数を確保する処理を行う。
In the configuration of this example, the number of register sets to be used is stored in advance in the executable module (set by the compiler at the time of compilation). When the process is executed, the number of used register sets stored in the executable module is read and set in the used register set number storage area 8 of the CPU
以上、この発明の実施例を図面を参照して詳述してきたが、具体的な構成はこの実施例に限られるものではなく、この発明の要旨を逸脱しない範囲の設計の変更等があってもこの発明に含まれる。例えば、上述の実施例では、各レジスタセットが、複数の汎用レジスタと複数の専用レジスタとから構成されるようにしたが、これに限定するものではなく、レジスタセットが、多目的に利用できる複数の汎用レジスタのみから構成されても良く、また、複数の汎用レジスタと特別の目的で利用する単数の専用レジスタとから構成されるようにしても良い。 The embodiment of the present invention has been described in detail with reference to the drawings. However, the specific configuration is not limited to this embodiment, and there are design changes and the like without departing from the gist of the present invention. Are also included in the present invention. For example, in the above-described embodiment, each register set is composed of a plurality of general-purpose registers and a plurality of dedicated registers. However, the present invention is not limited to this, and a plurality of register sets can be used for multiple purposes. It may be composed of only general purpose registers, or may be composed of a plurality of general purpose registers and a single dedicated register used for a special purpose.
また、上述の第2実施例では、単一のプロセス(ユーザプログラム)が、2つのレジスタセットレジスタセット71、72を用いて処理を実行する場合について述べたが、使用レジスタセット数は任意であり、必要に応じて増減でき、CPU1Bが保持する全てのレジスタセットを用いても良い。また、レジスタセットの保持数は任意であり、プロセス空間の設定数も任意である。
また、複数のレジスタセットのうち、最終使用時刻が最も古い(すなわち、最も不使用期間が長い)レジスタセットの記憶内容を、メモリのレジスタ退避エリアに退避させるようにしたが、これに限定されない。例えば、使用の頻度等を考慮して、退避すべきレジスタセットを決めるようにしても良い。
In the second embodiment described above, the case where a single process (user program) executes processing using two register set register sets 71 and 72 is described. However, the number of register sets used is arbitrary. All the register sets held by the
Further, the stored contents of the register set having the oldest use time (that is, the longest non-use period) among the plurality of register sets are saved in the register save area of the memory, but the present invention is not limited to this. For example, the register set to be saved may be determined in consideration of the frequency of use.
計算機システムに限らず、組込みシステムにも適用できる。 It can be applied not only to computer systems but also to embedded systems.
1A、1B CPU(コンピュータシステムの一部)
2 システムタイマ
3 メモリ
31、32、33、34、35 プロセス空間
311、322、333、344、355 レジスタ退避エリア
4A、4B 演算制御部(制御部)
41A,41B CPU動作モードフラグ
8 レジスタセット数記憶領域
42 レジスタセット選択手段
43 プロセス空間計算手段
5 レジスタ部
6 特権モード用レジスタ部
7 非特権モード用レジスタ部
711、721、731、741 最終プロセスID記憶領域
712、722、732、742 最終使用時刻記憶領域
1A, 1B CPU (part of computer system)
2
41A, 41B CPU operation mode flag 8 Register set
Claims (21)
前記制御部は、
前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、
前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、
前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、いずれか一のレジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行する
ことを特徴とするコンピュータシステムにおけるプロセス切替え方法。 A process switching method in a computer system comprising a plurality of register sets including a plurality of registers, a memory for storing user programs and data, and a control unit that is directly connected to and controls the register set and the memory There,
The controller is
Setting a plurality of process spaces in the memory, setting a register saving area for each process space; and
The plurality of register sets are used for each process (processing unit of user program), and each process is executed concurrently with switching.
When a process to be executed among a plurality of processes expanded for each process space of the memory does not use any register set, the storage contents of any one register set are The process switching in the computer system, wherein the process to be executed is executed using the released register set after storing the corresponding register save area in the memory and releasing the register set Method.
前記制御部は、
前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、
前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、
前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、前記複数のレジスタセットのうち、最も不使用期間が長い(又は最終使用時刻が最も古い)レジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行する
ことを特徴とするコンピュータシステムにおけるプロセス切替え方法。 A process switching method in a computer system comprising a plurality of register sets including a plurality of registers, a memory for storing user programs and data, and a control unit that is directly connected to and controls the register set and the memory There,
The controller is
Setting a plurality of process spaces in the memory, setting a register saving area for each process space; and
The plurality of register sets are used for each process (processing unit of user program), and each process is executed concurrently with switching.
When a process to be executed among a plurality of processes expanded for each process space of the memory does not use any register set, the most unused period of the plurality of register sets After storing the stored contents of the register set with the longest (or the oldest use time) in the corresponding register save area in the memory and releasing the register set, use the released register set A process switching method in a computer system, wherein the process to be executed is executed.
どのレジスタセットを選択して前記プロセスを実行させるかを決定するレジスタセット選択機能と、
実行されるプロセス毎にユニークに付与されるプロセスIDに基づいて、当該プロセスIDによって識別される前記プロセス空間が前記メモリ上のどのアドレスに格納されているかを決定するプロセス空間計算機能とを備えていることを特徴とする請求項1又は2記載のコンピュータシステムにおけるプロセス切替え方法。 The controller is
A register set selection function for determining which register set is selected to execute the process;
A process space calculation function for determining in which address on the memory the process space identified by the process ID is stored based on a process ID uniquely assigned to each process to be executed 3. A process switching method in a computer system according to claim 1, wherein the process is switched.
前記制御部は、
前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、
前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、
前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、いずれか一のレジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行する構成になされている、
ことを特徴とするコンピュータシステム。 Provided with a plurality of register sets having a plurality of registers as a set, a memory for storing user programs and data, a control unit that is directly connected to and controls the register set and the memory, and a function for switching processes A computer system comprising:
The controller is
Setting a plurality of process spaces in the memory, setting a register saving area for each process space; and
The plurality of register sets are used for each process (processing unit of user program), and each process is executed concurrently with switching.
When a process to be executed among a plurality of processes expanded for each process space of the memory does not use any register set, the storage contents of any one register set are It is configured to execute the process to be executed using the released register set after storing the corresponding register save area in the memory and releasing the register set.
A computer system characterized by that.
前記制御部は、
前記メモリ内に複数のプロセス空間を設定し、前記プロセス空間毎にレジスタ退避エリアを設定し、かつ、
前記複数のレジスタセットを、プロセス(ユーザプログラムの処理単位)毎に使用して各プロセスを、切替えを交えて、併行して実行すると共に、
前記メモリの前記プロセス空間毎に展開されている複数のプロセスのうち、実行しようとするプロセスが、いずれのレジスタセットをも使用していないときは、前記複数のレジスタセットのうち、最も不使用期間が長い(又は最終使用時刻が最も古い)レジスタセットの記憶内容を、前記メモリ内の対応する前記レジスタ退避エリアに格納して当該レジスタセットを開放した後、開放された当該レジスタセットを使用して前記実行しようとするプロセスを実行する構成になされている、
ことを特徴とするコンピュータシステム。 Provided with a plurality of register sets having a plurality of registers as a set, a memory for storing user programs and data, a control unit that is directly connected to and controls the register set and the memory, and a function for switching processes A computer system comprising:
The controller is
Setting a plurality of process spaces in the memory, setting a register saving area for each process space; and
The plurality of register sets are used for each process (processing unit of user program), and each process is executed concurrently with switching.
When a process to be executed among a plurality of processes expanded for each process space of the memory does not use any register set, the most unused period of the plurality of register sets After storing the stored contents of the register set with the longest (or the oldest use time) in the corresponding register save area in the memory and releasing the register set, use the released register set Configured to execute the process to be executed,
A computer system characterized by that.
どのレジスタセットを選択して前記プロセスを実行させるかを決定するレジスタセット選択手段と、
実行されるプロセス毎にユニークに付与されるプロセスIDに基づいて、当該プロセスIDによって識別される前記プロセス空間が前記メモリ上のどのアドレスに格納されているかを決定するプロセス空間計算手段とを備えていることを特徴とする請求項11又は12記載のコンピュータシステム。 The controller is
Register set selection means for determining which register set to select to execute the process;
Based on a process ID uniquely assigned to each process to be executed, a process space calculation means for determining in which address on the memory the process space identified by the process ID is stored The computer system according to claim 11 or 12, characterized in that
The computer system according to claim 19 or 21, further comprising a register set number storage area for storing the number of register sets used when executing the predetermined process.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007061114A JP2008225710A (en) | 2007-03-09 | 2007-03-09 | Computer system and process-switching method used in the system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007061114A JP2008225710A (en) | 2007-03-09 | 2007-03-09 | Computer system and process-switching method used in the system |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2008225710A true JP2008225710A (en) | 2008-09-25 |
Family
ID=39844276
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007061114A Pending JP2008225710A (en) | 2007-03-09 | 2007-03-09 | Computer system and process-switching method used in the system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2008225710A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016511493A (en) * | 2013-03-15 | 2016-04-14 | クアルコム,インコーポレイテッド | Method and apparatus for saving and restoring system memory management unit context |
JP2017037370A (en) * | 2015-08-06 | 2017-02-16 | 富士通株式会社 | Computing device, process control method and process control program |
-
2007
- 2007-03-09 JP JP2007061114A patent/JP2008225710A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016511493A (en) * | 2013-03-15 | 2016-04-14 | クアルコム,インコーポレイテッド | Method and apparatus for saving and restoring system memory management unit context |
JP2017037370A (en) * | 2015-08-06 | 2017-02-16 | 富士通株式会社 | Computing device, process control method and process control program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4610593B2 (en) | Dual thread processor | |
US20070266387A1 (en) | Multithreaded computer system and multithread execution control method | |
JP2017037370A (en) | Computing device, process control method and process control program | |
US10571993B2 (en) | Micro controller unit | |
JP2005050208A (en) | Memory managing system in multi-task system and task controller | |
JP2013225208A (en) | Information processing apparatus, information processing method and program | |
JP2004157636A (en) | Data processing apparatus | |
JP6427575B2 (en) | Handling of time-consuming instructions | |
JP5289688B2 (en) | Processor system and operating system program processing method for operating processor system | |
JP2009175960A (en) | Virtual multiprocessor system | |
JP2008225710A (en) | Computer system and process-switching method used in the system | |
JP3644042B2 (en) | Multitask processing device | |
JPWO2008155801A1 (en) | Information processing apparatus and register control method | |
JPH0916409A (en) | Microcomputer | |
JP4114946B2 (en) | Data processing device | |
JP2003058381A (en) | Processor realizing exception processing setting by program | |
JP5803721B2 (en) | Data processing device | |
JPH02242434A (en) | Task scheduling method | |
US20150363227A1 (en) | Data processing unit and method for operating a data processing unit | |
US20080222336A1 (en) | Data processing system | |
KR20190077235A (en) | Semiconductor device | |
WO2011114495A1 (en) | Multi-core processor system, thread switching control method, and thread switching control program | |
Moisuc et al. | Hardware event handling in the hardware real-time operating systems | |
JPH11184828A (en) | Test system for multiprocessor system | |
JP2008077388A (en) | Multiprocessor control system, method and program |