JP2004005227A - Arithmetic processing system, exception handling method on computer system, and computer program - Google Patents

Arithmetic processing system, exception handling method on computer system, and computer program Download PDF

Info

Publication number
JP2004005227A
JP2004005227A JP2002160225A JP2002160225A JP2004005227A JP 2004005227 A JP2004005227 A JP 2004005227A JP 2002160225 A JP2002160225 A JP 2002160225A JP 2002160225 A JP2002160225 A JP 2002160225A JP 2004005227 A JP2004005227 A JP 2004005227A
Authority
JP
Japan
Prior art keywords
exception
task
exception handling
processing
handling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2002160225A
Other languages
Japanese (ja)
Inventor
Atsushi Togawa
戸川 敦之
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.)
Sony Corp
Original Assignee
Sony 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 Sony Corp filed Critical Sony Corp
Priority to JP2002160225A priority Critical patent/JP2004005227A/en
Publication of JP2004005227A publication Critical patent/JP2004005227A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To appropriately handle an exception even under an insufficient stack. <P>SOLUTION: On or in an operating system, a special task for handling an exception is run, and a cue for requesting exception handling from the task is prepared. If an exception condition occurs in a general task, information necessary for exception handling is added to the cue and, at the same time, the task in the exception condition is brought to a halt. An insufficient stack can be handled as one exception condition and subjected to exception handling. Even if an exception occurs under a small remaining stack, exception handling is carried out regardless of stack insufficiency. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、実行中のプログラムに発生した例外状態を処理する演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムに係り、特に、タスクの状態を保存して例外処理を行なう演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムに関する。
【0002】
さらに詳しくは、本発明は、スタックの残量が少ない状況下で例外が発生しても例外処理を行なう演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムに関する。
【0003】
【従来の技術】
昨今のLSI(Large Scale Integration)技術における革新的な進歩とも相俟って、さまざまなタイプの情報処理機器や情報通信機器が開発・市販され、日常生活に深く浸透するに至っている。この種の機器では、オペレーティング・システムが提供する実行環境下で、CPU(Central Processing Unit)やその他のプロセッサが所定のプログラム・コードを実行することによりさまざまな処理サービスを提供するようになっている。
【0004】
ところで、プログラムの実行時に禁止されている操作やオペレーティング・システムの助けなしに実行を継続することができないという事態が発生することがある。例えば、ゼロによる割り算を実行したり、アクセスが禁止されている領域へのアクセスが発生した場合などである。このような状態のことを一般に「例外状態」と呼び、例外処理を必要とする。
【0005】
既存のオペレーティング・システムでは、図4に示すような方法により例外状態の処理が行なわれることが多い。
【0006】
オペレーティング・システムの制御下で、タスクAが実行中であるとする。このような場合、図示の通り、タスクAは自身に割り当てられているスタック領域の一部を使用するとともに、プログラム・カウンタ(PC)は現在実行中のアドレスを指している。
【0007】
ここで、タスクAにて例外状態が発生すると、タスクAのスタック領域に例外状態発生時の状態を保存するとともに、例外処理ルーチンにジャンプする。この結果、例外発生時の状態(例外発生アドレスを含む)がスタックを使用するとともに、プログラム・カウンタには例外処理ルーチンのアドレスが書き込まれる。
【0008】
その後、例外処理が完了すると、スタックに保存されていた状態を復元する。すなわち、例外が発生した命令又はその次の命令へジャンプする。そして、プログラム・カウンタは、例外が発生した命令又はその次の命令のアドレスを指す。
【0009】
すなわち、従来の手法では、例外が発生したときにタスクの状態(例えば、プロセッサの汎用レジスタやプログラム・カウンタの値など)をスタック上に保存し、例外処理ルーチンへとジャンプし、例外処理が完了したならば、スタックに保存されていた値を元の場所に読み戻すことによって、システムを例外発生前の状態に復帰させる。
【0010】
ところが、この手法では、複数のタスクの例外処理を並列実行しようとすると、各タスク毎に例外の状態をスタックに確保しなければならない。このため、スタック不足を原因とする例外状態の処理を行なうことができないという問題がある。つまり、スタックが不足している状況では、状態を保存する領域を確保することができないため、例外処理を行なうことができない。
【0011】
この問題は、スタックを動的に拡張することによって緩和することができるものの、この拡張に失敗したときには、やはり例外処理が不可能となってしまう。
【0012】
【発明が解決しようとする課題】
本発明の目的は、実行中のプログラムに発生した例外状態を好適に処理することができる、優れた演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムを提供することにある。
【0013】
本発明のさらなる目的は、プロセッサのレジスタ値やプログラム・カウンタ値などのタスクの状態を保存して例外処理を好適に行なうことができる、優れた演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムを提供することにある。
【0014】
本発明のさらなる目的は、スタックの残量が少ない状況で例外が発生したとしても、スタック不足をおそれることなく例外処理を好適に行なうことができる、優れた演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムを提供することにある。
【0015】
【課題を解決するための手段及び作用】
本発明は、上記課題を参酌してなされたものであり、その第1の側面は、プログラムを実行する演算処理システムであって、
プログラムに発生した例外状態を処理する例外処理タスクと、
前記例外処理タスクに対して例外状態の処理を依頼する例外処理キューと、
一般のタスクを実行中に例外状態が発生したことに応答して、前記例外処理キューに例外処理に必要な情報を書き込むとともに、例外状態が発生したタスクを停止状態に移行する制御部と、
を具備することを特徴とする演算処理システムである。
【0016】
但し、ここで言う「システム」とは、複数の装置(又は特定の機能を実現する機能モジュール)が論理的に集合した物のことを言い、各装置や機能モジュールが単一の筐体内にあるか否かは特に問わない。
【0017】
また、本発明の第2の側面は、コンピュータ・システム上での例外処理方法であって、
一般のタスクを実行中に例外状態が発生したことに応答して、例外処理キューに例外処理に必要な情報を書き込むとともに、例外状態が発生したタスクを停止状態に移行する例外処理依頼ステップと、
前記例外処理キューから要素を取り出して例外処理依頼を処理する例外処理ステップと、
を具備することを特徴とするコンピュータ・システム上での例外処理方法である。
【0018】
オペレーティング・システム上又はその内部では例外を処理する特別なタスクすなわち例外処理タスクが動作しており、この例外処理タスクに対して例外処理を依頼するための例外処理キューが用意されている。一般のタスク内で例外状態が発生したときに、この例外処理キューに例外処理に必要な情報が追加され、同時に、例外状態が発生したタスクが停止状態に移行する。ここで、例外処理のために使用されるスタック領域は、例外処理タスクに対して割り当てられた領域であり、例外が発生したタスクに割り当てられたものではない。さらに、例外処理タスクのスタック領域は、あらかじめ十分なメモリ量を確保しておくことができる。
【0019】
したがって、本発明の第1の側面に係る演算処理システム、又は、本発明の第2の側面に係るコンピュータ・システム上での例外処理方法によれば、スタック不足を例外状態の1つとして取り扱い、例外処理を行なうことができる。また、スタックの残量が少ない状況で例外が発生したとしても、スタック不足をおそれることなく例外処理を行なうことができる。
【0020】
ここで、前記制御部は、例外を発生したタスクの優先度に従って前記例外処理キューに例外処理の依頼を書き込むようにしてもよい。また、例外処理タスクが例外発生タスクよりも優先度が低い場合には、例外処理タスクの優先度を例外発生タスクの優先度に等しく設定して、再スケジューリングするようにしてもよい。
【0021】
このような場合、優先度の低い他のタスクによって例外処理タスクの実行が邪魔されないようにすることができる。
【0022】
また、前記例外処理タスクは、例外処理タスクの優先度をキューの先頭にある依頼の優先度に等しく設定することにより、優先度のより高い他のタスクの実行を邪魔しないようにすることができる。
【0023】
また、本発明の第3の側面は、タスク実行中に発生した例外状態の処理をコンピュータ・システム上で実行するようにコンピュータ可読形式で記述されたコンピュータ・プログラムであって、
一般のタスクを実行中に例外状態が発生したことに応答して、例外処理キューに例外処理に必要な情報を書き込むとともに、例外状態が発生したタスクを停止状態に移行する例外処理依頼ステップと、
前記例外処理キューから要素を取り出して、例外処理のために割り当てられたスタック領域を使用して例外処理依頼を処理する例外処理ステップと、
を具備することを特徴とするコンピュータ・プログラムである。
【0024】
本発明の第3の側面に係るコンピュータ・プログラムは、コンピュータ・システム上で所定の処理を実現するようにコンピュータ可読形式で記述されたコンピュータ・プログラムを定義したものである。換言すれば、本発明の第3の側面に係るコンピュータ・プログラムをコンピュータ・システムにインストールすることによって、コンピュータ・システム上では協働的作用が発揮され、本発明の第1の側面に係る演算処理システム、又は本発明の第2の側面に係るコンピュータ・システム上での例外処理方法と同様の作用効果を得ることができる。
【0025】
本発明のさらに他の目的、特徴や利点は、後述する本発明の実施形態や添付する図面に基づくより詳細な説明によって明らかになるであろう。
【0026】
【発明の実施の形態】
以下、図面を参照しながら本発明の実施形態について詳解する。
【0027】
図1には、本発明の実施に供される演算処理システム10のハードウェア構成を模式的に示している。同図に示すように、演算処理システム10は、プロセッサ11と、RAM(Random Access Memory)12と、ROM(Read Only Memory)13と、複数の入出力装置14−1,14−2…と、タイマ15とを含んでいる。
【0028】
プロセッサ11は、演算処理システム10のメイン・コントローラであり、オペレーティング・システム(OS)の制御下で、各種のプログラム・コードを実行するようになっている。
【0029】
オペレーティング・システムがプログラム実行を管理・制御する単位は、一般に「タスク」と呼ばれる。本実施形態に係る演算処理システム10では、プログラム中に複数のタスクが存在することを許容する。したがって、実際に計算を進める実体であるプロセッサ11の個数よりも多くのタスクが存在することになる。
【0030】
オペレーティング・システムは、プロセッサ11により処理されるタスクを頻繁に切り替えることにより、各タスクを擬似的に並列に実行させるようになっている。各タスクには、他のタスクと識別可能なタスクIDが割り振られている。また、各タスクは、スタック上のデータ領域を用いてデータに対する一連の操作すなわちトランザクションを行う。
【0031】
また、本実施形態では、一般的なタスクの他に、例外状態を処理するための「例外処理タスク」と呼ばれる特別なタスクをオペレーティング・システムが用意する。ここで言う例外状態とは、ゼロによる割り算や、アクセスが禁止された領域へのアクセスの発生など、プログラム実行時に禁止されている操作などが行なわれた状況を意味する。但し、例外処理タスクの処理方式の詳細については、後述に譲る。
【0032】
プロセッサ11は、バス16によって他の機器類(後述)と相互接続されている。システム・バス16上の各機器にはそれぞれ固有のメモリ・アドレス又はI/Oアドレスが付与されており、プロセッサ11はこれらアドレスを指定することによって所定の機器へのアクセスが可能となっている。システム・バス16は、アドレス・バス、データ・バス、コントロール・バスを含む共通信号伝送路である。
【0033】
RAM12は、書き込み可能なメモリであり、プロセッサ11において実行されるプログラム・コードをロードしたり、実行プログラムの作業データを一時格納するために使用される。プログラム・コードには、例えば、BIOS(Basic Input/Output System:基本入出力システム)、周辺機器をハードウェア操作するためのデバイス・ドライバ、オペレーティング・システム、アプリケーションなどが挙げられる。
【0034】
ROM13は、所定のコードやデータを恒久的に記憶するための不揮発メモリであり、例えば、BIOSや始動時の自己診断プログラム(Power On Self Test:POST)などを格納している。
【0035】
入出力装置14には、ディスプレイ21を接続するためのディスプレイ・インターフェース14−1、キーボード22やマウス23のようなユーザ入力装置を接続するためのユーザ入力装置インターフェース14−2、ハード・ディスク24やメディア・ドライブ25などの外部記憶装置を接続するための外部記憶装置インターフェース14−3、外部ネットワークと接続するためのネットワーク・インターフェース・カード(NIC)14−4などが含まれる。
【0036】
ディスプレイ・インターフェース14−1は、プロセッサ11が発行する描画命令を実際に処理するための専用インターフェース・コントローラである。ディスプレイ・インターフェース14−1において処理された描画データは、例えばフレーム・バッファ(図示しない)に一旦書き込まれた後、ディスプレイ21によって画面出力される。
【0037】
HDD24は、記憶担体としての磁気ディスクを固定的に搭載した外部記憶装置であり(周知)、記憶容量やデータ転送速度などの点で他の外部記憶装置よりも優れている。通常、HDD24には、プロセッサ11が実行すべきオペレーティング・システムのプログラム・コードや、アプリケーション・プログラム、デバイス・ドライバなどが不揮発的に格納されている。ソフトウェア・プログラムを実行可能な状態でHDD24上に置くことをプログラムのシステムへの「インストール」と呼ぶ。例えば、本発明を実現するオペレーティング・システムや、複数のタスクが存在するように設計されたアプリケーション・プログラムをHDD24上にインストールすることができる。
【0038】
メディア・ドライブ25は、CD(Compact Disc)やMO(Magneto−Optical disc)、DVD(Digital Versatile Disc)などの可搬型メディアを装填して、そのデータ記録面にアクセスするための装置である。
【0039】
可搬型メディアは、主として、ソフトウェア・プログラムやデータ・ファイルなどをコンピュータ可読形式のデータとしてバックアップすることや、これらをシステム間で移動(すなわち販売・流通・配布を含む)する目的で使用される。例えば、本発明を実現するオペレーティング・システムや、複数のタスクが存在するように設計されたアプリケーション・プログラムを、これら可搬型メディアを利用して複数の機器間で物理的に流通・配布することができる。
【0040】
ネットワーク・インターフェース14−1は、Ethernet(登録商標)などの所定の通信プロトコルに従って、システム10をLAN(Local Area Network)などの局所的ネットワーク、さらにはインターネットのような広域ネットワークに接続することができる。
【0041】
ネットワーク上では、複数のホスト端末(図示しない)がトランスペアレントな状態で接続され、分散コンピューティング環境が構築されている。ネットワーク上では、ソフトウェア・プログラムやデータ・コンテンツなどの配信が行うことができる。例えば、本発明を実現するオペレーティング・システムや、複数のタスクが存在するように設計されたアプリケーション・プログラムを、ネットワーク経由でダウンロードすることができる。
【0042】
各入出力装置14−1,14−2…には、割り込みレベルが割り当てられており、所定のイベント発生(例えばキーボード入力やマウス・クリックなどのGUI処理や、ハード・ディスクにおけるデータ転送の完了など)に応答して、割り込み要求信号線19を介してプロセッサ11に通知することができる。プロセッサ11は、このような割り込み要求に応答して、対応する割り込みハンドラを実行する。
【0043】
タイマ15は、タイマ信号を所定周期で発生させる装置である。タイマ15にも割り込みレベルが割り当てられており、割り込み要求信号線19を介してプロセッサ11に対して周期的な割り込みを発生する。
【0044】
なお、図1に示すような演算処理システム10の一例は、米IBM社のパーソナル・コンピュータ”PC/AT(Personal Computer/Advanced Technology)”の互換機又は後継機である。勿論、他のアーキテクチャを備えたコンピュータを、本実施形態に係る演算処理システム10として適用することも可能である。
【0045】
上述したように、本実施形態では、一般的なタスクの他に例外状態を処理するための「例外処理タスク」と呼ばれる特別なタスクが用意される。オペレーティング・システムは、通常のタスク実行時において例外状態が発生した際には、この例外処理タスクに対して例外処理の依頼を行なう。具体的には、例外処理キューと呼ばれるキューをシステム内に1つ用意して、このキューに例外発生状況などの情報を書き込む。例外処理タスクは、このキューを監視しており、例外処理の依頼が到着したならばその処理を行なう。
【0046】
図2には、一般のタスクを実行時に例外が発生したときのオペレーティング・システムによる処理動作をフローチャートの形式で示している。
【0047】
一般タスクの処理実行中に例外が発生すると(ステップS1)、オペレーティング・システムでは、まず、例外が発生したタスクを停止状態に遷移させる(ステップS2)。
【0048】
次いで、オペレーティング・システムが用意する例外処理キューに、優先度順に並ぶ位置に、当該例外状態の処理依頼を挿入する(ステップS3)。例外処理キューに挿入するときの優先度は、例外を発生したタスクの優先度に従う。
【0049】
次いで、例外処理タスクが例外を発生したタスクよりも優先度が高いかどうかを判別する(ステップS4)。例外処理タスクが例外発生タスクよりも優先度が低い場合には、例外処理タスクの優先度を例外発生タスクの優先度に等しく設定して(ステップS5)、優先度の低い他のタスクによって例外処理タスクの実行が邪魔されないようにする。
【0050】
そして、タスクの再スケジューリングを実行して、本処理ルーチン全体を終了する(ステップS6)。
【0051】
また、図3には、例外処理タスクが例外処理の依頼に応じて例外処理を行なうための処理動作をフローチャートの形式で示している。
【0052】
まず、キューに例外処理の依頼が到達するまで待機する(ステップS11)。そして、例外処理の依頼が到達すると、キューの先頭の要素を取り出して(ステップS12)、取り出した依頼を処理する(ステップS13)。
【0053】
キューがまだ空になっていない場合には、優先度のより高い他のタスクの実行を邪魔しないように、例外処理タスクの優先度をキューの先頭にある依頼の優先度に等しく設定してから(ステップS15)、ステップS12に復帰して、キューの次の要素について上述と同様の処理を繰り返し実行する。
【0054】
また、キューが空になった場合には(ステップS14)、ステップS11に復帰して、キューに次の依頼が到着するまで待機する。
【0055】
図2〜図3に示すように、例外処理タスクの優先度は、例外の処理を待っているタスクの優先度の中で最も高いものに一致するように制御されている。これによって、高優先度のタスクで発生した例外が、より優先的に処理されるようになっている。
【0056】
ここで、例外処理のために使用されるスタック領域は例外処理タスクに対して割り当てられた領域であり、例外が発生したタスクに割り当てられたものではない。さらに、例外処理タスクのスタック領域は、あらかじめ十分なメモリ量を割り当てておくことが可能である。したがって、たとえ例外が発生したタスクにおいてスタック領域が不足したとしても、例外処理を行なうことが可能である。
【0057】
[追補]
以上、特定の実施形態を参照しながら、本発明について詳解してきた。しかしながら、本発明の要旨を逸脱しない範囲で当業者が該実施形態の修正や代用を成し得ることは自明である。すなわち、例示という形態で本発明を開示してきたのであり、本明細書の記載内容を限定的に解釈するべきではない。本発明の要旨を判断するためには、冒頭に記載した特許請求の範囲の欄を参酌すべきである。
【0058】
【発明の効果】
以上詳記したように、本発明によれば、実行中のプログラムに発生した例外状態を好適に処理することができる、優れた演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムを提供することができる。
【0059】
また、本発明によれば、プロセッサのレジスタ値やプログラム・カウンタ値などのタスクの状態を保存して例外処理を好適に行なうことができる、優れた演算処理システム、コンピュータ・システム上での例外処理方法、並びにコンピュータ・プログラムを提供することができる。
【0060】
本発明によれば、スタックが不足した状況を例外状態の1つとして取り扱い、例外処理を行なうことができる。従って、スタックの残量が少ない状況で例外が発生したとしても、スタックを不足させるおそれなく例外処理を行なうことが可能である。
【図面の簡単な説明】
【図1】本発明の実施に供される演算処理システム10のハードウェア構成を模式的に示した図である。
【図2】一般のタスクを実行時に例外が発生したときのオペレーティング・システムによる処理動作を示したフローチャートである。
【図3】例外処理の依頼に応じて例外処理を行なう例外処理タスクによる処理動作を示したフローチャートである。
【図4】既存のオペレーティング・システムによる例外状態の処理の一例を示した図である。
【符号の説明】
10…演算処理システム
11…プロセッサ
12…RAM
13…ROM
14…入出力装置
15…タイマ
16…システム・バス
19…割り込み要求線
21…ディスプレイ
22…キーボード
23…マウス
24…HDD
25…メディア・ドライブ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an arithmetic processing system, an exception processing method on a computer system, and a computer program for processing an exception state occurring in a program being executed, and particularly to performing exception processing while saving a state of a task. The present invention relates to an arithmetic processing system, an exception handling method on a computer system, and a computer program.
[0002]
More specifically, the present invention relates to an arithmetic processing system that performs exception processing even if an exception occurs when the remaining amount of the stack is small, an exception processing method on a computer system, and a computer program.
[0003]
[Prior art]
Along with recent breakthroughs in LSI (Large Scale Integration) technology, various types of information processing devices and information communication devices have been developed and marketed, and have penetrated deeply into everyday life. In this type of device, a CPU (Central Processing Unit) or other processor executes a predetermined program code in an execution environment provided by an operating system to provide various processing services. .
[0004]
By the way, a situation may occur in which the execution of a program cannot be continued without the prohibited operation or the help of the operating system. For example, a case where a division by zero is executed or an access to an area for which access is prohibited occurs. Such a state is generally called an "exception state" and requires exception handling.
[0005]
In an existing operating system, processing of an exceptional state is often performed by a method as shown in FIG.
[0006]
It is assumed that task A is being executed under the control of the operating system. In such a case, as shown, task A uses a part of the stack area allocated to itself, and the program counter (PC) points to the address currently being executed.
[0007]
Here, when an exceptional state occurs in task A, the state at the time of occurrence of the exceptional state is stored in the stack area of task A, and the process jumps to the exception handling routine. As a result, the state at the time of occurrence of the exception (including the exception occurrence address) uses the stack, and the address of the exception handling routine is written in the program counter.
[0008]
Thereafter, when the exception processing is completed, the state saved in the stack is restored. That is, the instruction jumps to the instruction in which the exception has occurred or the instruction following the instruction. The program counter indicates the address of the instruction in which the exception has occurred or the address of the next instruction.
[0009]
In other words, according to the conventional method, when an exception occurs, the state of the task (for example, the value of a general-purpose register or a program counter of the processor) is saved on the stack, the process jumps to an exception handling routine, and the exception processing is completed. Then, the system is returned to the state before the exception occurred by reading the value stored in the stack back to the original location.
[0010]
However, in this method, when trying to execute exception processing of a plurality of tasks in parallel, it is necessary to secure an exception state on the stack for each task. For this reason, there is a problem that it is not possible to process an exceptional state caused by a shortage of the stack. In other words, in a situation where the stack is insufficient, an area for saving the state cannot be secured, so that exception processing cannot be performed.
[0011]
Although this problem can be mitigated by dynamically expanding the stack, if this expansion fails, exception handling is still impossible.
[0012]
[Problems to be solved by the invention]
An object of the present invention is to provide an excellent arithmetic processing system, an exception handling method on a computer system, and a computer program, which can appropriately handle an exception state occurring in a running program. .
[0013]
A further object of the present invention is to provide an excellent arithmetic processing system and an exception processing method on a computer system, which can save a state of a task such as a register value and a program counter value of a processor and can appropriately perform exception processing. , As well as computer programs.
[0014]
A further object of the present invention is to provide an excellent arithmetic processing system and a computer system capable of appropriately performing exception processing without fear of stack shortage even when an exception occurs in a situation where the remaining amount of the stack is small. An object of the present invention is to provide an exception handling method and a computer program.
[0015]
Means and Action for Solving the Problems
The present invention has been made in view of the above problems, and a first aspect thereof is an arithmetic processing system that executes a program,
An exception handling task that handles an exception condition that has occurred in the program;
An exception handling queue for requesting the exception handling task to process an exception state;
A control unit that writes information necessary for exception processing to the exception processing queue in response to the occurrence of an exception state during execution of a general task, and shifts the task in which the exception state has occurred to a stop state,
An arithmetic processing system comprising:
[0016]
However, the term “system” as used herein refers to a logical collection of a plurality of devices (or functional modules that realize specific functions), and each device or functional module is in a single housing. It does not matter in particular.
[0017]
A second aspect of the present invention is an exception handling method on a computer system,
In response to the occurrence of an exceptional state during execution of a general task, an exceptional processing request step for writing information necessary for exceptional processing to an exceptional processing queue and shifting the task in which the exceptional state has occurred to a suspended state,
An exception handling step of taking out an element from the exception handling queue and handling an exception handling request;
Exception handling method on a computer system characterized by comprising:
[0018]
A special task for handling exceptions, that is, an exception handling task is operating on or in the operating system, and an exception handling queue for requesting the exception handling task to perform exception handling is provided. When an exceptional state occurs in a general task, information necessary for exceptional processing is added to the exception handling queue, and at the same time, the task in which the exceptional state occurred transitions to a stopped state. Here, the stack area used for exception processing is an area allocated to the exception processing task, and is not allocated to the task in which the exception has occurred. Further, the stack area of the exception handling task can secure a sufficient memory amount in advance.
[0019]
Therefore, according to the arithmetic processing system according to the first aspect of the present invention or the exception handling method on the computer system according to the second aspect of the present invention, the lack of stack is treated as one of the exceptional states, Exception handling can be performed. Further, even when an exception occurs in a situation where the remaining amount of the stack is small, the exception processing can be performed without fear of the shortage of the stack.
[0020]
Here, the control unit may write an exception processing request in the exception processing queue according to the priority of the task in which the exception has occurred. If the priority of the exception handling task is lower than that of the exception occurrence task, the priority of the exception handling task may be set equal to the priority of the exception occurrence task, and rescheduling may be performed.
[0021]
In such a case, the execution of the exception handling task can be prevented from being disturbed by another task having a low priority.
[0022]
Further, the exception handling task can set the priority of the exception handling task equal to the priority of the request at the head of the queue so as not to disturb the execution of other tasks having a higher priority. .
[0023]
According to a third aspect of the present invention, there is provided a computer program described in a computer-readable format so as to execute, on a computer system, processing of an exceptional state occurring during task execution,
In response to the occurrence of an exceptional state during execution of a general task, an exceptional processing requesting step of writing information necessary for exceptional processing to an exceptional processing queue and shifting the task in which the exceptional state has occurred to a stopped state,
An exception processing step of removing an element from the exception processing queue and processing an exception processing request using a stack area allocated for exception processing;
A computer program characterized by comprising:
[0024]
A computer program according to a third aspect of the present invention defines a computer program described in a computer-readable format so as to realize a predetermined process on a computer system. In other words, by installing the computer program according to the third aspect of the present invention in a computer system, a cooperative action is exerted on the computer system, and the arithmetic processing according to the first aspect of the present invention is performed. The same operation and effect as those of the exception processing method on the system or the computer system according to the second aspect of the present invention can be obtained.
[0025]
Further objects, features, and advantages of the present invention will become apparent from more detailed descriptions based on embodiments of the present invention described below and the accompanying drawings.
[0026]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0027]
FIG. 1 schematically shows a hardware configuration of an arithmetic processing system 10 provided for implementing the present invention. As shown in FIG. 1, the arithmetic processing system 10 includes a processor 11, a random access memory (RAM) 12, a read only memory (ROM) 13, a plurality of input / output devices 14-1, 14-2,. And a timer 15.
[0028]
The processor 11 is a main controller of the arithmetic processing system 10 and executes various program codes under the control of an operating system (OS).
[0029]
A unit in which the operating system manages and controls program execution is generally called a "task". The arithmetic processing system 10 according to the present embodiment allows a plurality of tasks to exist in a program. Therefore, there are more tasks than the number of processors 11 which are entities that actually perform calculations.
[0030]
The operating system is designed to execute the tasks in a pseudo-parallel manner by frequently switching the tasks processed by the processor 11. Each task is assigned a task ID that can be distinguished from other tasks. Each task performs a series of operations, that is, a transaction, on data using the data area on the stack.
[0031]
In this embodiment, in addition to a general task, the operating system prepares a special task called an “exception processing task” for processing an exception state. Here, the exceptional state means a state where an operation prohibited during the execution of the program, such as division by zero or occurrence of access to an area where access is prohibited, has been performed. However, the details of the processing method of the exception processing task will be described later.
[0032]
The processor 11 is interconnected with other devices (described later) by a bus 16. Each device on the system bus 16 is assigned a unique memory address or I / O address, and the processor 11 can access a predetermined device by designating these addresses. The system bus 16 is a common signal transmission path including an address bus, a data bus, and a control bus.
[0033]
The RAM 12 is a writable memory, and is used to load a program code to be executed in the processor 11 and temporarily store work data of an execution program. Examples of the program code include a basic input / output system (BIOS), a device driver for operating hardware of peripheral devices, an operating system, and an application.
[0034]
The ROM 13 is a nonvolatile memory for permanently storing predetermined codes and data, and stores, for example, a BIOS and a self-diagnosis program (Power On Self Test: POST) at startup.
[0035]
The input / output device 14 includes a display interface 14-1 for connecting a display 21, a user input device interface 14-2 for connecting a user input device such as a keyboard 22 and a mouse 23, a hard disk 24, An external storage device interface 14-3 for connecting an external storage device such as the media drive 25, and a network interface card (NIC) 14-4 for connecting to an external network are included.
[0036]
The display interface 14-1 is a dedicated interface controller for actually processing a drawing command issued by the processor 11. The drawing data processed by the display interface 14-1 is temporarily written in, for example, a frame buffer (not shown), and then output to the screen by the display 21.
[0037]
The HDD 24 is an external storage device in which a magnetic disk as a storage carrier is fixedly mounted (well-known), and is superior to other external storage devices in terms of storage capacity, data transfer speed, and the like. Normally, the HDD 24 stores the program codes of the operating system to be executed by the processor 11, application programs, device drivers, and the like in a nonvolatile manner. Placing a software program on the HDD 24 in an executable state is called "installing" the program in the system. For example, an operating system for realizing the present invention and an application program designed to have a plurality of tasks can be installed on the HDD 24.
[0038]
The media drive 25 is a device for loading a portable medium such as a CD (Compact Disc), an MO (Magneto-Optical Disc), a DVD (Digital Versatile Disc), and accessing a data recording surface thereof.
[0039]
The portable medium is mainly used for backing up software programs, data files, and the like as computer-readable data, and for transferring them between systems (that is, including sales, distribution, and distribution). For example, it is possible to physically distribute and distribute an operating system that implements the present invention and an application program designed to have a plurality of tasks among a plurality of devices using these portable media. it can.
[0040]
The network interface 14-1 can connect the system 10 to a local network such as a LAN (Local Area Network) or a wide area network such as the Internet according to a predetermined communication protocol such as Ethernet (registered trademark). .
[0041]
On a network, a plurality of host terminals (not shown) are connected in a transparent state, and a distributed computing environment is constructed. On the network, distribution of software programs, data contents, and the like can be performed. For example, an operating system for realizing the present invention or an application program designed to have a plurality of tasks can be downloaded via a network.
[0042]
An interrupt level is assigned to each of the input / output devices 14-1, 14-2,..., And a predetermined event occurs (for example, GUI processing such as keyboard input or mouse click, completion of data transfer on a hard disk, etc.). ), The processor 11 can be notified via the interrupt request signal line 19. The processor 11 executes a corresponding interrupt handler in response to such an interrupt request.
[0043]
The timer 15 is a device that generates a timer signal at a predetermined cycle. An interrupt level is also assigned to the timer 15, and a periodic interrupt is generated for the processor 11 via the interrupt request signal line 19.
[0044]
An example of the arithmetic processing system 10 as shown in FIG. 1 is a compatible machine or a successor of a personal computer "PC / AT (Personal Computer / Advanced Technology)" of IBM Corporation. Of course, a computer having another architecture can be applied as the arithmetic processing system 10 according to the present embodiment.
[0045]
As described above, in this embodiment, a special task called an “exception processing task” for processing an exceptional state is prepared in addition to a general task. When an exception state occurs during normal task execution, the operating system requests the exception processing task for exception processing. Specifically, one queue called an exception processing queue is prepared in the system, and information such as an exception occurrence status is written in this queue. The exception handling task monitors this queue, and performs the process when an exception handling request arrives.
[0046]
FIG. 2 is a flowchart illustrating a processing operation performed by the operating system when an exception occurs during execution of a general task.
[0047]
When an exception occurs during execution of a general task (step S1), the operating system first causes the task in which the exception has occurred to transition to a stopped state (step S2).
[0048]
Next, the processing request of the exceptional state is inserted into the exception processing queue prepared by the operating system at a position arranged in order of priority (step S3). The priority at the time of insertion into the exception handling queue follows the priority of the task that caused the exception.
[0049]
Next, it is determined whether the exception handling task has a higher priority than the task in which the exception has occurred (step S4). If the exception handling task has a lower priority than the exception generating task, the priority of the exception processing task is set equal to the priority of the exception generating task (step S5), and the exception processing is performed by another task having a lower priority. Ensure that task execution is not disturbed.
[0050]
Then, the task is rescheduled, and the entire processing routine ends (step S6).
[0051]
FIG. 3 shows, in the form of a flowchart, a processing operation for the exception handling task to perform exception handling in response to a request for exception handling.
[0052]
First, the process waits until a request for exceptional processing reaches the queue (step S11). When the request for exception processing arrives, the head element of the queue is extracted (step S12), and the extracted request is processed (step S13).
[0053]
If the queue is not yet empty, set the priority of the exception handling task equal to the priority of the request at the head of the queue so that it does not interfere with the execution of other higher priority tasks. (Step S15), the process returns to step S12, and the same processing as described above is repeatedly executed for the next element in the queue.
[0054]
When the queue becomes empty (step S14), the process returns to step S11 and waits until the next request arrives at the queue.
[0055]
As shown in FIGS. 2 and 3, the priority of the exception handling task is controlled so as to match the highest priority of the tasks waiting for exception processing. As a result, an exception that has occurred in a high-priority task is processed with higher priority.
[0056]
Here, the stack area used for the exception processing is an area allocated to the exception processing task, and is not allocated to the task in which the exception has occurred. Further, a sufficient memory amount can be allocated in advance to the stack area of the exception handling task. Therefore, even if the task in which the exception occurs lacks the stack area, exception processing can be performed.
[0057]
[Supplement]
The present invention has been described in detail with reference to the specific embodiments. However, it is obvious that those skilled in the art can modify or substitute the embodiment without departing from the scope of the present invention. That is, the present invention has been disclosed by way of example, and the contents described in this specification should not be interpreted in a limited manner. In order to determine the gist of the present invention, the claims described at the beginning should be considered.
[0058]
【The invention's effect】
As described in detail above, according to the present invention, an excellent arithmetic processing system, an exception processing method on a computer system, and a computer system capable of appropriately processing an exception state occurring in a running program. Program can be provided.
[0059]
Also, according to the present invention, an excellent arithmetic processing system and exception processing on a computer system, which can save a state of a task such as a register value or a program counter value of a processor and can appropriately perform exception processing. Methods and computer programs can be provided.
[0060]
According to the present invention, a situation where the stack is insufficient can be treated as one of the exceptional states, and exception processing can be performed. Therefore, even if an exception occurs in a situation where the remaining amount of the stack is small, it is possible to perform the exception processing without fear of running out of the stack.
[Brief description of the drawings]
FIG. 1 is a diagram schematically showing a hardware configuration of an arithmetic processing system 10 provided for implementing the present invention.
FIG. 2 is a flowchart showing a processing operation by an operating system when an exception occurs during execution of a general task.
FIG. 3 is a flowchart illustrating a processing operation by an exception processing task that performs exception processing in response to a request for exception processing.
FIG. 4 is a diagram illustrating an example of processing of an exceptional state by an existing operating system.
[Explanation of symbols]
10 arithmetic processing system 11 processor 12 RAM
13 ROM
14 I / O device 15 Timer 16 System bus 19 Interrupt request line 21 Display 22 Keyboard 23 Mouse 24 HDD
25 ... Media drive

