JP4984153B2 - Block avoidance method in real-time task - Google Patents
Block avoidance method in real-time task Download PDFInfo
- Publication number
- JP4984153B2 JP4984153B2 JP2007236390A JP2007236390A JP4984153B2 JP 4984153 B2 JP4984153 B2 JP 4984153B2 JP 2007236390 A JP2007236390 A JP 2007236390A JP 2007236390 A JP2007236390 A JP 2007236390A JP 4984153 B2 JP4984153 B2 JP 4984153B2
- Authority
- JP
- Japan
- Prior art keywords
- real
- time
- task
- time task
- single processor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Description
本発明は、対称型マルチプロセッサ(SMP)に対応可能なオペレーティングシステムに関し、特に、そのようなオペレーティングシステムをシングルプロセッサによって動作させる場合において実時間タスクに対するブロック回避方法に関する。 The present invention relates to an operating system capable of supporting a symmetric multiprocessor (SMP), and more particularly to a block avoidance method for a real-time task when such an operating system is operated by a single processor.
コンピュータに内蔵される組込み機器では、実時間処理が必要になる場合が多い。一方、組込み機器の高度化が求められ、内蔵されるコンピュータが大規模化され、その上で動作するソフトウエアの複雑化が進んでいる。従って、組込み用オペレーティングシステムには、実時間処理機能に加えて、ファイルシステム、ネットワーク、グラフィックス、ユーザインターフェース等の汎用機能が必要となる。 Embedded devices built into computers often require real-time processing. On the other hand, the advancement of embedded devices is required, the built-in computers are becoming larger, and the software that operates on them is becoming more complex. Therefore, the embedded operating system requires general functions such as a file system, a network, graphics, and a user interface in addition to the real-time processing function.
そこで、実時間処理機能と汎用機能を併せ持つオペレーティングシステムの開発方法として、UNIX(登録商標)やウインドウズ(登録商標)等の汎用のオペレーティングシステムに、実時間処理機能を付加する手法が用いられている。 Therefore, as a method for developing an operating system having both a real-time processing function and a general-purpose function, a method of adding a real-time processing function to a general-purpose operating system such as UNIX (registered trademark) or Windows (registered trademark) is used. .
UNIXの一種であるリナックス(Linux)は、アプリケーション、ライブラリ、デバイスドライバなどのソフトウエア部品が多数揃っているため、利便性が高い。また、殆どがオープンソースであり、仕様に合わない場合には、修正を加えることが可能である。 Linux (Linux), which is a type of UNIX, is highly convenient because it has many software components such as applications, libraries, and device drivers. Also, most of them are open source and can be modified if they do not meet the specifications.
リナックスのカーネルは本来実時間処理機能を有さない。本願発明者は、リナックスに実時間処理機能を付加する試みを行なってきた。リナックスオペレーティングシステムは、カーネルとアプリケーションからなる。カーネルは絶対に必要のコア部分と、取り外し可能なオプション部分からなる。コア部分は、タスクスケジューリング機能、アプリケーションとのインターフェースを取るシステムコール等を有する。オプション部分は、デバイスドライバ、ファイルシステム等を有する。リナックスのカーネルのコア部分を実時間処理用に変更することにより、実時間処理機能を有するリナックスオペレーティングシステム、即ち、実時間リナックスが得られる。 The Linux kernel does not inherently have real-time processing capabilities. The inventor of the present application has attempted to add a real-time processing function to Linux. The Linux operating system consists of a kernel and applications. The kernel consists of absolutely necessary core parts and removable optional parts. The core part has a task scheduling function, a system call for interfacing with an application, and the like. The optional part has a device driver, a file system, and the like. By changing the core part of the Linux kernel for real-time processing, a Linux operating system having real-time processing functions, that is, real-time Linux is obtained.
本願発明の発明者らは、1998年に、Intel(登録商標)のx86アーキテクチャ用のリナックスカーネル2.0に対応した実時間リナックスであるART-Linux2.0を開発した。本願発明の発明者らは、2000年に、リナックスカーネル2.2に対応したART-Linux2.2を開発し、2004年に、リナックスカーネル2.4に対応したART-Linux2.4を開発した。ART-Linuxは本願発明者が開発した実時間リナックスの名称である。 In 1998, the inventors of the present invention developed ART-Linux 2.0, which is a real-time Linux compatible with Linux kernel 2.0 for Intel (registered trademark) x86 architecture. The inventors of the present invention developed ART-Linux 2.2 corresponding to the Linux kernel 2.2 in 2000, and developed ART-Linux 2.4 corresponding to the Linux kernel 2.4 in 2004. ART-Linux is the name of real-time Linux developed by the present inventor.
一般に実時間オペレーティングシステムは、次の機能と性能を持つことが一般的である。
(1)固定優先度に基づくタスクスケジューリング
(2)プリエンプティブカーネル
(3)十分に小さい割り込みレイテンシ
ART-Linux2.4における、実時間処理機能について説明する。
In general, a real-time operating system generally has the following functions and performance.
(1) Task scheduling based on fixed priority (2) Preemptive kernel (3) Sufficiently low interrupt latency
The real-time processing function in ART-Linux 2.4 will be described.
(1)ミューテックスロックによるスピンロックの置換
最大割込みレイテンシを小さくするためには、最長プリエンプト禁止期間を短くする必要がある。リナックスカーネルでは、プリエンプトを禁止するクリティカルセクション(複数の処理が同時期に実行されると、破綻をきたす部分)が全ソースコードに偏在するため、最長プリエンプト禁止期間の特定は困難である。最長プリエンプト禁止期間を短くするために、ART-Linux2.4では、リナックスカーネルで排他制御を行うスピンロックを、多段階優先度承継機能付きミューテックスロック(実時間ロックと呼ぶ)に置換した。それによって、リナックスカーネルに遍在するプリエンプト禁止期間全てプリエンプト可能となる。最大割込みレイテンシは、ART-Linux2.4固有のタスクスケジューラや実時間ロックの処理中等にだけ偏在するプリエンプト禁止の最長値によって決まるようになる。よって、リナックスカーネルのどのような機能を利用しても、最大割込みレイテンシを保証することができる。
(1) Replacement of spin lock by mutex lock In order to reduce the maximum interrupt latency, it is necessary to shorten the longest preemption prohibition period. In the Linux kernel, it is difficult to specify the longest preemption prohibition period because critical sections that prohibit preemption (parts that fail when multiple processes are executed at the same time) are unevenly distributed in all source codes. In order to shorten the maximum preemption prohibition period, ART-Linux 2.4 replaced the spin lock, which performs exclusive control with the Linux kernel, with a mutex lock with multi-level priority inheritance (referred to as real-time lock). As a result, it is possible to preempt all the preemption prohibition periods ubiquitous in the Linux kernel. The maximum interrupt latency is determined by the longest preempt prohibition value that is unevenly distributed only during processing of the task scheduler specific to ART-Linux 2.4 or real-time lock processing. Therefore, the maximum interrupt latency can be guaranteed regardless of the function of the Linux kernel.
(2)多段階優先度承継機能
実時間処理においてタスク間に依存関係があると、優先度逆転が発生する。上述のように、ミューテックスロックをロックしたままタスクがスイッチし、別のタスクがこのミューテックスロックによってブロックされ、優先度逆転が発生する。そこで、上述のように、多段階優先度承継機能を付加した。また、あるミューテックスロックをロックしたタスクが、別のミューテックスロックにブロックされることがある。そのため、優先度を多段階に継承する機能を実装した。
(2) Multi-level priority inheritance function When there is a dependency relationship between tasks in real-time processing, priority inversion occurs. As described above, the task switches with the mutex lock locked, and another task is blocked by this mutex lock, resulting in a priority inversion. Therefore, as described above, a multi-level priority inheritance function has been added. Also, a task that locks a mutex lock may be blocked by another mutex lock. Therefore, we implemented a function that inherits priority in multiple stages.
(3)割込みハンドラタスク
実時間タスクより割込みハンドラを優先した場合、割込みハンドラの実行時間が終了するまで、実時間タスクの実行開始が遅れるので、割込みレイテンシが大きくなる。一方、割込みハンドラより実時間タスクを優先した場合、ある実時間タスクが割込みハンドラの処理待ちになったとき、優先度逆転が発生する。
(3) Interrupt handler task If the interrupt handler is prioritized over the real-time task, the start of execution of the real-time task is delayed until the execution time of the interrupt handler ends, so the interrupt latency increases. On the other hand, when priority is given to a real-time task over an interrupt handler, priority inversion occurs when a certain real-time task waits for interrupt handler processing.
よって、割込みハンドラにも優先度を割り当て、実時間タスクと依存関係のある割込みハンドラの優先度を高く設定する必要がある。ART-Linux2.4では、割込みハンドラを実時間処理タスク上で実行することにより、優先度を割り当てている。また、実時間ロックの優先度承継機能により、依存関係のある実時間タスクと同じ優先度が自動的に割り当てられるので、ユーザアプリケーションが割込みハンドラの優先度を設定する必要はない。 Therefore, it is necessary to assign a priority to the interrupt handler and to set a high priority for the interrupt handler having a dependency relationship with the real-time task. ART-Linux 2.4 assigns priorities by executing interrupt handlers on real-time processing tasks. In addition, since the priority inheritance function of the real time lock automatically assigns the same priority as the dependent real time task, it is not necessary for the user application to set the priority of the interrupt handler.
(4)対称型マルチプロセッサ(SMP)に対して非対応
リナックスカーネルのSMP対応において最も基本的な機能として、タスクスケジューラと、排他制御を行うスピンロックがある。ART-Linux2.4では、実時間タスク用に独自のスケジューラがあり、スピンロックを実時間ロックに置換している。しかしながら、これらはSMPに対応していない。そのため、マルチコアプロセッサをふくめたSMPハードウエア上で動作させても、1つのプロセッサしか動作しない。
(4) Not compatible with symmetric multiprocessor (SMP) The most basic functions in SMP support of the Linux kernel include a task scheduler and a spin lock that performs exclusive control. ART-Linux 2.4 has its own scheduler for real-time tasks, replacing spinlocks with realtime locks. However, these do not support SMP. For this reason, only one processor operates even when operated on SMP hardware including a multi-core processor.
対称型マルチプロセッサ(SMP)に対応可能なオペレーティングシステムをシングルプロセッサによって動作させる場合に、実時間タスクがミューテックスロック(実時間ロック)に排他制御(ブロック)されることがある。実時間タスクがミューテックスロックにブロックされると、実時間処理機能が低下する。 When an operating system capable of supporting a symmetric multiprocessor (SMP) is operated by a single processor, a real-time task may be exclusively controlled (blocked) by a mutex lock (real-time lock). When real-time tasks are blocked by mutex locks, real-time processing capabilities are degraded.
本発明の目的は、対称型マルチプロセッサ(SMP)に対応可能な実時間オペレーティングシステムをシングルプロセッサによって動作させるとき、実時間タスクがミューテックスロックにブロックされて、実時間処理機能が低下することを防止する技術を提供することにある。 It is an object of the present invention to prevent a real-time task from being blocked by a mutex lock and degrading a real-time processing function when a real-time operating system capable of supporting a symmetric multiprocessor (SMP) is operated by a single processor. It is to provide technology to do.
本発明によると、実時間タスクの処理を別の非実時間タスクに受け渡すことによって、実時間タスクがミューテックスロックによって排他制御(ブロック)されることを回避する。非実時間タスクに受け渡す処理は、比較的優先度が低い処理であり、ユーザが予め指定する必要がある。こうして、比較的優先度が高い処理は、実時間タスクにて行い、比較的優先度が低い処理は、非実時間タスクが行なう。 According to the present invention, by passing the processing of the real-time task to another non-real-time task, the real-time task is prevented from being exclusively controlled (blocked) by the mutex lock. The process handed over to the non-real-time task is a process with a relatively low priority, and needs to be designated in advance by the user. Thus, processing with a relatively high priority is performed by a real-time task, and processing with a relatively low priority is performed by a non-real-time task.
本発明によると、実時間タスクがミューテックスロックにブロックされることが回避されるから、実時間処理機能の低下を防止することができる。 According to the present invention, since the real-time task is prevented from being blocked by the mutex lock, it is possible to prevent the real-time processing function from being deteriorated.
本願の発明者らは、実時間リナックカーネルを開発する過程で、リナックスカーネルを対称型マルチプロセッサ(SMP)に対応させることと、実時間リナックカーネルを安定化させることが、同一の手法により解決できることを見出した。そこで、SMP対応のリナックスカーネルにおいて、プロセッサをタスクに置き換えることにした。こうして、SMP対応のリナックスカーネルは、シングルプロセッサシステムで実時間リナックスカーネルとして利用可能となった。以下では、SMP対応のリナックスカーネルを、シングルプロセッサシステムにて実時間リナックスカーネルとして動作させる場合を説明する。 In the process of developing a real-time linux kernel, the inventors of the present application can solve the problem of making the Linux kernel compatible with a symmetric multiprocessor (SMP) and stabilizing the real-time linux kernel by the same method. I found. Therefore, in the SMP-compatible Linux kernel, the processor is replaced with a task. Thus, the SMP-compatible Linux kernel can be used as a real-time Linux kernel in a single processor system. In the following, a case will be described in which an SMP-compatible Linux kernel is operated as a real-time Linux kernel in a single processor system.
本願発明者は、リナックスカーネル2.6に対応したART-Linux2.6を開発した。ART-Linux2.6では、「仮想プロセッサ番号に基づく排他制御」と「キューによる実時間タスクのブロック回避」が導入された。本発明は、「キューによる実時間タスクのブロック回避」に対応する。 The inventor of the present application has developed ART-Linux 2.6 corresponding to Linux kernel 2.6. ART-Linux2.6 introduced "exclusive control based on virtual processor number" and "blocking real-time task block by queue". The present invention corresponds to “blocking real-time task block by queue”.
以下では、SMP対応のリナックスカーネルを、シングルプロセッサシステムにて実時間リナックスカーネルとして動作させる場合を説明する。しかしながら、リナックスカーネルは例として説明するのであって、本発明は、リナックスカーネルに限定されるものではない。本発明は、SMP対応のオペレーティングシステムであれば、どのようなものであってもよい。 In the following, a case will be described in which an SMP-compatible Linux kernel is operated as a real-time Linux kernel in a single processor system. However, the Linux kernel is described as an example, and the present invention is not limited to the Linux kernel. The present invention may be any operating system that supports SMP.
図1を参照して本願発明の発明者らが開発したART-Linux2.4における実時間タスクについて説明する。SMP対応のリナックスカーネルでは、タスク間の共有データにアクセスするクリティカルセクションは、スピンロックによって排他制御を行っていた。ART-Linux2.4では、上述のように、スピンロックの代替としてミューテックスロックを用いる。即ち、ART-Linux2.4では、タスクは、ミューテックスロックによって排他制御される。 A real-time task in ART-Linux 2.4 developed by the inventors of the present invention will be described with reference to FIG. In the SMP-compatible Linux kernel, a critical section that accesses shared data between tasks is controlled exclusively by spin lock. ART-Linux 2.4 uses mutex locks as an alternative to spinlocks as described above. That is, in ART-Linux 2.4, tasks are exclusively controlled by mutex locks.
図1は、シングルプロセッサ10を備えたコンピュータシステムでの主要部のみを図示する。このコンピュータシステムは、シングルプロセッサ10以外に、実時間リナックスカーネルを格納したハードディスク、それを動作させるときに用いるメモリ等を備えるが、ここでは省略する。
FIG. 1 shows only main parts in a computer system including a
図示のように、実時間リナックスカーネルをシングルプロセッサシステムにて動作させる。例えば、実時間タスク11が、タスク間の共有データ15にアクセスしているとき、他のタスク12は、ミューテックスロック14によって排他制御される。即ち、実時間タスク11の実行中、他のタスク12は、ミューテックスロック14によって排他制御(ブロック)され、共有データ15のうち、実時間タスク11が使用している領域にアクセスすることはできない。更に、割込みハンドラ13も同様に、ミューテックスロック14によって排他制御(ブロック)される。ミューテックスロックは、一般的には異なるタスク間での排他制御であり、同時に一つのタスクしかクリティカルセクションに入ることを許されない。ミューテックスロックは、ロックしたタスクのみがアンロックできる。
As shown, a real-time Linux kernel is run on a single processor system. For example, when the real-
ミューテックスロック14によって排他制御(ブロック)されたタスク12や割込みハンドラ13の実行は中断され、休眠状態になる。その後、実時間タスク11がミューテックスロックを解除したときに、タスク12か割込みハンドラ13のいずれかの実行が再開され、実行状態に戻る。
Execution of the
図2を参照して本発明の概念を説明する。実時間リナックスカーネルのうち、比較的優先度が高い実時間タスク21にも、比較的重要でない処理23が含まれる。この処理23は、ミューテックスロックによって排他制御(ブロック)される可能性が高い。このような処理23を、実時間タスク21から非実時間タスク22に受け渡す。それによって、実時間タスク21は、ミューテックスロックによって排他制御されることなく実行される。一方、非実時間タスク22では、処理23がミューテックスロックによって排他制御される可能性がある。しかしながら、処理23がミューテックスロックによって排他制御されても、実時間タスク21の実時間性能が低下することはない。非実時間タスク22では、例えば、実時間タスク21が終了したとき、処理23を実行する。
The concept of the present invention will be described with reference to FIG. Of the real-time Linux kernel, the real-
図3及び図4を参照して本発明による排他制御回避方法を説明する。図3は、比較的優先度が高い実時間タスク内の処理を実行する場合を示す。この処理は、ミューテックスロックによって排他制御される可能性があるものとする。先ず、ステップS101にて、このタスクは、ミューテックスロックの処理を行なう。ミューテックスロックの処理前に、他のタスクが、このミューテックスロックをロックしていなかった場合には、次のステップS102に進む。他のタスクが、このミューテックスロックをロックしていた場合には、このタスクは休眠状態となり、他のタスクにスイッチする。他のタスクがロックを解除したら、このタスクは実行状態となり、次のステップS102に進む。ステップS102にて、処理fを実行する。この処理fでは、データ31を使用する。処理fが終了してから、ステップS103にて、ミューテックスロック処理を解除する。このように、処理fは、ステップS101にて、他のタスクによるミューテックスロックのロックによって排他制御される可能性がある。そこで、図3のプロシージャ0を、図4に示す2つのプロシージャ1、2に分解する。
An exclusive control avoidance method according to the present invention will be described with reference to FIGS. FIG. 3 shows a case where processing in a real-time task having a relatively high priority is executed. It is assumed that this process may be exclusively controlled by a mutex lock. First, in step S101, this task performs mutex lock processing. If another task has not locked the mutex lock before the mutex lock processing, the process proceeds to the next step S102. If another task has locked this mutex lock, this task goes to sleep and switches to another task. If another task releases the lock, this task is in an execution state and proceeds to the next step S102. In step S102, process f is executed. In this process f,
図4に示すように、プロシージャ1は優先度が高い実時間タスク21における処理である。プロシージャ1では、先ず、ステップS201にて、割込み禁止をかける。割込み禁止は、スケジューラを呼び出さない排他制御であり、スピンロック等であってもよい。ステップS202にて、処理fを受け渡す。処理fの受け渡しは、例えば、処理f及びデータをキュー32に入れる。キュー32はメモリの領域を意味する。処理fの受け渡しが終わると、ステップS203にて、割込み禁止を解除する。割込み禁止期間中は、割込み処理に分岐しないので、他のタスクや割込みハンドラが実行されることは無く、他のタスクや割込みハンドラが共有データにアクセスすることは無い。
As shown in FIG. 4, the
プロシージャ2は優先度が低い非実時間タスク22の処理である。先ず、ステップS301にて、割込み禁止をかける。ステップS302にて、処理fを受け取る。即ち、キュー32から処理fとデータを取り出す。処理fの受け取りが終わると、ステップS303にて、割込み禁止を解除する。ステップS304からステップS306は、プロシージャ0と同様である。即ち、ステップS304にて、ミューテックスロック処理を行なう。次に、ステップS305にて、処理fを実行する。この処理fでは、データ31を使用する。処理fが終了してから、ステップS306にて、ミューテックスロックのロックを解除する。
上述のように、処理fの実行前に、ステップS304にて、非実時間タスク22は、他のタスクによるミューテックスロックのロックによって中断される可能性がある。しかしながら、非実時間タスク22は重要性が少ないので、処理の中断が起きても不都合はない。処理fの実行前に、非実時間タスク22がミューテックスロックによってブロックされても、実時間タスクの実時間性能を低下させることはない。
As described above, before execution of the process f, in step S304, the non-real-
上述のように、本発明では、実時間タスクの処理のうち、比較的重要度が低い処理、即ち、ミューテックスロックによってブロックされ易い処理を、非実時間タスクに移転し、そこで実行する。それによって、実時間タスクが、ミューテックスロックによってブロックされることが回避され、実時間タスクの実行を効率化することができる。 As described above, in the present invention, a process with relatively low importance among real time task processes, that is, a process that is easily blocked by a mutex lock is transferred to a non-real time task and executed there. Thereby, it is avoided that the real-time task is blocked by the mutex lock, and the execution of the real-time task can be made efficient.
従って、実時間タスクの処理のうち、比較的重要度が低い処理を予めユーザが選定する必要がある。例えば、ユーザが、非実時間処理のコードを探し出してもよい。このような比較的重要度が低い処理として次の2つの例が挙げられる。 Therefore, it is necessary for the user to select a process with a relatively low importance among the processes of the real-time task in advance. For example, the user may search for a code for non-real-time processing. The following two examples are given as such relatively low importance processing.
(1)タスクの終了処理
タスクの終了処理は、SMP対応のリナックスカーネルにおいて問題を起こし易い処理の1つである。タスクが終了すると、それを親タスクに通知し、スケジューラを実行して別のタスクにスイッチする。親タスクは、終了したタスクのタスク構造体のメモリ領域を開放する。終了したタスクのスイッチより後に、親タスクのメモリの開放処理が実行される必要があるが、別のプロセッサで実行されていた場合、その順序が保証されない。それが問題である。
(1) Task termination processing Task termination processing is one of the processes that are likely to cause problems in an SMP-compatible Linux kernel. When the task ends, it notifies the parent task and executes the scheduler to switch to another task. The parent task releases the memory area of the task structure of the finished task. The memory release processing of the parent task needs to be executed after the switch of the finished task. However, if it is executed by another processor, the order is not guaranteed. That is the problem.
リナックスカーネル2.6では、親プロセスによるメモリ開放よりも終了プロセスのスイッチが遅かった場合、親プロセスでは、処理されず、スイッチした次のタスクがメモリを開放する処理を行なうことで、問題を回避している。この処理が、ART-Linux2.6で行なわれた場合、次のタスクが実時間タスクである可能性がある。従って、メモリ開放処理に必要な実時間ロック(ミューテックスロック)にブロックされる可能性がある。そこで、本発明によると、メモリ開放処理を、次に実行される非実時間タスクに受け渡すことによって、実時間処理性能の低下を防止する。 In Linux kernel 2.6, if the end process switch is slower than the memory release by the parent process, the parent process is not processed, and the next task that is switched performs the process of releasing the memory to avoid the problem. Yes. If this process is performed in ART-Linux 2.6, the next task may be a real-time task. Therefore, there is a possibility that the real time lock (mutex lock) necessary for the memory release processing is blocked. Therefore, according to the present invention, the reduction in real-time processing performance is prevented by transferring the memory release processing to the next non-real-time task to be executed.
(2)ラン・キュー間の移動処理
ART-Linux2.6では、O(1)スケジューラが導入された。タスクの優先度に応じて複数のラン・キュー(run queue)と、実行可能タスクを含むラン・キューに応じたビットが1となるビットマップ変数あり、これらから最高優先度タスクの検索を、O(1)の処理量で実行するスケジューラである。ART-Linux2.6では、リナックスのスケジューラは実時間タスクを管理しない。リナックスのラン・キューから実時間タスクを削除すべきだが、ART-Linux2.4では、削除していなかった。しかし、O(1)スケジューラと整合しないので、実時間タスクをリナックスのラン・キューから削除することにした。
(2) Transfer processing between run and queue
ART-Linux2.6 introduced the O (1) scheduler. There are multiple run queues depending on the priority of the task, and a bitmap variable in which the bit corresponding to the run queue including the executable task is set to 1, from which the search for the highest priority task is performed. The scheduler is executed with the processing amount of (1). In ART-Linux 2.6, the Linux scheduler does not manage real-time tasks. Real-time tasks should be removed from the Linux run queue, but not in ART-Linux 2.4. However, since it is not consistent with the O (1) scheduler, the real-time task is deleted from the Linux run queue.
すると、実時間タスクが非実時間タスクに戻ったとき、リナックスのラン・キューに再挿入しなければならない場合がある。即ち、その処理を実時間タスクが行なう可能性がある。ラン・キューは共有データであり、アクセス時には対応する実時間ロック(ミューテックスロック)による排他制御が必要である。そこで、本発明によると、ラン・キューを、次に実行される非実時間タスクに受け渡すことによって、実時間処理性能の低下を防止する。 Then, when a real-time task returns to a non-real-time task, it may have to be reinserted into the Linux run queue. That is, the process may be performed by a real-time task. The run queue is shared data and requires exclusive control by a corresponding real-time lock (mutex lock) at the time of access. Therefore, according to the present invention, the run queue is transferred to the next non-real time task to be executed, thereby preventing the real time processing performance from being deteriorated.
以上本発明の例を説明したが本発明は上述の例に限定されるものではなく、特許請求の範囲に記載された発明の範囲にて様様な変更が可能であることは当業者に容易に理解されよう。 The example of the present invention has been described above, but the present invention is not limited to the above-described example, and various modifications can be easily made by those skilled in the art within the scope of the invention described in the claims. It will be understood.
例えば、以上にて、SMP対応のリナックスカーネルをシングルプロセッサシステムにて動作させる場合を説明した。しかしながら、リナックスカーネルは例として説明するのであって、本発明は、リナックスカーネルに限定されるものではない。本発明は、SMP対応のオペレーティングシステムであれば、どのようなものであってもよい。 For example, the case where an SMP-compatible Linux kernel is operated on a single processor system has been described above. However, the Linux kernel is described as an example, and the present invention is not limited to the Linux kernel. The present invention may be any operating system that supports SMP.
10…CPU、11,12…タスク、13…割込みハンドラ、14…ミューテックロック、15…共有データ、21、22…タスク、23…処理、31…データ、32…キュー 10 ... CPU, 11, 12 ... task, 13 ... interrupt handler, 14 ... mutek lock, 15 ... shared data, 21, 22 ... task, 23 ... processing, 31 ... data, 32 ... queue
Claims (10)
前記シングルプロセッサによって、実時間タスクの実行を開始することと、
前記シングルプロセッサによって、割込み禁止処理を実行することと、
前記シングルプロセッサによって、前記実時間タスクから、ユーザが予め指定した所定の処理を取り出して他の非実時間タスクに加えることと、
前記シングルプロセッサによって、前記割込み禁止を解除する処理を実行することと、
前記シングルプロセッサによって、前記実時間タスクから前記所定の処理を取り出した残りの処理を実行することと、
を含み、
前記所定の処理は、ミューテックスロックによって他の処理よりブロックされる可能性が高いとユーザが判定したものであることを特徴とする実時間タスクに対するブロック回避方法。 Of real-time tasks and non-real-time kernel task operating system have you, real-time task is blocked from other tasks by the mutex lock when the operating system capable corresponds to symmetric multiprocessor operating by a single processor In a way to avoid that,
And that by the single processor starts executing real-time tasks,
Executing an interrupt prohibition process by the single processor ;
Taking out a predetermined process previously designated by the user from the real-time task by the single processor and adding it to another non-real-time task;
Executing a process of canceling the interrupt inhibition by the single processor ;
Executing the remaining processing by extracting the predetermined processing from the real-time task by the single processor ;
Only including,
A block avoidance method for a real-time task , wherein the predetermined process is determined by a user as being more likely to be blocked than other processes due to a mutex lock .
前記シングルプロセッサによって、前記他の非実時間タスクの実行を開始することと、
前記シングルプロセッサによって、前記他の非実時間タスクに加えられた前記所定の処理を実行することと、
前記シングルプロセッサによって、前記他の非実時間タスクに加えられた前記所定の処理の実行中は、ミューテックスロックによって他のタスクをブロックすることと、
を含むことを特徴とする実時間タスクに対するブロック回避方法。 The block avoidance method for a real-time task according to claim 1,
Initiating execution of the other non-real-time task by the single processor;
Performing the predetermined processing added to the other non-real-time task by the single processor;
Blocking the other task with a mutex lock during execution of the predetermined process added to the other non-real time task by the single processor;
A block avoidance method for real-time tasks.
前記実時間タスクから前記所定の処理を取り出すことは、前記所定の処理及び前記所定の処理に必要なデータを所定のメモリに格納する処理であることを特徴とする実時間タスクに対するブロック回避方法。 The block avoidance method for a real-time task according to claim 1,
The block avoidance method for a real-time task, wherein extracting the predetermined process from the real-time task is a process of storing the predetermined process and data necessary for the predetermined process in a predetermined memory.
前記所定の処理を他の非実時間タスクに加えることは、前記所定の処理及び前記所定の処理に必要なデータを所定のメモリから読み出す処理であることを特徴とする実時間タスクに対するブロック回避方法。 The block avoidance method for a real-time task according to claim 1 ,
The block avoidance method for a real-time task, wherein adding the predetermined process to another non-real-time task is a process of reading the predetermined process and data necessary for the predetermined process from a predetermined memory .
前記シングルプロセッサによって、前記オペレーティングシステムのカーネルの実時間タスクと非実時間タスクのうち、実時間タスクの実行を開始し、割込み禁止処理を実行し、前記実時間タスクから、ユーザが予め指定した所定の処理を取り出して他の非実時間タスクに加え、前記割込み禁止を解除する処理を実行し、前記実時間タスクから前記所定の処理を取り出した残りの処理を実行し、
前記所定の処理は、ミューテックスロックによって他の処理よりブロックされる可能性が高いとユーザが判定したものであることを特徴とする実時間情報処理装置。 In a real-time information processing apparatus having an operating system capable of supporting a symmetric multiprocessor, a single processor that operates the operating system, and a memory,
Among the real-time task and non- real-time task of the kernel of the operating system, the single processor starts execution of the real-time task , executes the interrupt prohibition process, and from the real-time task, a predetermined user designated in advance Remove the process in addition to other non-real-time tasks, performs a process of canceling the interrupt disabled, it performs the real time remaining processing taken out the predetermined processing from the task,
The real-time information processing apparatus according to claim 1, wherein the predetermined process is determined by the user as being more likely to be blocked than other processes due to a mutex lock .
前記シングルプロセッサによって、前記他の非実時間タスクの実行を開始し、前記他の非実時間タスクに加えられた前記所定の処理を実行し、
前記他の非実時間タスクに加えられた前記所定の処理の実行中は、ミューテックスロックによって他のタスクをブロックすることを特徴とする実時間情報処理装置。 The real-time information processing apparatus according to claim 7,
The execution of the other non-real time task is started by the single processor, and the predetermined process added to the other non-real time task is executed.
A real-time information processing apparatus that blocks another task by a mutex lock during execution of the predetermined process added to the other non-real-time task.
前記所定の処理を前記実時間タスクから取り出すことは、前記所定の処理及び前記所定の処理に必要なデータを前記メモリに格納する処理であることを特徴とする実時間情報処理装置。 The real-time information processing apparatus according to claim 7,
Extracting the predetermined process from the real-time task is a process for storing the predetermined process and data necessary for the predetermined process in the memory.
前記所定の処理を他の非実時間タスクに加えることは、前記所定の処理及び前記所定の処理に必要なデータを前記メモリから読み出す処理であることを特徴とする実時間情報処理装置。 The real-time information processing apparatus according to claim 7 ,
Adding the predetermined process to another non-real-time task is a process for reading out the predetermined process and data necessary for the predetermined process from the memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007236390A JP4984153B2 (en) | 2007-09-12 | 2007-09-12 | Block avoidance method in real-time task |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007236390A JP4984153B2 (en) | 2007-09-12 | 2007-09-12 | Block avoidance method in real-time task |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2009070043A JP2009070043A (en) | 2009-04-02 |
JP4984153B2 true JP4984153B2 (en) | 2012-07-25 |
Family
ID=40606246
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007236390A Expired - Fee Related JP4984153B2 (en) | 2007-09-12 | 2007-09-12 | Block avoidance method in real-time task |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4984153B2 (en) |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6097440A (en) * | 1983-10-31 | 1985-05-31 | Fujitsu Ltd | Virtual multiprocessor device |
JPH01195542A (en) * | 1988-01-30 | 1989-08-07 | Nec Corp | Multi-programming processor |
JP4051703B2 (en) * | 2003-03-31 | 2008-02-27 | 日本電気株式会社 | Parallel processing system and parallel processing program by OS for single processor |
JP2004341878A (en) * | 2003-05-16 | 2004-12-02 | Toshiba Corp | Real-time os and method for detecting deadlock |
JP4179110B2 (en) * | 2003-09-04 | 2008-11-12 | 富士ゼロックス株式会社 | Information processing apparatus, information processing program, and information processing method |
-
2007
- 2007-09-12 JP JP2007236390A patent/JP4984153B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2009070043A (en) | 2009-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4956418B2 (en) | Improvements in or related to operating systems for computer devices | |
US7353346B2 (en) | Read-copy-update (RCU) operations with reduced memory barrier usage | |
US7818306B2 (en) | Read-copy-update (RCU) operations with reduced memory barrier usage | |
KR100911796B1 (en) | Multi processor and multi thread safe message queue with hardware assistance | |
US8132178B2 (en) | System and method for delayed priority boost | |
US7448036B2 (en) | System and method for thread scheduling with weak preemption policy | |
EP2312441B1 (en) | Scheduling of instructions groups for cell processors | |
US20060130061A1 (en) | Use of rollback RCU with read-side modifications to RCU-protected data structures | |
US20040117793A1 (en) | Operating system architecture employing synchronous tasks | |
US11436048B2 (en) | Method of managing task dependencies at runtime in a parallel computing system of a hardware processing system and a hardware acceleration processor | |
WO2014159444A1 (en) | Systems and methods of using a hypervisor with guest operating systems and virtual processors | |
US20020178208A1 (en) | Priority inversion in computer system supporting multiple processes | |
WO2011096163A1 (en) | Information processing system, exclusive control method, and program for exclusive control | |
US6662364B1 (en) | System and method for reducing synchronization overhead in multithreaded code | |
EP0715732B1 (en) | Method and system for protecting shared code and data in a multitasking operating system | |
US7412597B2 (en) | Computer system and booting method thereof | |
JP4984153B2 (en) | Block avoidance method in real-time task | |
Wang et al. | Patterns which help to avoid conflicts over shared resources in time-triggered embedded systems which employ a pre-emptive scheduler | |
Labrosse | Operating systems | |
KR100506254B1 (en) | Apparatus and method for handling interrupt in non-privileged of embedded system | |
US20230236906A1 (en) | Information processing device, information processing method, and program | |
JP2005190238A (en) | Real time control system | |
Schaffer et al. | The joy of scheduling | |
CN117453413A (en) | Resource application method, device, electronic equipment and storage medium | |
Stankovic et al. | EDF Scheduling for Shared Resources |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20100317 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20110728 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20110906 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20111107 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20120403 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20120411 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20150511 Year of fee payment: 3 |
|
S533 | Written request for registration of change of name |
Free format text: JAPANESE INTERMEDIATE CODE: R313533 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |