JP2009251681A - Expansion method for stack region and program - Google Patents

Expansion method for stack region and program Download PDF

Info

Publication number
JP2009251681A
JP2009251681A JP2008095437A JP2008095437A JP2009251681A JP 2009251681 A JP2009251681 A JP 2009251681A JP 2008095437 A JP2008095437 A JP 2008095437A JP 2008095437 A JP2008095437 A JP 2008095437A JP 2009251681 A JP2009251681 A JP 2009251681A
Authority
JP
Japan
Prior art keywords
task
stack
overflow
stack area
area
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
JP2008095437A
Other languages
Japanese (ja)
Inventor
Ryoji Fukuda
亮治 福田
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2008095437A priority Critical patent/JP2009251681A/en
Publication of JP2009251681A publication Critical patent/JP2009251681A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Executing Machine-Instructions (AREA)
  • Debugging And Monitoring (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To safely continue the execution of a task whose stack overflow has occurred. <P>SOLUTION: A method for extending a stack region includes: waiting for the detection of stack overflow in step S101; retrieving a task whose stack region is destroyed due to its stack overflow in step S102; stopping the task whose stack region is destroyed in step S103; and extending the stack region of the task whose stack overflow has occurred in step S104. This processing brings about such effects that it is possible to continue the execution of the task whose stack overflow has occurred without using any virtual storage or the like, and to guarantee the execution of the task whose stop is not permitted. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、マルチタスクシステムにおいてスタックオーバーフローを検出した時にスタック領域を拡張するスタック領域の拡張方法及びプログラムに関する。   The present invention relates to a stack area expansion method and program for expanding a stack area when a stack overflow is detected in a multitask system.

従来、マルチタスクシステムにおいてスタック領域を拡張する方法に関する技術には、タスクごとにスタック領域の予約領域を設定し、スタックオーバーフローが発生したときにその予約領域をスタック領域として使用するものがある(特許文献1を参照のこと)。   Conventionally, there is a technique related to a method for expanding a stack area in a multitask system, in which a reserved area of a stack area is set for each task, and the reserved area is used as a stack area when a stack overflow occurs (patent) (Ref. 1).

特許文献1にかかる技術は、マルチスレッドタスクを構成する複数のスレッドのタスクの割り当てを行うマルチスレッドタスクのスタック割り当て方法に関する。この技術は、特に、ページ固定を前提としたスーパーコンピュータ用の大規模なベクトルプログラムを実行するマルチプロセッサシステムのマルチスレッドタスクのスタック割り当て方法に適用して有効な技術である。また、仮想記憶空間に存在する各スレッド毎のスタック領域の上限に予約領域を設定し、その予約領域を最初に使用するときに、スタック領域の使用領域に仮想記憶空間の記憶領域を割り当て、スタック領域の使用領域を使用することを特徴としている。   The technology according to Patent Document 1 relates to a multi-thread task stack allocation method for allocating tasks of a plurality of threads constituting a multi-thread task. This technique is particularly effective when applied to a multi-thread task stack allocation method for a multiprocessor system that executes a large-scale vector program for a supercomputer on the premise of page fixing. In addition, a reserved area is set at the upper limit of the stack area for each thread existing in the virtual storage space, and when the reserved area is used for the first time, the storage area of the virtual storage space is allocated to the used area of the stack area, and the stack It is characterized by using the area used.

また、機器組込用のマイクロプロセッサでマルチタスク処理を行う場合において、スタック領域の初期化データと比較することでスタックのオーバーフローを検出し、スタックオーバーフローを起こしたタスクを停止するものがある(特許文献2を参照のこと)。   In addition, when multitask processing is performed by a microprocessor built into a device, there is one that detects a stack overflow by comparing with initialization data in the stack area and stops the task that caused the stack overflow (patent) (Ref. 2).

特許文献2にかかる技術は、マイクロプロセッサ上でマルチタスク処理を行う場合に、特定のタスクが割り当てられたスタック領域をオーバーフローし、他のタスクのスタック領域を使用することのないようにタスクを管理する。これにより、マイクロプロセッサの暴走を未然に防ぐために有効な技術である。   The technology according to Patent Document 2 manages tasks so that when a multitask process is performed on a microprocessor, a stack area to which a specific task is allocated overflows and the stack area of another task is not used. To do. This is an effective technique for preventing the runaway of the microprocessor.

また、その他にもスタックオーバーフローを検出する方法に関しては、次のようなものがある。特許文献3、特許文献4、特許文献5、特許文献6はいずれもスタックオーバーフロー検出回路をCPU外部に構成し、スタックポインタ又はそれに類するレジスタとスタック領域を比較することでスタック領域を破壊する前に割込み等で通知するものである。   Other methods for detecting stack overflow include the following. Patent Document 3, Patent Document 4, Patent Document 5, and Patent Document 6 are all configured with a stack overflow detection circuit outside the CPU, and before the stack area is destroyed by comparing the stack area with a stack pointer or similar register. This is notified by an interrupt or the like.

また、特許文献7はスタックオーバーフローを周期的な割込み処理の中で判断するものである。この技術では、特殊なハードウェアを追加することなくスタックオーバーフローを検出するためには、他のタスク等で利用しているスタック領域や変数領域を破壊した後で検出するか、あるいは、スタック領域に連続する予備領域を特殊な値で初期化しておく。そして、その特殊な値が別の値に変更されていることをあるタイミングで調べることで検出する。   Further, Patent Document 7 judges stack overflow in periodic interrupt processing. In this technology, in order to detect stack overflow without adding special hardware, it is detected after destroying the stack area and variable area used by other tasks, etc., or in the stack area. A continuous spare area is initialized with a special value. Then, it is detected by examining at a certain timing that the special value has been changed to another value.

以上のような技術が本発明の背景技術としてあげられる。   The above techniques are mentioned as the background art of the present invention.

特開平9−167114号公報JP-A-9-167114 特開2000−76081号公報JP 2000-76081 A 特開昭62−212733号公報JP-A-62-212733 特開平2−8945号公報Japanese Patent Laid-Open No. 2-8945 特開平9−198258号公報Japanese Patent Laid-Open No. 9-198258 特開2000−20352号公報JP 2000-20352 A 特開2004−157662号公報Japanese Patent Laid-Open No. 2004-157762

しかしながら、上記の従来の技術には、仮想記憶領域にスタック領域を拡張しなければタスクの実行を継続できない、あるいは、スタックオーバーフローを起こしたタスクは実行を継続できない、といった問題がある。   However, the above-described conventional technique has a problem that task execution cannot be continued unless the stack area is expanded in the virtual storage area, or a task that has caused a stack overflow cannot be continued.

例えば設計段階のミスで、機械を制御するタスクのスタック領域を充分確保していなかった場合、予期せずスタックを大量に消費してスタックオーバーフローを起こしてしまう。本来なら設計段階でスタック領域を充分確保することが望ましいが、スタック消費量の見積りが困難な場合もある。   For example, if a sufficient stack area for a task for controlling the machine is not secured due to a mistake in the design stage, a stack is unexpectedly consumed and a stack overflow occurs. Originally, it is desirable to secure a sufficient stack area at the design stage, but it may be difficult to estimate the stack consumption.

通常はスタックオーバーフローが発生しても安全にシステムを停止させる方法を講じておく必要があるが、稼動させたままエラー処理を行なった方が安全な場合もあり、スタックオーバーフローを起こしたタスクを停止させることが必ずしも良いとは限らない。本発明は係る問題点を解消する。   Normally, it is necessary to take a safe way to stop the system even if a stack overflow occurs, but it may be safer to perform error handling while it is running, so the task that caused the stack overflow is stopped. It is not always good to do. The present invention solves such problems.

本発明のスタック領域の拡張方法は、スタックオーバーフローを起こしたタスクのスタック領域を拡張するスタック領域の拡張方法であって、スタックオーバーフローの検出を待つステップと、前記スタックオーバーフローによってスタック領域が破壊されるタスクを検索するステップと、前記スタック領域が破壊されるタスクを停止するステップと、前記オーバーフローを起こしたタスクのスタック領域を拡張するステップとを有することを特徴とする。
また、本発明のプログラムは、スタックオーバーフローを起こしたタスクのスタック領域を拡張するスタック領域の拡張方法をコンピュータに実行させるためのプログラムであって、スタックオーバーフローの検出を待つステップと、前記スタックオーバーフローによってスタック領域が破壊されるタスクを検索するステップと、前記スタック領域が破壊されるタスクを停止するステップと、前記オーバーフローを起こしたタスクのスタック領域を拡張するステップとをコンピュータに実行させるためのプログラムである。
なお、本発明におけるタスクとスレッドは呼び方が異なるだけで同じ意味で使われるが、特許文献1に記述されているタスクは単数又は複数のスレッドから構成されるものとして表現されている。また、タスクはUNIX(登録商標)のプロセスモデルで扱われるプロセスに該当するものである。
The stack area expansion method according to the present invention is a stack area expansion method for expanding a stack area of a task that has caused a stack overflow, the step of waiting for detection of the stack overflow, and the stack area being destroyed by the stack overflow. The method includes a step of searching for a task, a step of stopping a task in which the stack area is destroyed, and a step of expanding the stack area of the task that has caused the overflow.
The program of the present invention is a program for causing a computer to execute a stack area expansion method for expanding the stack area of a task that has caused a stack overflow. A program for causing a computer to execute a step of searching for a task in which a stack area is destroyed, a step of stopping a task in which the stack area is destroyed, and a step of expanding the stack area of the task that has caused the overflow is there.
Note that the task and thread in the present invention are used in the same meaning with different names, but the task described in Patent Document 1 is expressed as composed of one or a plurality of threads. The task corresponds to a process handled in the UNIX (registered trademark) process model.

本発明によれば、仮想記憶等を使用することなく、スタックオーバーフローを起こしたタスクの実行を停止することなく継続することができ、停止させることが許されないタスクの実行を保証できるという効果がある。   According to the present invention, it is possible to continue execution of a task that has caused a stack overflow without using virtual memory or the like without stopping, and it is possible to guarantee execution of a task that is not allowed to be stopped. .

(第1の実施の形態)
以下、本発明の実施の形態について説明する。図1は、本発明に係るスタック領域の拡張方法の処理の流れを示すフローチャートである。以下、順を追って処理の流れを、具体的なマルチタスクシステムに実施した例とともに説明する。
(First embodiment)
Embodiments of the present invention will be described below. FIG. 1 is a flowchart showing a processing flow of a stack area expansion method according to the present invention. Hereinafter, the flow of processing will be described step by step together with an example implemented in a specific multitask system.

マルチタスクシステムとしてμITRON等のリアルタイムOSを想定しているが、本実施形態はマルチタスクシステムを限定するものではなく、仮想記憶を採用していない一般的な組込み向けのマルチタスクシステムに実施可能なものである。本実施形態では図1に示すフローチャートに基づく処理の開始から終了までをシステムが停止するまで繰り返す一つのタスクとして実現する。   Although a real-time OS such as μITRON is assumed as a multitask system, this embodiment does not limit the multitask system, and can be implemented in a general embedded multitask system that does not employ virtual memory. Is. In the present embodiment, the process from the start to the end based on the flowchart shown in FIG. 1 is realized as one task that is repeated until the system stops.

タスクが生成され、システムによって実行権が該タスクに移動すると、フローチャートに示す処理が開始されステップS101が実行される。ステップS101では、スタックオーバーフローの検出を待つ。スタックオーバーフローの検出方法については前述の先行技術に委ね、ここでは詳細な説明は省略するが、例えば特許文献2に記載の方法によって特にハードウェアを変更することなくスタックオーバーフローを検出する。スタックオーバーフローを検出した時点でステップS101は終了し、次のステップS102を実行する。   When a task is generated and the execution right is transferred to the task by the system, the process shown in the flowchart is started and step S101 is executed. In step S101, it waits for detection of a stack overflow. The method for detecting the stack overflow is left to the above-described prior art, and detailed description thereof is omitted here. However, for example, the stack overflow is detected by the method described in Patent Document 2 without changing the hardware. When the stack overflow is detected, step S101 ends and the next step S102 is executed.

ステップS102では、前記スタックオーバーフローによってスタック領域が破壊されるタスクを検索する。スタックオーバーフローが発生した場合、通常はスタックポインタにその値(アドレス)が格納されている。図3に示すようなタスク管理テーブル301によって管理されるタスク毎のスタック領域開始アドレスとスタックサイズからどのタスクのスタック領域が破壊されようとしているのか検索することができる。スタックサイズが省略されているタスク管理テーブルであれば、各タスクのスタック開始アドレスとスタックポインタの大小を比較することでスタックオーバーフローの被害を受けるタスクを特定することができる。   In step S102, a task whose stack area is destroyed by the stack overflow is searched. When a stack overflow occurs, the value (address) is normally stored in the stack pointer. It is possible to search which task's stack area is about to be destroyed from the stack area start address and stack size for each task managed by the task management table 301 shown in FIG. In the case of a task management table in which the stack size is omitted, a task that is damaged by stack overflow can be identified by comparing the stack start address of each task with the size of the stack pointer.

また、特許文献2の方法では、スタック境界最終部の破壊にとどまる場合もあるが、このような場合でもスタック領域が隣接するタスクのスタック領域が破壊されたものとして扱う。   Further, in the method of Patent Document 2, there is a case where the last part of the stack boundary is destroyed, but even in such a case, the stack area of the task adjacent to the stack area is treated as being destroyed.

このように、ステップS102ではスタックオーバーフローによってスタック領域が破壊されるタスクを検索し、次のステップS103を実行する。   In this way, in step S102, a task whose stack area is destroyed due to stack overflow is searched, and the next step S103 is executed.

ステップS103では、前記スタック領域が破壊されるタスクを停止する。マルチタスクシステムでは、次に実行するタスクは図4に示すようなタスクの優先順位ごとのリストで順序付けられたタスクキューで管理されていることが多い。   In step S103, the task that destroys the stack area is stopped. In a multitask system, a task to be executed next is often managed in a task queue ordered in a list for each task priority as shown in FIG.

図4(a)はタスク停止前のタスクキューを示している。タスク優先度1からタスク優先度3まで定義され、タスク優先度1のタスクキューにはタスク4とタスク1とタスク6がキューイングされ、タスク1が実行中である。タスク優先度2のタスクキューにはタスク2がキューイングされており、実行権が取得できるのを待っている。タスク優先度3のタスクキューにはタスク5とタスク3がキューイングされている状態である。   FIG. 4A shows a task queue before the task is stopped. Task priority 1 to task priority 3 are defined. Task 4, task 1, and task 6 are queued in the task priority 1 task queue, and task 1 is being executed. Task 2 is queued in the task queue with task priority 2 and is waiting for the execution right to be acquired. Task 5 and task 3 are queued in the task queue with task priority 3.

ステップS101から始まる本タスクは図4ではタスク4に該当し、タスク優先度1の先頭で現在実行されている状況である。図4の状況では、停止するタスク2についてタスクキューから削除することでタスクの停止を行う。停止するタスクをタスクキューから削除することでステップS103の処理を終了し、ステップS104を実行する。   This task starting from step S101 corresponds to task 4 in FIG. 4 and is currently being executed at the top of task priority 1. In the situation of FIG. 4, the task is stopped by deleting task 2 to be stopped from the task queue. By deleting the task to be stopped from the task queue, the process of step S103 is terminated, and step S104 is executed.

図4(b)はタスク停止後のタスクキューの状態を表しているが、ここではタスク2を停止状態のキューに移動することでタスク2の削除を実現し、タスク2のその後の処理に関してはマルチタスクシステムに委ねられる。ステップS104では、前記オーバーフローを起こしたタスクのスタック領域を拡張する。   FIG. 4B shows the state of the task queue after the task is stopped. Here, the task 2 is deleted by moving the task 2 to the stopped state queue. It is left to the multitasking system. In step S104, the stack area of the task causing the overflow is expanded.

図2は、タスク1がスタックオーバーフローを起こしてタスク2のスタック領域を破壊する前(図2(a))と、破壊した後(図2(b))のメモリマップを表している。ステップS103でタスク2が停止し、タスク2のスタック領域はもはや空き領域となっているので、スタックオーバーフローを起こしたタスク1のスタック領域として利用することが可能である。そして、請求項2に記載されているように、図3に示すタスク管理テーブル301から停止するタスク2のスタックサイズをスタックオーバーフローを起こしたタスク1のスタックサイズに加える。これにより、タスク1のスタック領域を拡張する。本実施形態のようにソフトウェアでスタックオーバーフローを検出する場合は、スタック領域を特殊な値で初期化する必要がある。その場合は、ステップS104を終了する前にスタックを拡張する領域に対して初期化を行う。ステップS104を終了したあとは、再びステップS101へ戻り新たなスタックオーバーフロー検出を待つ。   FIG. 2 shows a memory map before task 1 causes stack overflow and destroys the stack area of task 2 (FIG. 2A) and after destruction (FIG. 2B). In step S103, the task 2 is stopped and the stack area of the task 2 is no longer available, so that it can be used as the stack area of the task 1 in which the stack overflow has occurred. Then, as described in claim 2, the stack size of task 2 to be stopped is added to the stack size of task 1 causing the stack overflow from the task management table 301 shown in FIG. 3. As a result, the stack area of task 1 is expanded. When the stack overflow is detected by software as in the present embodiment, the stack area needs to be initialized with a special value. In this case, initialization is performed on the area for expanding the stack before completing step S104. After step S104 is completed, the process returns to step S101 again to wait for a new stack overflow detection.

以上のように実施することで、本発明によれば、仮想記憶等を使用することなく、スタックオーバーフローを起こしたタスクを停止することなく実行を継続することができ、停止させることが許されないタスクの実行を保証できる。   By performing as described above, according to the present invention, it is possible to continue the execution without stopping the task that caused the stack overflow without using virtual memory or the like, and the task that is not allowed to stop. Can be guaranteed.

(第2の実施の形態)
次に、本発明の第2の実施の形態について説明する。図5は請求項3の処理の流れを示すフローチャートである。本実施形態では、スタックオーバーフローの検出をハードウェアで行い、マルチタスクシステムへは割込みという形で通知される。ハードウェアによりスタックオーバーフローを検出する方法に関しては先行技術で説明したように様々な方法があり、本発明の主眼とするものではないため説明は省略するが、いずれの方法を採用しても特に問題はない。
(Second Embodiment)
Next, a second embodiment of the present invention will be described. FIG. 5 is a flowchart showing the flow of processing of claim 3. In this embodiment, the stack overflow is detected by hardware, and the multitask system is notified in the form of an interrupt. As described in the prior art, there are various methods for detecting a stack overflow by hardware, and the description is omitted because it is not the main point of the present invention. However, any method is particularly problematic. There is no.

例えば、特許文献3、特許文献4、特許文献5、特許文献6はいずれもスタックオーバーフロー検出回路をCPU外部に構成し、スタックポインタ又はそれに類するレジスタとスタック領域を比較する。これにより、スタック領域を破壊する前に割込み等で通知するが、本実施形態においても同様の方法を実施し、システムに割込みが通知されると図5のステップS501が実行される。   For example, Patent Literature 3, Patent Literature 4, Patent Literature 5, and Patent Literature 6 all configure a stack overflow detection circuit outside the CPU, and compare a stack pointer or a similar register with a stack area. As a result, notification is made by an interrupt or the like before destroying the stack area. In the present embodiment, the same method is implemented, and when an interrupt is notified to the system, step S501 in FIG. 5 is executed.

ステップS501では、割り込みの要因を割込み要因レジスタの値等を取得することにより調査し、スタックオーバーフローが割込みの要因であった場合は次のステップを実行する。次のステップ以下は先に述べた第1の実施形態のステップS102以下と同様であるため説明は省略するが、最後のステップS104が終了したあとはタスク2がタスクキューから削除される。   In step S501, the cause of the interrupt is checked by acquiring the value of the interrupt factor register and the like. If the stack overflow is the cause of the interrupt, the next step is executed. Since the subsequent steps are the same as those in step S102 and subsequent steps in the first embodiment described above, description thereof is omitted, but task 2 is deleted from the task queue after the final step S104 is completed.

そして、タスク1のスタック領域がタスク2のスタック領域と統合されることにより拡張され、最終的に割込み処理から復帰することで終了する。また、ステップS501で割込み要因がスタックオーバーフローでなかった場合は、ステップS505を実行する。   Then, the stack area of task 1 is expanded by being integrated with the stack area of task 2, and finally the process is terminated by returning from the interrupt processing. If the interrupt factor is not a stack overflow in step S501, step S505 is executed.

ステップS505では、スタックオーバーフロー以外の割込み処理を実行し、割込み処理を終了する。   In step S505, interrupt processing other than stack overflow is executed, and the interrupt processing ends.

以上のように実施することで、本発明のスタック領域の拡張方法によれば、仮想記憶等を使用することなく、スタックオーバーフローを起こしたタスクを停止することなく実行を継続することができ、停止させることが許されないタスクの実行を保証できる。   By carrying out as described above, according to the stack area expansion method of the present invention, execution can be continued without stopping the task that caused the stack overflow without using virtual memory or the like. It is possible to guarantee the execution of tasks that are not allowed to occur.

ここで、第1の実施形態及び第2の実施形態に係る処理を実施するためのハードウェアの構成の一例としてのコンピュータ600を図6に示す。コンピュータ600は、図6に示すように、CPU601と、ROM602と、RAM603と、キーボード(KB)609のキーボードコントローラ(KBC)605とを有する。更に、表示部としてのCRTディスプレイ(CRT)610のCRTコントローラ(CRTC)606と、ハードディスク(HD)611及びフレキシブルディスク(FD)612のディスクコントローラ(DKC)607を有する。更に、ネットワーク640との接続のためのネットワークインターフェースコントローラ(NIC)608を有する。コンピュータ600が有するこれら各部は、システムバス604を介して互いに通信可能に接続される。   Here, FIG. 6 illustrates a computer 600 as an example of a hardware configuration for performing the processing according to the first embodiment and the second embodiment. As shown in FIG. 6, the computer 600 includes a CPU 601, a ROM 602, a RAM 603, and a keyboard controller (KBC) 605 of a keyboard (KB) 609. Furthermore, a CRT controller (CRTC) 606 of a CRT display (CRT) 610 as a display unit and a disk controller (DKC) 607 of a hard disk (HD) 611 and a flexible disk (FD) 612 are provided. Further, a network interface controller (NIC) 608 for connection to the network 640 is included. These units included in the computer 600 are communicably connected to each other via a system bus 604.

CPU601は、ROM602或いはHD611に記憶されたソフトウェア、或いはFD612より供給されるソフトウェアを実行することで、システムバス604に接続された各構成部を総括的に制御する。すなわち、CPU601は、所定の処理シーケンスに従った処理プログラムを、ROM602、或いはHD611、或いはFD612から読み出して実行することで、本実施の形態での動作を実現するための制御を行う。   The CPU 601 comprehensively controls each component connected to the system bus 604 by executing software stored in the ROM 602 or the HD 611 or software supplied from the FD 612. That is, the CPU 601 performs a control for realizing the operation in the present embodiment by reading a processing program according to a predetermined processing sequence from the ROM 602, the HD 611, or the FD 612 and executing it.

RAM603は、CPU601の主メモリ或いはワークエリア等として機能する。KBC605は、KB609や図示していないポインティングデバイス等からの指示入力を制御する。CRTC606は、CRT610の表示を制御する。DKC607は、ブートプログラム、種々のアプリケーション、編集ファイル、ユーザファイル、ネットワーク管理プログラム、及び本実施の形態における所定の処理プログラム等を記憶するHD611及びFD612とのアクセスを制御する。NIC608は、必要に応じて、ネットワーク640上の装置或いはシステムと双方向にデータをやりとりする。   The RAM 603 functions as a main memory or work area for the CPU 601. The KBC 605 controls instruction input from the KB 609 or a pointing device (not shown). The CRTC 606 controls the display of the CRT 610. The DKC 607 controls access to the HD 611 and the FD 612 that store a boot program, various applications, edit files, user files, a network management program, a predetermined processing program in the present embodiment, and the like. The NIC 608 exchanges data bidirectionally with devices or systems on the network 640 as necessary.

また、本発明を実現するために、上述した実施形態の機能を実現するソフトウェアのプログラムコード(コンピュータプログラム)を記録した記憶媒体を用いても良い。この場合には記憶媒体をシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(又はCPUやMPU)が記憶媒体に格納されたプログラムコードを読み出し実行することによって本発明の目的が達成される。   In order to realize the present invention, a storage medium in which a program code (computer program) of software that realizes the functions of the above-described embodiments may be used. In this case, the object of the present invention is achieved by supplying the storage medium to the system or apparatus, and the computer (or CPU or MPU) of the system or apparatus reads and executes the program code stored in the storage medium.

この場合、記憶媒体から読み出されたプログラムコード自体が上述した実施形態の機能を実現することになり、プログラムコード自体及びそのプログラムコードを記憶した記憶媒体は本発明を構成することになる。   In this case, the program code itself read from the storage medium realizes the functions of the above-described embodiments, and the program code itself and the storage medium storing the program code constitute the present invention.

プログラムコードを供給するための記憶媒体としては、例えば、フレキシブルディスク、ハードディスク、光ディスク、光磁気ディスク、CD−ROM、CD−R、磁気テープ、不揮発性のメモリカード、ROM等を用いることができる。   As a storage medium for supplying the program code, for example, a flexible disk, a hard disk, an optical disk, a magneto-optical disk, a CD-ROM, a CD-R, a magnetic tape, a nonvolatile memory card, a ROM, or the like can be used.

また、そのプログラムコードの指示に基づき、コンピュータ上で稼動しているOS(基本システム或いはオペレーティングシステム)等が実際の処理の一部又は全部を行う場合も含まれることは言うまでもない。   Needless to say, the OS (basic system or operating system) running on the computer performs part or all of the actual processing based on the instruction of the program code.

さらに、記憶媒体から読み出されたプログラムコードが、コンピュータに挿入された機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに書き込まれてもよい。この場合には、書き込まれたプログラムコードの指示に基づき、その機能拡張ボードや機能拡張ユニットに備わるCPU等が実際の処理の一部又は全部を行ってもよい。   Furthermore, the program code read from the storage medium may be written in a memory provided in a function expansion board inserted into the computer or a function expansion unit connected to the computer. In this case, based on the instruction of the written program code, the CPU or the like provided in the function expansion board or function expansion unit may perform part or all of the actual processing.

本発明の処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process of this invention. 本発明のスタックオーバーフロー前後のスタック領域を表すメモリマップを示す図である。It is a figure which shows the memory map showing the stack area | region before and after the stack overflow of this invention. 本発明のタスク管理テーブルとスタック領域の関係を表す図である。It is a figure showing the relationship between the task management table of this invention, and a stack area | region. 本発明のタスクのスケジューリングを管理するタスクキューを表す図である。It is a figure showing the task queue which manages the scheduling of the task of this invention. 本発明の第2の実施の形態に係る処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the process which concerns on the 2nd Embodiment of this invention. 本発明に係る処理を実施するためのハードウェアの一例を示す図である。It is a figure which shows an example of the hardware for implementing the process which concerns on this invention.

符号の説明Explanation of symbols

600 コンピュータ
601 CPU
602 ROM
603 RAM
607 ディスクコントローラ(DKC)
611 ハードディスク(HD)
600 Computer 601 CPU
602 ROM
603 RAM
607 Disk controller (DKC)
611 Hard Disk (HD)

Claims (4)

スタックオーバーフローを起こしたタスクのスタック領域を拡張するスタック領域の拡張方法であって、
スタックオーバーフローの検出を待つステップと、
前記スタックオーバーフローによってスタック領域が破壊されるタスクを検索するステップと、
前記スタック領域が破壊されるタスクを停止するステップと、
前記オーバーフローを起こしたタスクのスタック領域を拡張するステップとを有することを特徴とするスタック領域の拡張方法。
A stack area expansion method for expanding a stack area of a task that has caused a stack overflow,
Waiting for stack overflow detection;
Searching for a task whose stack area is destroyed by the stack overflow;
Stopping a task that destroys the stack area;
And expanding the stack area of the task that has caused the overflow.
前記オーバーフローを起こしたタスクのスタック領域を拡張するステップは、オーバーフローを起こしたタスクのスタックサイズを、オーバーフローによって破壊されるタスクのスタックサイズを足した値にすることでスタック領域を拡張することを特徴とする請求項1に記載のスタック領域の拡張方法。   The step of expanding the stack area of the task that caused the overflow is characterized in that the stack area is expanded by setting the stack size of the task that caused the overflow to a value obtained by adding the stack size of the task that is destroyed by the overflow. The method for expanding a stack area according to claim 1. 前記スタックオーバーフローの検出を待つステップは、割込みが発生したときに実行され、割込みの要因がスタックオーバーフローであると判断された時に前記タスクを検索するステップを実行し、そうでない場合は処理を行わずに復帰することでスタックオーバーフローの検出を待つことを特徴とする請求項1に記載のスタック領域の拡張方法。   The step of waiting for the detection of the stack overflow is executed when an interrupt occurs, and the step of searching for the task is executed when it is determined that the cause of the interrupt is a stack overflow. 2. The stack area expansion method according to claim 1, further comprising waiting for detection of a stack overflow by returning to step (a). スタックオーバーフローを起こしたタスクのスタック領域を拡張するスタック領域の拡張方法をコンピュータに実行させるためのプログラムであって、
スタックオーバーフローの検出を待つステップと、
前記スタックオーバーフローによってスタック領域が破壊されるタスクを検索するステップと、
前記スタック領域が破壊されるタスクを停止するステップと、
前記オーバーフローを起こしたタスクのスタック領域を拡張するステップとをコンピュータに実行させるためのプログラム。
A program for causing a computer to execute a stack area expansion method for expanding a stack area of a task that has caused a stack overflow,
Waiting for stack overflow detection;
Searching for a task whose stack area is destroyed by the stack overflow;
Stopping a task that destroys the stack area;
A program for causing a computer to execute a step of expanding a stack area of a task that has caused the overflow.
JP2008095437A 2008-04-01 2008-04-01 Expansion method for stack region and program Pending JP2009251681A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008095437A JP2009251681A (en) 2008-04-01 2008-04-01 Expansion method for stack region and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008095437A JP2009251681A (en) 2008-04-01 2008-04-01 Expansion method for stack region and program

Publications (1)

Publication Number Publication Date
JP2009251681A true JP2009251681A (en) 2009-10-29

Family

ID=41312372

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008095437A Pending JP2009251681A (en) 2008-04-01 2008-04-01 Expansion method for stack region and program

Country Status (1)

Country Link
JP (1) JP2009251681A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013534681A (en) * 2010-07-16 2013-09-05 クアルコム,インコーポレイテッド System and method for allocating parts of a shared stack
KR102365261B1 (en) * 2022-01-17 2022-02-18 삼성전자주식회사 A electronic system and operating method of memory device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013534681A (en) * 2010-07-16 2013-09-05 クアルコム,インコーポレイテッド System and method for allocating parts of a shared stack
KR102365261B1 (en) * 2022-01-17 2022-02-18 삼성전자주식회사 A electronic system and operating method of memory device

Similar Documents

Publication Publication Date Title
US8230201B2 (en) Migrating sleeping and waking threads between wake-and-go mechanisms in a multiple processor data processing system
US8171476B2 (en) Wake-and-go mechanism with prioritization of threads
US8640142B2 (en) Wake-and-go mechanism with dynamic allocation in hardware private array
US8938631B2 (en) Energy efficient implementation of read-copy update for light workloads running on systems with many processors
US8732683B2 (en) Compiler providing idiom to idiom accelerator
JP5212360B2 (en) Control program, control system, and control method
US20110173630A1 (en) Central Repository for Wake-and-Go Mechanism
US9043806B2 (en) Information processing device and task switching method
JP6399916B2 (en) Information processing apparatus and control method thereof
US9378069B2 (en) Lock spin wait operation for multi-threaded applications in a multi-core computing environment
JP2008097105A (en) Storage device and start-up method
WO2011096163A1 (en) Information processing system, exclusive control method, and program for exclusive control
JP2011103093A (en) Computer that boots up fast
JP5391422B2 (en) Memory management method, computer system, and program
JP2009104443A (en) Method for starting os
JP2009251681A (en) Expansion method for stack region and program
KR100994723B1 (en) selective suspend resume method of reducing initial driving time in system, and computer readable medium thereof
JP6645348B2 (en) Information processing apparatus, information processing program, and information processing method
US8095784B2 (en) Computer system and method for activating basic program therein
US9619277B2 (en) Computer with plurality of processors sharing process queue, and process dispatch processing method
US20130191839A1 (en) Information processing apparatus, control method therefor, and computer-readable storage medium
JP2010044699A (en) Information processor
JP2010026575A (en) Scheduling method, scheduling device, and multiprocessor system
JP2000298591A (en) Program starting device and method and recording medium
KR20070047122A (en) Multi-threading controlling system and method for operating the system