Claims (11)

プログラムを実行する演算処理システムであって、
プログラムに発生した例外状態を処理する例外処理タスクと、
前記例外処理タスクに対して例外状態の処理を依頼する例外処理キューと、
一般のタスクを実行中に例外状態が発生したことに応答して、前記例外処理キューに例外処理に必要な情報を書き込むとともに、例外状態が発生したタスクを停止状態に移行する制御部と、
を具備することを特徴とする演算処理システム。
An arithmetic processing system that executes a program,
An exception handling task that handles an exception condition that has occurred in the program;
An exception handling queue for requesting the exception handling task to process an exception state;
A control unit that writes information necessary for exception processing to the exception processing queue in response to the occurrence of an exception state during execution of a general task, and shifts the task in which the exception state has occurred to a stop state,
An arithmetic processing system comprising:
前記例外処理タスクには例外処理のために使用されるスタック領域が割り当てられている、
ことを特徴とする請求項1に記載の演算処理システム。
A stack area used for exception handling is assigned to the exception handling task,
The arithmetic processing system according to claim 1, wherein:
前記制御部は、例外を発生したタスクの優先度に従って前記例外処理キューに例外処理の依頼を書き込む、
ことを特徴とする請求項1に記載の演算処理システム。
The control unit writes an exception handling request in the exception handling queue according to the priority of the task that caused the exception,
The arithmetic processing system according to claim 1, wherein:
前記制御部は、前記例外処理タスクが例外発生タスクよりも優先度が低い場合には、前記例外処理タスクの優先度を例外発生タスクの優先度に等しく設定して、再スケジューリングする、
ことを特徴とする請求項1に記載の演算処理システム。
When the exception handling task has a lower priority than the exception occurrence task, the control unit sets the priority of the exception handling task equal to the priority of the exception occurrence task, and reschedules.
The arithmetic processing system according to claim 1, wherein:
前記例外処理タスクは、前記例外処理タスクの優先度を前記例外処理キューの先頭にある依頼の優先度に等しく設定する、
ことを特徴とする請求項1に記載の演算処理システム。
The exception handling task sets the priority of the exception handling task equal to the priority of the request at the head of the exception handling queue,
The arithmetic processing system according to claim 1, wherein:
コンピュータ・システム上での例外処理方法であって、
一般のタスクを実行中に例外状態が発生したことに応答して、例外処理キューに例外処理に必要な情報を書き込むとともに、例外状態が発生したタスクを停止状態に移行する例外処理依頼ステップと、
前記例外処理キューから要素を取り出して例外処理依頼を処理する例外処理ステップと、
を具備することを特徴とするコンピュータ・システム上での例外処理方法。
An exception handling method on a computer system, comprising:
In response to the occurrence of an exceptional state during execution of a general task, an exceptional processing request step for writing information necessary for exceptional processing to an exceptional processing queue and shifting the task in which the exceptional state has occurred to a suspended state,
An exception handling step of taking out an element from the exception handling queue and handling an exception handling request;
An exception handling method on a computer system, comprising:
前記例外処理ステップでは、例外処理のために割り当てられたスタック領域を使用して例外状態を処理する、
ことを特徴とする請求項6に記載のコンピュータ・システム上での例外処理方法。
In the exception handling step, an exception state is handled using a stack area allocated for exception handling.
7. The exception handling method on a computer system according to claim 6, wherein:
前記例外処理依頼ステップでは、例外を発生したタスクの優先度に従って前記例外処理キューに例外処理の依頼を書き込む、
ことを特徴とする請求項6に記載のコンピュータ・システム上での例外処理方法。
In the exception handling request step, write an exception handling request to the exception handling queue according to the priority of the task that caused the exception,
7. The exception handling method on a computer system according to claim 6, wherein:
前記例外処理依頼ステップでは、前記例外処理タスクが例外発生タスクよりも優先度が低い場合には、前記例外処理タスクの優先度を例外発生タスクの優先度に等しく設定して、再スケジューリングする、
ことを特徴とする請求項6に記載のコンピュータ・システム上での例外処理方法。
In the exception handling requesting step, when the exception handling task has a lower priority than the exception occurrence task, the priority of the exception handling task is set equal to the priority of the exception occurrence task, and rescheduling is performed.
7. The exception handling method on a computer system according to claim 6, wherein:
前記例外処理ステップでは、前記例外処理タスクの優先度を前記例外処理キューの先頭にある依頼の優先度に等しく設定する、
ことを特徴とする請求項6に記載のコンピュータ・システム上での例外処理方法。
In the exception handling step, the priority of the exception handling task is set equal to the priority of the request at the head of the exception handling queue,
7. The exception handling method on a computer system according to claim 6, wherein:
タスク実行中に発生した例外状態の処理をコンピュータ・システム上で実行するようにコンピュータ可読形式で記述されたコンピュータ・プログラムであって、
一般のタスクを実行中に例外状態が発生したことに応答して、例外処理キューに例外処理に必要な情報を書き込むとともに、例外状態が発生したタスクを停止状態に移行する例外処理依頼ステップと、
前記例外処理キューから要素を取り出して、例外処理のために割り当てられたスタック領域を使用して例外処理依頼を処理する例外処理ステップと、
を具備することを特徴とするコンピュータ・プログラム。
A computer program described in a computer-readable form so as to execute processing of an exceptional state occurring during task execution on a computer system,
In response to the occurrence of an exceptional state during execution of a general task, an exceptional processing request step for writing information necessary for exceptional processing to an exceptional processing queue and shifting the task in which the exceptional state has occurred to a suspended state,
An exception processing step of removing an element from the exception processing queue and processing an exception processing request using a stack area allocated for exception processing;
A computer program comprising:
JP2002160225A 2002-05-31 2002-05-31 Arithmetic processing system, exception handling method on computer system, and computer program Pending JP2004005227A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002160225A JP2004005227A (en) 2002-05-31 2002-05-31 Arithmetic processing system, exception handling method on computer system, and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002160225A JP2004005227A (en) 2002-05-31 2002-05-31 Arithmetic processing system, exception handling method on computer system, and computer program

Publications (1)

Publication Number Publication Date
JP2004005227A true JP2004005227A (en) 2004-01-08

Family

ID=30429714

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002160225A Pending JP2004005227A (en) 2002-05-31 2002-05-31 Arithmetic processing system, exception handling method on computer system, and computer program

Country Status (1)

Country Link
JP (1) JP2004005227A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008242510A (en) * 2007-03-23 2008-10-09 Nec Corp System and method of allocating resource to job, and program
JP2011519456A (en) * 2008-04-23 2011-07-07 マイクロソフト コーポレーション Automatic completion based on accurate judgment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008242510A (en) * 2007-03-23 2008-10-09 Nec Corp System and method of allocating resource to job, and program
JP2011519456A (en) * 2008-04-23 2011-07-07 マイクロソフト コーポレーション Automatic completion based on accurate judgment

Similar Documents

Publication Publication Date Title
KR100934533B1 (en) Computer-readable recording medium recording arithmetic processing system, task control method on computer system, and computer program
CN101271409B (en) Device and method for migration of a logical partition, and equipment therefor
JP3845639B2 (en) Apparatus and method for dynamically switching a multithreaded processor between a single threaded mode and a simultaneous multithreaded mode
JP4001873B2 (en) Apparatus and method for virtualizing interrupts in a logically partitioned computer system
US6243774B1 (en) Apparatus program product and method of managing computer resources supporting concurrent maintenance operations
US6006247A (en) Method and system for scheduling threads and handling exceptions within a multiprocessor data processing system
US6275893B1 (en) Method and apparatus for providing seamless hooking and intercepting of selected kernel and HAL exported entry points in an operating system
JPH04137046A (en) Operating system for electronic computer
TWI401604B (en) System and method for managing system management interrupts in a multiprocessor computer system
JP5026494B2 (en) Computer that starts at high speed
JP2004326774A (en) Selective generation of asynchronous report about compartment managing operation for logically compartmentalized computer
JP3938343B2 (en) Task management system, program, and control method
US20100005479A1 (en) Synchronization of event handlers
JP4992740B2 (en) Multiprocessor system, failure detection method, and failure detection program
US20040261076A1 (en) Program processing system, program processing method, and computer program
US8732441B2 (en) Multiprocessing system
JP2009134565A (en) Virtual machine system and method for controlling virtual machine system
US6658510B1 (en) Software method to retry access to peripherals that can cause bus timeouts during momentary busy periods
JPH07104830B2 (en) Computer system and method of operating a computer system
JP2004005227A (en) Arithmetic processing system, exception handling method on computer system, and computer program
JP2011138401A (en) Processor system, method of controlling the same, and control circuit
JP2003067200A (en) Processing system, task control method on computer system and storage medium
US20060053413A1 (en) Debug system for debugging multi-task system
JPS61184643A (en) Starting control system for virtual computer
JP4352086B2 (en) Information processing apparatus and operating system discrimination method