JPH0820962B2 - High-level language processing method - Google Patents
High-level language processing methodInfo
- Publication number
- JPH0820962B2 JPH0820962B2 JP22955486A JP22955486A JPH0820962B2 JP H0820962 B2 JPH0820962 B2 JP H0820962B2 JP 22955486 A JP22955486 A JP 22955486A JP 22955486 A JP22955486 A JP 22955486A JP H0820962 B2 JPH0820962 B2 JP H0820962B2
- Authority
- JP
- Japan
- Prior art keywords
- task
- execution
- internal
- level
- priority
- 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 - Lifetime
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
Description
【発明の詳細な説明】 (産業上の利用分野) 本発明は、高級言語処理方法、特に高級言語で記述さ
れたプログラムを実行するパーソナルコンピユータやオ
フイスコンピユータの如き小中型電子計算機において、
高級言語によつて記述された複数のタスクを、指定した
優先度に従つて実行条件の変化に実時間で応答し並行し
て実行する多重タスクが可能な高級言語処理方法に関す
るものである。The present invention relates to a high-level language processing method, and in particular to a small-to-medium-sized computer such as a personal computer or an office computer that executes a program written in a high-level language.
The present invention relates to a high-level language processing method capable of multiple tasks in which a plurality of tasks described in a high-level language are responded to a change in execution conditions in real time according to a designated priority and are executed in parallel.
(従来の技術) 電子計算機が本来の計算機能を離れ、制御器機として
あらゆる産業に使用されるようになつてきた。電子計算
機の有用性が認識され、その利用分野が拡大するにつ
れ、電子計算機自体にも大きな進歩がみられ、マイクロ
コンピュータやオフイスコンピユータ等の中小計算機に
も、実時間処理、多重プログラミング処理が行われるよ
うになつてきている。(Prior Art) Electronic computers have come to be used as control devices in all industries as they leave their original calculation functions. As the usefulness of electronic computers has been recognized and the fields of use have expanded, large advances have been made in electronic computers themselves, and real-time processing and multiple programming processing are also performed on small and medium-sized computers such as microcomputers and office computers. It is becoming like this.
高級言語、例えばBASIC、COBOL、FORTRAN、PL/I等に
よつて記述した複数の処理部分(タスク)を、指定した
優先度(順位)に従つてCPU使用の制御権を切り換え、
実行条件の変化に実時間に応答して複数個のタスクを並
行して実行する機能、すなわち多重タスク機能を有する
高級言語処理系としては、従来、次に説明する2つの方
式のものが知られている。For multiple processing parts (tasks) written in a high-level language such as BASIC, COBOL, FORTRAN, PL / I, etc., the control right of CPU use is switched according to the designated priority (order),
As a high-level language processing system having a function of executing a plurality of tasks in parallel in response to a change in execution conditions in real time, that is, a multi-task function, there are conventionally known two systems described below. ing.
第1の方式は、高級言語の命令ステツプとは無関係に
タスク間の実行権の切換を行うものである。各タクスは
起動されると実行可能状態となり、さらに実行可能状態
のタスクのうちで最も高い優先度を有するタスクが、実
行状態となつて、高級言語で記述されたプログラムが実
行される。高級言語の命令が特定の事象の発生を持つと
いう内容であれば、そのタスクは待ち状態となり、この
場合、他に実行可能状態のタスクが存在すれば、このよ
うなタスクのうちで最も高い優先度を有するタスクが代
わつて実行状態となる。待ち状態となつた前記タスク
は、待つている事象が発生すると実行可能状態となり、
再び各タスクの優先度に応じて実行権の切換が行われ
る。The first method is to switch the execution right between tasks regardless of the instruction step of a high-level language. When each task is activated, it becomes READY state, and the task having the highest priority among the READY task is set to RUN state, and the program written in the high-level language is executed. If a high-level language instruction has the content that a specific event occurs, the task is placed in the waiting state. In this case, if there is another task in the executable state, the task with the highest priority The task with the degree becomes the execution state instead. The task that has entered the waiting state becomes the ready state when the waiting event occurs,
The execution right is switched again according to the priority of each task.
この方式では、上記の規則に従つて、各タスクに割り
当てられている優先度と事象の発生に実時間で対応して
タスクの実行権の切換が行われる。そして高級言語の命
令は、CPUの機械語の複数の命令によつて構成されるも
のであるため、一般には或るタスクの実行中に他のより
高い優先度を有するタスクが実行可能状態になつた場合
には、実行中の高級言語の命令の途中であつても実行権
の切換が行われるようになつている。According to this method, according to the above rules, the task execution right is switched in real time in response to the priority assigned to each task and the occurrence of an event. Since a high-level language instruction is configured by a plurality of machine language instructions of the CPU, generally, a task having a higher priority is ready for execution during execution of a task. In this case, the execution right is switched even during the execution of the high-level language instruction being executed.
第2の方式は、高級言語の命令ステツプを最小の実行
単位としてタスク間の実行権の切換を行うものである。
この方式では起動されている各タスクの中から実行状態
とするタスクを決定する条件は、第1の方式と同じであ
るが、或るタスクが実行状態となり得る条件が満たされ
ても、その時点で他のタスクにおいて高級言語の命令を
実行中であつた場合には、その命令の実行が完了してか
ら実行権の切換が行われるようになつている。The second method is to switch the execution right between the tasks by using the instruction step of the high-level language as the minimum execution unit.
In this method, the condition for determining the task to be put into the running state from among the started tasks is the same as that in the first method, but even if the condition that a certain task can be put into the running state is satisfied, When a high-level language instruction is being executed in another task, the execution right is switched after the execution of the instruction is completed.
(発明が解決しようとする問題点) このような従来の高級言語処理系においては、前記第
1の方式、第2の方式とも次に述べるような欠点があつ
た。すなわち、 第1の方式においては、各タスクの処理内容が高級言
語の命令で記述されているにもかかわらず、各タスク間
の実行権の切換は高級言語の命令を構成する機械語を単
位として行われるため、プログラム全体としての実行順
序が高級言語処理系内部の条件に依存することになり、
実行結果を把握することが困難であつた。つまり、例え
ば機械制御等を実行するプログラムにおいて、どのよう
な順で該プログラムが実行されてているか後に検討する
場合や、機械制御が予想通り制御されない場合の動作確
認の検討等、実行結果を理解しにくい欠点があつた。(Problems to be Solved by the Invention) In such a conventional high-level language processing system, both the first method and the second method have the following drawbacks. That is, in the first method, even though the processing content of each task is described by a high-level language instruction, the switching of the execution right between the tasks is performed by using the machine language that constitutes the high-level language instruction as a unit. Since it is performed, the execution order of the entire program depends on the conditions inside the high-level language processing system,
It was difficult to understand the execution result. In other words, for example, in a program that executes machine control, etc., understand the execution result, such as when examining in what order the program is being executed, or when checking the operation when machine control is not controlled as expected. There was a drawback that was hard to do.
第2の方式においては、高級言語の一命令の実行が終
了するまでタスク間の実行権の切換が待たされるため、
実際に実行権の切換が行われるまでの遅れ時間が大きく
なり、実時間処理が困難となる。また高級言語の各命令
の実行時間は各命令の内容によつて異なるので、このよ
うな遅れ時間は一定とならず、応答性の点で欠点があつ
た。In the second method, the switching of the execution right between the tasks is waited until the execution of one instruction of the high-level language is completed.
The delay time until the execution right is actually switched becomes large, and real-time processing becomes difficult. Further, since the execution time of each command in the high-level language differs depending on the content of each command, such a delay time is not constant and there is a drawback in terms of responsiveness.
高級言語で記述されたプログラムによつて、実行条件
の変化に実時間で応答し、複数のタスクを並行して実行
しようとする場合、応答性と実行結果の理解のしやすさ
とは相反する問題であり、どちらを優先させるかは各タ
スクの実行内容によつて決定されるべきものである。When a program written in a high-level language responds to changes in execution conditions in real time and tries to execute multiple tasks in parallel, the responsiveness and the comprehension of the execution results conflict with each other. Which is to be prioritized should be decided according to the execution contents of each task.
本発明は、上記の欠点を解決することを目的としてお
り、一つの高級言語処理系において、高級言語の命令を
構成する機械語を単位として実行権の切換がなされるタ
スクと、高級言語の命令を単位として実行権の切換が行
われるタスクとを複合して記述し実行できるようにし
て、応答性と実行結果の理解のしやすさとを同時に可能
ならしめた高級言語処理方法を提供することを目的とし
ている。An object of the present invention is to solve the above-mentioned drawbacks, and in one high-level language processing system, a task in which execution rights are switched in units of machine language that constitutes a high-level language instruction, and a high-level language instruction. It is possible to provide a high-level language processing method that makes it possible to describe and execute in combination with a task whose execution right is switched in units of, and at the same time, enable responsiveness and easy understanding of execution results. Has an aim.
(問題点を解決するための手段) そのため本発明の高級言語処理方法は単一のCPUを用
いて、複数個の独立した処理手順を持つタスクを起動
し、外部条件の発生に即応して実行可能状態にあるタス
クの中で最も高い優先度が割り当てられているタスクに
実行権を与えるタスク管理機能を有するオペレーテイン
グシステムと、高級言語で記述されたアプリケーシヨン
プログラムと、前記アプリケーシヨンプログラムから命
令を読み出して解読すると共に、命令実行中の優先度を
所定の値に設定する命令実行管理部とその実行部とを有
し、前記オペレーテイングシステムの管理下でタスクの
一つとして起動されて前記アプリケーシヨンプログラム
によつて定義されたタスクを実行する高級言語処理プロ
グラムとを備え、単一のCPUで多重タスク処理を行う高
級言語処理方法において、前記アプリケーシヨンプログ
ラムを複数の上位タスク群に分割すると共に、該上位タ
スク群に所定の優先度をそれぞれ割り当て、さらに各上
位タスク内を複数の内部タスク群にそれぞれ分割すると
共に、該内部タスク群に所定の優先度をそれぞれ割り当
てる。そして上位タスク内において、いずれの内部タス
クよりも優先度の高い実行レベルを各上位タスク群のそ
れぞれに設けておく。所定の優先権が割り当てられてい
る各上位タスク群内の各内部タスク間において、高級言
語の一命令を実行する直前に該命令が属する内部タスク
の優先度を該内部タスクが属する上位タスク内に設けら
れた前記実行レベルの値に設定し、該高級言語の一命令
実行後には本来の割り当てられた所定の優先度に戻し、
その後のCPUの実行処理に当つてはオペレーテイングシ
ステムのタスク管理機能に内部タスクの実行権の切換を
委ねる構成とする。これによつて各上位タスク内におい
ては、高級言語の一命令実行中は前記実行レベルの設定
により内部タスク相互間の実行権の切換を抑制して高級
言語の一命令を不可分の処理として実行し、一方、上位
タスク相互間においてはオペレーテイングシステムのタ
スク管理機能により、CPUの機械語を単位として実行権
の切換を行い、高級言語を単位として実行権の切換がな
される内部タスク群と、CPUの機械語を単位として実行
権の切換がなされる上位タスク群とを複合して実行処理
できるようにしたことを特徴としている。(Means for Solving Problems) Therefore, the high-level language processing method of the present invention uses a single CPU to activate a task having a plurality of independent processing procedures and execute it immediately in response to the occurrence of an external condition. An operating system having a task management function for giving an execution right to a task to which the highest priority is assigned among tasks in a ready state, an application program written in a high-level language, and an instruction from the application program And has an instruction execution management unit that sets the priority during execution of an instruction to a predetermined value and an execution unit thereof, and is activated as one of the tasks under the control of the operating system. It is equipped with a high-level language processing program that executes the tasks defined by the application program, and multitask processing can be performed with a single CPU. In the high-level language processing method to be performed, the application program is divided into a plurality of upper task groups, a predetermined priority is assigned to each of the upper task groups, and each upper task is further divided into a plurality of internal task groups. At the same time, a predetermined priority is assigned to each of the internal task groups. Then, in the upper task, an execution level having a higher priority than any of the internal tasks is provided in each of the upper task groups. Among the internal tasks in each upper task group to which a predetermined priority is assigned, the priority of the internal task to which the instruction belongs immediately before the execution of one instruction in the high-level language is set to the upper task to which the internal task belongs. Set the value of the provided execution level, and after execution of one command of the high-level language, return to the originally assigned predetermined priority,
For subsequent CPU execution processing, the task management function of the operating system is entrusted with switching the execution right of internal tasks. As a result, in each higher-level task, during execution of one instruction in a high-level language, the execution level is set so that the switching of execution rights between internal tasks is suppressed and one instruction in a high-level language is executed as an indivisible process. On the other hand, between the upper tasks, the task management function of the operating system switches the execution right in the machine language of the CPU, and the execution right is switched in the high-level language as a unit and the CPU. It is characterized in that execution processing can be performed in combination with a higher-level task group whose execution right is switched in the machine language of.
以下図面を参照しながら本発明の一実施例を説明す
る。An embodiment of the present invention will be described below with reference to the drawings.
(実施例) 第1図は本発明に係る高級言語処理方法によりタスク
の実行権の切換制御のため各タスクに優先度を割り当て
る優先度割当て説明図、第2図は優先度表示説明図、第
3図は本発明に係る高級言語処理方法によつて実行され
るタスクの構成説明図である。(Embodiment) FIG. 1 is an explanatory view of priority allocation for assigning a priority to each task for controlling execution right switching of tasks by the high-level language processing method according to the present invention, and FIG. 2 is an explanatory view of priority display, FIG. 3 is an explanatory diagram of a task configuration executed by the high-level language processing method according to the present invention.
第3図において、2はコーザプログラムであつて、例
えばFORTRAN,COBOL,BASIC,PL/I等高級言語で記述された
アプリケーシヨンプログラムである。該コーザプログラ
ム2は複数Nの上位タスク群1−1,1−2,……,1−Nに
分割され、単一のCPUがこれらのN個の上位タスクをそ
れぞれ独自の流れをもつて並行して実行する。これらの
各上位タスク1−1,1−2,……,1−Nはさらに複数の内
部タスクの集まりとして構成されている。例えば♯1上
位タスク1−1はM1個の内部タスク11−1,11−2,……,1
1−M1,♯2上位タスク1−2はM2個の内部タスク12−
1,12−2,……,11−M2の様に構成されている。これらの
各内部タスクは前記の如く高級言語の命令によつて記述
された独立した処理手順を持つプログラムである。In FIG. 3, reference numeral 2 is a couser program, which is an application program written in a high-level language such as FORTRAN, COBOL, BASIC, PL / I. The coser program 2 is divided into a plurality N of upper task groups 1-1, 1-2, ..., 1-N, and a single CPU executes these N upper tasks in parallel with their own flows. Then run. Each of these upper tasks 1-1, 1-2, ..., 1-N is further configured as a group of a plurality of internal tasks. For example, the # 1 upper task 1-1 has M 1 internal tasks 11-1, 11-2, ..., 1
1-M 1 , # 2 Upper task 1-2 is M 2 internal tasks 12-
It is configured as 1,12-2, ..., 11-M 2 . Each of these internal tasks is a program having an independent processing procedure described by a high-level language instruction as described above.
前記N個の上位タスク群、及び各上位タスク内の各内
部タスクには、それぞれ重複がない優先度、すなわち優
先順位が割り当てられる。A non-overlapping priority, that is, a priority is assigned to each of the N upper task groups and each internal task in each upper task.
第1図に示すように、各上位タスク1−1,1−2,……,
1−Nには重複のない優先度Aを1,2,3,…,Nの順に割り
当て、さらに上位タスク内の各内部タスクに対してもそ
の内部タスクが属している上位タスク内で、重複のない
優先度Bが1,2,3,…の順にそれぞれ割り当てられる。As shown in FIG. 1, each upper task 1-1, 1-2, ...,
1-N is assigned a non-overlapping priority A in the order of 1, 2, 3, ..., N, and even for each internal task in the higher-level task, it is duplicated in the higher-level task to which the internal task belongs. Is assigned in the order of 1, 2, 3, ...
内部タスクの優先度は、第2図図示の如く上位タスク
優先度Aを示す上位桁3と内部タスク優先度Bを示す下
位桁4とを合成した合成値5の値Pで示される。オペレ
ーテイングシステムは、この優先度を示す合成値Pのよ
り小さなタスクを優先度が高いものとして管理する。そ
して各上位タスク1−1,1−2,……,1−Nには、内部タ
スクに割り当てられた内部タスク優先度とは別に「実行
レベル」と呼ばれる優先度が設けられている。該「実行
レベル」は当該「実行レベル」が属する上位タスク内に
おいて最も優先度の高い順位が割り当てられている。つ
まり第2図に示された下位桁4の値Bが「0」であり、
該「実行レベル」が属する上位タスク内のどの内部タス
クよりも高い優先度を有する。また「実行レベル」は特
定のタスクに割り当てられるものではなく、後に説明す
る様に高級言語の命令実行時に、一時的に実行されるべ
き内部タスクの優先度を格上げするために使用されるも
のである。As shown in FIG. 2, the priority of the internal task is indicated by a value P of a composite value 5 which is a combination of the upper digit 3 indicating the upper task priority A and the lower digit 4 indicating the internal task priority B. The operating system manages a task having a smaller composite value P indicating this priority as a task with a higher priority. Each upper task 1-1, 1-2, ..., 1-N is provided with a priority called "execution level" in addition to the internal task priority assigned to the internal task. The "execution level" is assigned the highest priority rank in the higher-level task to which the "execution level" belongs. That is, the value B of the lower digit 4 shown in FIG. 2 is "0",
It has a higher priority than any internal task in the higher-level tasks to which the "execution level" belongs. The "execution level" is not assigned to a specific task, but is used to elevate the priority of an internal task that should be temporarily executed when a high-level language instruction is executed, as described later. is there.
そしてさらに、これらのいずれの「実行レベル」より
さらに優先度の高い値を持つ割込レベル10が設けられて
いる。該割込レベル10は第2図に示された上位桁3の値
A及び下位桁4の値B共に「0」であり、合成値5の値
Pが「00」で表わされる優先度を持つている。Further, an interrupt level 10 having a higher priority value than any of these "execution levels" is provided. The interrupt level 10 is "0" for both the value A of the upper digit 3 and the value B of the lower digit 4 shown in FIG. 2, and the value P of the composite value 5 has the priority represented by "00". ing.
第1図に示された優先度の割り当てによつて、或る上
位タスク、例えば♯3上位タスク1−3に属するすべて
の内部タスク13−1,13−2,…….13−M3は♯3上位タス
ク1−3よりも高い優先度を持つ上位タスク、例えば♯
1上位タスク1−1内の内部タスク11−1,11−2,……,1
1−M1よりは優先度が低く、またより低い優先度を持つ
上位タスク、例えば♯5上位タスク1−5内の内部タス
ク15−1,15−2,……,15−M5よりは優先度が高くなる。Due to the priority assignment shown in FIG. 1, all internal tasks 13-1, 13-2, ... 13-M 3 belonging to a certain upper task, for example, # 3 upper task 1-3, # 3 Upper task with higher priority than higher task 1-3, eg #
1 Internal task 11-1, 11-2, ..., 1 in upper task 1-1
1-M 1 has a lower priority and has a lower priority than higher-level tasks, for example, internal tasks 15-1, 15-2, ..., 15-M 5 in # 5 higher-level task 1-5. Higher priority.
CPUが或る上位タスク内の或る内部タスクの高級言語
の一命例の実行を開始するごとに、該内部タスクの優先
度は一時的に置換され、当該内部タスクが属する上位タ
スク内に設けられている実行レベルの優先度の値に設定
される。該命令の実行が終了した時に本来の優先度に戻
される。Each time the CPU starts execution of a high-level language example of an internal task in an upper task, the priority of the internal task is temporarily replaced and is set in the upper task to which the internal task belongs. It is set to the priority value of the execution level that is set. When the execution of the instruction is completed, the original priority is restored.
このような優先度の割り当て及び各上位タスク内に実
行レベル及び割込レベルを設けることにより、上位タス
ク内の内部タスク相互間では、高級言語の一命令を単位
としてタスクの実行権が切り換えられ、一方、上位タス
ク相互間ではオペレーテイングシステムのタスク管理機
能の下で高級言語の命令ステツプとは無関係に、CPUの
機械語を単位としてタスクの実行権が切り換えられる構
成となる。By assigning such a priority and providing an execution level and an interrupt level in each higher-level task, the execution right of the task can be switched between internal tasks in the higher-level task in units of one high-level language instruction. On the other hand, under the task management function of the operating system, the task execution right is switched between the higher-level tasks in units of the machine language of the CPU, regardless of the instruction steps of the high-level language.
次に、第4図のハードウエアの構成図、第5図の高級
言語処理系の論理的構成例を用いて、本発明に係る高級
言語処理方法が用いられる高級言語処理系の全体的な構
成及びその処理を説明する。Next, using the hardware configuration diagram of FIG. 4 and the logical configuration example of the high-level language processing system of FIG. 5, the overall configuration of the high-level language processing system in which the high-level language processing method according to the present invention is used. And its processing will be described.
第4図において、CPU41は、例えば16ビツト等のマイ
クロプロセツサ、OSC44は水晶振動子等で構成される発
振器である。高級言語処理系を構成するソフトウエアー
の一部は、ROM42に記憶されており、電源投入時に起動
されて補助記憶装置48から入出力制御回路45を介してRA
M43へ必要なソフトウエアがロードされ、オペレーテイ
ングシステムの操作が可能となる。オペレーテイングシ
ステムに対する指示はキーボード46から入力され、シス
テムからのメツセージはCRT47に表示される。補助記憶
装置48はプログラムやデータを記憶するために用いられ
る。In FIG. 4, a CPU 41 is a microprocessor such as 16 bits, and an OSC 44 is an oscillator composed of a crystal oscillator or the like. A part of the software that constitutes the high-level language processing system is stored in the ROM 42, and is activated when the power is turned on and the RA is operated from the auxiliary storage device 48 via the input / output control circuit 45.
The required software is loaded into M43, and the operating system can be operated. Instructions for the operating system are entered from the keyboard 46 and messages from the system are displayed on the CRT 47. The auxiliary storage device 48 is used to store programs and data.
第5図において、CPUの使用権、メモリ、その他のハ
ードウエアは、オペレーテイングシステム52によつて管
理される資源51として位置付けられている。In FIG. 5, the usage right of the CPU, the memory, and other hardware are positioned as the resource 51 managed by the operating system 52.
高級言語処理プログラム53はオペレーテイングシステ
ム52の管理によつてCPUの使用権、メモリを与えられ、
また、オペレーテイングシステム52を介してハードウエ
アをアクセスする。オペレーテイングシステム52はタス
ク管理、事象管理、メモリ管理、入出力管理の各機能を
有する。タスク管理機能はメモリに格納されているプロ
グラムを指定の番地から起動し(タスクの起動)、さら
に、他に起動されているタスクがある場合には各タスク
の優先度に従つて実行権の切換を行う(優先順位方式の
場合)。この場合、実行権の切換はCPUの機械語を単位
として行われる。事象管理機能はハードウエアから発生
する条件の変化を検出し、その変化に対応して起動され
ているタスクの状態を変更する。例えば、タスクが或る
条件の変化を待つことをオペレーテイングシステム52に
要求すると、該タスクは「実行状態」から「待ち状態」
に変更される。また、「待ち状態」にあるタスクは待つ
ている条件が満された時、「実行可能状態」に変更され
る。前記のタスク管理機能は、このようなタスクの状態
の変化に対応して実行権の切換を行う。高級言語処理プ
ログラム53は命令実行管理部と命令実行部とから成り、
オペレーテイングシステム52の管理の下にタスクの一つ
として実行される。高級言語処理プログラム53は高級言
語で記述されたアプリケーシヨンプログラム54を一命令
ずつ読み出して実行すべき内容を解読して実行するが、
実際に実行されるのは高級言語処理プログラム53に含ま
れている命令実行管理部ならびに命令実行部である。高
級言語処理プログラム53はアプリケーシヨンプログラム
54の内容に従つてオペレーテイングシステム52に対して
タスクを登録し起動を要求する。The high-level language processing program 53 is given the right to use the CPU and the memory under the management of the operating system 52.
It also accesses the hardware via the operating system 52. The operating system 52 has task management, event management, memory management, and input / output management functions. The task management function activates the program stored in the memory from the specified address (task activation), and if there are other activated tasks, switches the execution right according to the priority of each task. (For the priority method). In this case, the execution right is switched in units of the CPU machine language. The event management function detects a change in the condition generated from the hardware, and changes the state of the task started in response to the change. For example, when a task requests the operating system 52 to wait for a change in a certain condition, the task changes from the "running state" to the "waiting state".
Is changed to. A task in the "waiting state" is changed to the "executable state" when the waiting condition is satisfied. The task management function switches the execution right in response to such a change in the task status. The high-level language processing program 53 consists of an instruction execution management unit and an instruction execution unit,
It is performed as one of the tasks under the control of the operating system 52. The high-level language processing program 53 reads the application program 54 written in a high-level language one instruction at a time and decodes and executes the content to be executed.
The instruction execution management unit and the instruction execution unit included in the high-level language processing program 53 are actually executed. The high-level language processing program 53 is an application program
In accordance with the contents of 54, a task is registered to the operating system 52 and activation is requested.
第6図は高級言語処理系の命令実行管理部の実行手順
を示すフローチヤートである。上記第3図に示されたタ
スク構成を持つ高級言語で記述されたコーザプログラム
2の各内部タスクは、起動されるとプログラムを実行す
るために必要なメモリを個別に与えられ、高級言語処理
プログラム53の命令実行管理部の開始番地から第6図に
示されたフローチヤートに従つてその実行を開始する。
該命令実行管理部は個別にメモリに与えられている各タ
スクによつて論理的に同時に実行できる再入可能な形式
で作られている。FIG. 6 is a flow chart showing the execution procedure of the instruction execution management unit of the high-level language processing system. Each internal task of the coser program 2 written in a high-level language having the task structure shown in FIG. 3 is individually given a memory necessary for executing the program when activated, and the high-level language processing program The execution is started from the start address of the instruction execution management unit 53 according to the flow chart shown in FIG.
The instruction execution management unit is made in a re-entrant form that can be executed logically simultaneously by each task individually given to the memory.
命令実行管理部は高級言語で記述されたアプリケーシ
ヨンプログラム54から命令を一個ずつ読み出して実行す
るという動作を繰返し実行する。高級言語処理プログラ
ム53に対してアプリケーシヨンプログラム54の実行開始
が指示されると、高級言語処理プログラム53は命令読み
出しのポインタをアプリケーシヨンプログラム54の先頭
に設定し、CPUの命令の実行開始番地を示すポインタを
第6図におけるステツプS1に設定してオペレーテイング
システム52にタスクの起動を要求する。このようにして
起動されたタスクは実行権を与えられると、第6図に示
されたステツプS1から実行を開始し、ステツプS1からス
テツプS2、ステツプS3、ステツプS4、ステツプS5、ステ
ツプS6、ステツプS7、ステツプS8、ステツプS9と実行
し、これ以後通常はステツプS9からステツプS3、ステツ
プS7、ステツプS8、そしてステップS9の順に実行する。
ステツプS8で実行する高級言語の命令がアプリケーシヨ
ンプログラムによつて定義したタスクを起動するという
内容であつた場合には、前記のアプリケーシヨンプログ
ラム54を実行開始するための処理と同様の処理によつ
て、オペレーテイングシステムにタスクの起動を要求す
る。従つて命令実行管理部は起動されているアプリケー
シヨンプログラムのタスクの個数と同じ数だけ個別のプ
ログラムを並行して実行することになる。例えば第3図
に示されたユーザプログラム2において、♯1上位タス
ク1−1,♯2上位タスク1−2、♯3上位タスク1−3
の3個のプログラムが上記説明の如く起動されたとき、
これら♯1上位タスク1−1のプログラム、♯2上位タ
スク1−2のプログラム、♯3上位タスク1−3のプロ
グラムの3個の個別の各プログラムが独自に並行して実
行される。The instruction execution management unit repeatedly executes the operation of reading and executing instructions one by one from the application program 54 written in a high level language. When the high-level language processing program 53 is instructed to start executing the application program 54, the high-level language processing program 53 sets a pointer for instruction reading to the beginning of the application program 54 and sets the execution start address of the CPU instruction. The pointer shown is set to step S1 in FIG. 6 to request the operating system 52 to activate the task. When the task started in this way is given the execution right, it starts execution from step S1 shown in FIG. 6, and from step S1 to step S2, step S3, step S4, step S5, step S6, step S6. S7, step S8 and step S9 are executed, and thereafter, step S9 to step S3, step S7, step S8 and step S9 are normally executed in this order.
If the high-level language instruction to be executed in step S8 is such that the task defined by the application program is activated, the same processing as the processing for starting execution of the application program 54 is performed. Then, it requests the operating system to start the task. Therefore, the instruction execution management unit executes the individual programs in parallel as many as the number of tasks of the activated application program. For example, in the user program 2 shown in FIG. 3, # 1 upper task 1-1, # 2 upper task 1-2, # 3 upper task 1-3
When the above three programs are started as described above,
These three individual programs, that is, the program of # 1 upper task 1-1, the program of # 2 upper task 1-2, and the program of # 3 upper task 1-3, are independently executed in parallel.
ところで、例えば♯2上位タスク1−2に属する内部
タスク12−2が実行されるべく、ステツプS1の割込みフ
ラグがオンにセットされ、これから実現してもよいとい
う条件が確定したとき、すなわち内部タスク12−2の或
る命令を始める直前に該内部タスク12−2に予め割り当
てられている所定の優先度のPの値22が、第1図で説明
した如く該内部タスク12−2が属する上位タスク1−2
に設けられた「実行レベル」の優先度の値20に一時的に
置換され設定される(ステツプS2)。このような特別の
優先度が設定された状態の下で、該内部タスク12−2の
或る命令が実行される。そして該命令の実行を繰返して
いる間は、ステツプS2の処理によつて該内部タスク12−
2の優先度は「実行レベル」の値20が保持されているの
で、該内部タスク12−2内のどのような優先度を持つ内
部タスク12−1,12−3,……,12−M2が実行可能状態とな
つたとしても、ステツプS3に達するまでは実行中の内部
タスク12−2が実行権を保持する。このステツプS3で判
断に用いられるフラグは、新たに実行可能状態になつた
他の内部タスクが実行中の内部タスク12−2に対して実
行権の切換を要求するための情報であり、この高級言語
の一命令の実行が終了した時、必要な場合に限つてその
実行権を切り換える処理を行うためのものである。従つ
てステツプS3で割込みフラグがオンであることを検出す
ると、ステツプS1で立てられているフラグをクリアし
(ステップS4)、実行中であつても内部タスク12−2の
優先度は予め割り当てられている本来の所定の優先度に
戻される。すなわち優先度の値22に設定される(ステツ
プS5)。By the way, for example, when the interrupt flag of step S1 is set to ON so that the internal task 12-2 belonging to the # 2 upper task 1-2 is executed, and the condition that it may be realized from now is confirmed, that is, the internal task Immediately before the start of a certain instruction of 12-2, the P value 22 of the predetermined priority assigned to the internal task 12-2 in advance is the upper level to which the internal task 12-2 belongs, as described in FIG. Task 1-2
Is temporarily replaced with the value 20 of the priority of the "execution level" provided in step S2 (step S2). Under such a state that the special priority is set, a certain instruction of the internal task 12-2 is executed. Then, while the execution of the instruction is repeated, the internal task 12-
Since the value "20" of the "execution level" is held as the priority of 2, the internal tasks 12-1, 12-3, ..., 12-M having any priority in the internal task 12-2 are held. Even if 2 becomes the executable state, the internal task 12-2 being executed holds the execution right until the step S3 is reached. The flag used for the determination in this step S3 is information for requesting the switching of the execution right to the internal task 12-2 which is being executed by another internal task which has newly become ready. When the execution of one instruction of the language is completed, the execution right is switched only when necessary. Therefore, when it is detected in step S3 that the interrupt flag is on, the flag set in step S1 is cleared (step S4), and the priority of the internal task 12-2 is assigned in advance even during execution. The original predetermined priority is restored. That is, the priority value is set to 22 (step S5).
ここで、他により高い優先度を持ち、かつ実行可能状
態になつている内部タスク、例えば内部タスク12−1と
すると、内部タスク12−1が属する♯2上位タスク1−
2に設けられた「実行レベル」の優先度の値20が内部タ
スク12−1に設定され、該内部タスク12−1に実行権が
移る。従って該内部タスク12−1が、第6図のフローチ
ャートに従って実行される。その後、実行権を移された
内部タスク12−1が待ち状態になるか実行を停止する
と、実行可能状態にある内部タスクの内、該内部タスク
12−2の優先度が最も高い場合、該内部タスク12−2は
再び実行権が与えられて、該内部タスク12−2の優先度
は該内部タスク12−2の属する♯2上位タスク1−2に
設けられた「実行レベル」の優先度の値20に再び置換設
定され、ステツプS6から実行が再開される。一方、該内
部タスク12−2の優先度より高い内部タスクが存在する
場合、該内部タスク12−2より高い優先度を有する内部
タスクに実行権が移り、該内部タスク12−2の優先度が
最も高くなるまで内部タスク12−2への実行権の切換が
待たされる。Here, assuming that the internal task has a higher priority and is in the ready state, for example, the internal task 12-1, the # 2 upper task 1 to which the internal task 12-1 belongs
The priority value 20 of the "execution level" provided in No. 2 is set in the internal task 12-1, and the execution right is transferred to the internal task 12-1. Therefore, the internal task 12-1 is executed according to the flowchart of FIG. After that, when the internal task 12-1 to which the execution right is transferred enters the waiting state or stops execution, the internal task among the internal tasks in the ready state is
If the priority of the internal task 12-2 is highest, the internal task 12-2 is given the execution right again, and the priority of the internal task 12-2 is the # 2 upper task 1 to which the internal task 12-2 belongs. The replacement is again set to the priority value 20 of the "execution level" provided in 2, and the execution is restarted from step S6. On the other hand, when there is an internal task having a higher priority than the internal task 12-2, the execution right is transferred to the internal task having a higher priority than the internal task 12-2, and the priority of the internal task 12-2 is changed. The switching of the execution right to the internal task 12-2 is kept waiting until it becomes the highest.
また、第6図のステツプS8において実行される命令の
内容が、一定時間の経過を待つたり、外部条件の変化を
待つなどの内部タスク12−2を待ち状態にする命令であ
つた場合には、第7図に示される手順でその命令が実行
される。すなわち、ステツプS11は内部タスク12−2が
待ち状態になつた後、条件が満たされた時に実行すべき
ステツプS13及びステツプS14の処理を最優先で実行でき
るようにするための準備である。ここで「割込レベル」
は、高級言語処理プログラム53によつて起動された内部
タスクのどの内部タスクの優先度より常に高い優先度を
有している。すなわち第1図で説明した如く優先度の値
Pが最も高い「00」の値を待つている。If the content of the instruction executed in step S8 in FIG. 6 is an instruction to wait the internal task 12-2 such as waiting for a certain period of time or waiting for a change in external condition, The instruction is executed in the procedure shown in FIG. That is, step S11 is a preparation for allowing the processing of steps S13 and S14 to be executed when the condition is satisfied after the internal task 12-2 enters the waiting state with the highest priority. Where "interrupt level"
Has a priority always higher than the priority of any of the internal tasks activated by the high-level language processing program 53. That is, as described with reference to FIG. 1, the priority value P is waiting for the highest value "00".
該内部タスク12−2の優先度を「割込レベル」の優先
度の値「00」に変更した後(ステツプS11)、直ちに命
令の内容に応答した事象が発生するまで該内部タスク12
−2は待ち状態に変わる。この時、他に実行可能状態に
なつている内部タスクが存在すれば、それらの中で最も
高い優先度を有する内部タスク、例えば♯2上位タスク
1−2内の内部タスク12−3が最も優先順位が高いもの
とすれば、該内部タスク12−3に実行権が与えられる。
従って該内部タスク12−3は第6図に示されたフローチ
ヤートに従つてそのプログラムが実行される。After changing the priority of the internal task 12-2 to the priority value "00" of the "interrupt level" (step S11), the internal task 12-2 is immediately until an event in response to the content of the instruction occurs.
-2 changes to waiting state. At this time, if there is another internal task in the ready state, the internal task having the highest priority among them, for example, the internal task 12-3 in the # 2 upper task 1-2 has the highest priority. If the rank is high, the execution right is given to the internal task 12-3.
Therefore, the internal task 12-3 executes its program according to the flow chart shown in FIG.
待ち状態となつた内部タスク12−2は指定された条件
が発生すると直ちに実行状態となつて、割込フラグをオ
ンにすると共に、該内部タスク12−2に予め割り当てら
れている本来の所定の優先度の値22を設定する(ステツ
プS13,14)。ここでは高級言語の命令を実行中の内部タ
スク12−3に対してステップS13によって該内部タスク1
2−2に実行権の切換を要求するだけで、ステップ14を
実行すると命令を実行中の内部タスク12−3に一旦実行
権が戻される。そして命令を実行中の内部タスク12−3
が、独自の第6図に示されるステップS3に達して前記内
部タスク12−2に起因する割込フラグを検出し、さらに
ステップS4,S5を経て内部タスク12−3の優先度を本来
の予め定められている所定の優先度の値23に設定された
時点で、実行可能状態にある内部タスクの内、該内部タ
スク12−2の優先度が最も高い場合に、該内部タスク12
−2に実行権の切換が行われ、第7図の手順を実行し停
止していた該内部タスク12−2は実行権が与えられるこ
ととなり、ステツプS15からその実行を再開する。ま
た、該内部タスク12−2の優先度より高い内部タスクが
存在する場合、該内部タスク12−2より高い優先度を有
する内部タスクに実行権が移り、該内部タスク12−2の
優先度が最も高くなるまで実行権の切換が待たされるこ
とは前記の場合と同様である。The internal task 12-2 in the waiting state enters the execution state as soon as the specified condition occurs, turns on the interrupt flag, and sets the original predetermined task assigned to the internal task 12-2 in advance. The priority value 22 is set (steps S13 and S14). Here, in step S13, the internal task 1
By simply requesting 2-2 to switch the execution right, when step 14 is executed, the execution right is once returned to the internal task 12-3 which is executing the instruction. And the internal task executing the instruction 12-3
However, it reaches its own step S3 shown in FIG. 6 to detect an interrupt flag caused by the internal task 12-2, and further, through steps S4 and S5, the priority of the internal task 12-3 is set in advance. When the internal task 12-2 has the highest priority among the internal tasks in the runnable state at the time when the predetermined priority value 23 is set, the internal task 12-2
-2, the execution right is switched, the execution right is given to the internal task 12-2 which has stopped after executing the procedure of FIG. 7, and the execution is restarted from step S15. Further, when there is an internal task having a higher priority than the internal task 12-2, the execution right is transferred to the internal task having a higher priority than the internal task 12-2, and the priority of the internal task 12-2 is changed. As in the above case, the switching of the execution right is kept waiting until it becomes the highest.
以上は♯2上位タスク1−2に属する内部タスクの動
作について内部タスク12−2を主に内部タスク12−1及
び内部タスク12−3を例にあげて説明してきたが、これ
らの内部タスク12−1及び内部タスク12−3それぞれが
内部タスク12−2の立場に置かれ、その処理が上記と同
様の過程を経ることは勿論のこと、他の上位タスク(♯
1上位タスク1−1及び♯3上位タスク1−3)に属す
る内部タスクについても全く同様の処理が行われること
は言うまでもない。The operation of the internal task belonging to the # 2 higher-level task 1-2 has been described above by taking the internal task 12-2 as the main example and taking the internal task 12-1 and the internal task 12-3 as examples. -1 and the internal task 12-3 are respectively placed in the position of the internal task 12-2, and the processing goes through the same process as the above, as well as other higher-level tasks (#
It goes without saying that the same processing is performed for the internal tasks belonging to the 1st upper task 1-1 and the # 3 upper task 1-3).
このように各上位タスク内にどの内部タスクより優先
度の高い実行レベルをそれぞれ設け、また最も優先度の
高い割込レベルを設け、該割込レベル及び該実行レベル
を用いることにより、高級言語を単位として実行権の切
換が行われる内部タスク群と、CPUの機械語を単位とし
て実行権の切換が行われる上位タスク群とを複合して実
行できる。従つて従来の相反する応答性とユーザプログ
ラムの使いやすさとを同時に解決することができる。す
なわち実時間処理で実行することができると共に、後程
CPUの実行結果を容易に知ることができる。また、中小
電子計算機においても、ユーザが高級言語で容易に多重
タスクのプログラムを記述することができるようにな
る。In this way, by setting the execution level having a higher priority than any internal task in each higher-level task and the interrupt level having the highest priority, and using the interrupt level and the execution level, a high-level language is defined. An internal task group whose execution right is switched as a unit and an upper task group whose execution right is switched as a unit of the machine language of the CPU can be executed in combination. Therefore, it is possible to simultaneously solve the conventional conflicting responsiveness and the ease of use of the user program. That is, it can be executed in real time, and later
The execution result of the CPU can be easily known. Also, in a small-to-medium-sized computer, a user can easily write a multitask program in a high-level language.
次に本発明に係る高級言語処理方法を自動制御システ
ムに応用した例について説明する。Next, an example in which the high-level language processing method according to the present invention is applied to an automatic control system will be described.
上記の表−1はそのプログラムの一例、第8図は自動
制御システムの一構成例である。表−1のプログラムで
使用した高級言語は、JIS規格(JIS C6207)により定め
られているBASIC言語に、さらに複数の独立した実行手
順をタスクとして記述する機能を付加したものである。 Table 1 above shows an example of the program, and FIG. 8 shows an example of the configuration of the automatic control system. The high-level language used in the programs in Table-1 is the BASIC language defined by the JIS standard (JIS C6207) with the addition of the function to describe multiple independent execution procedures as tasks.
第8図において、高級言語処理装置84は第4図に示し
たとおりのハードウエア構成を持ち、この自動制御シス
テムにおけるコントローラである。この自動制御システ
ムは、製造ライン81上を運ばれる試料82が所定の位置に
達した時、アダプタ88が持つセンサによつて試料82の位
置を検出し、制御回路87を経て高級言語処理装置84に割
込み信号として伝え、これを契機として高級言語処理装
置84が実行する表−1のプログラムによつて、試料82の
調整(ADJUST)をアダプタ88を介して行うとともに調整
結果を測定器86によつて測定し、そのデータを外部補助
記憶装置85にフアイルとして記録する。In FIG. 8, a high-level language processing device 84 has a hardware configuration as shown in FIG. 4, and is a controller in this automatic control system. This automatic control system detects the position of the sample 82 by the sensor of the adapter 88 when the sample 82 carried on the manufacturing line 81 reaches a predetermined position, and the high-level language processing device 84 via the control circuit 87. As an interrupt signal, which is triggered by the program of Table-1 executed by the high-level language processing unit 84 to adjust the sample 82 (ADJUST) via the adapter 88 and to send the adjustment result to the measuring instrument 86. Then, the data is recorded as a file in the external auxiliary storage device 85.
表−1のプログラムは2つの上位タスクDATAおよびCO
NTROLにより構成されており、それぞれ独立に行番号を
持つプログラムとなつている。各々のプログラムにおい
て、先頭の行の命令PROGRAMは上位タスクの名前を宣言
する。上位タスクDATAは、さらに行番号30〜行番号250
の内部タスクSAVEDATAと行番号270〜行番号380の内部タ
スクMEASUREの2つの内部タスクで構成されている。行
番号30の命令PARACTは内部タスクの名前SAVEDATAと優先
度を宣言し、行番号250の命令END PARACTは内部タスク
の終りを表す。同様に、行番号270から行番号380まで
が、2番目の内部タスクMEASUREである。上位タスクCON
TROLは内部タスクMAINを1個だけ持つ。上位タスクDATA
の行番号20の命令PROCESS EVENTは外部事象の名前MEASE
NDを宣言するとともに、ハードウエア条件との対応を定
義する。この宣言は上位タスク内の各内部タスクに対し
て共通の宣言であり、行番号20においては事象名MEASEN
Dを、第8図の測定器86から測定完了信号が発生すると
いう条件に対応づけている。また、上位タスクCONTROL
の行番号20においては、事象名ADJUSTを、第8図のアダ
プタ88から試料検出信号が発生するという条件に対応づ
けている。その他、表−1のプログラムに含まれる命令
の中で主要なものについて、その機能を簡単に示す。The program in Table-1 has two high-level tasks DATA and CO
It is composed of NTROL, and each program has its own line number. In each program, the instruction PROGRAM in the first line declares the name of the higher-level task. The higher-level task DATA also has line numbers 30 to 250.
The internal task SAVEDATA and the internal task MEASURE of line numbers 270 to 380 are composed of two internal tasks. The instruction PARACT at line number 30 declares the name SAVEDATA and the priority of the internal task, and the instruction END PARACT at line number 250 indicates the end of the internal task. Similarly, the line numbers 270 to 380 are the second internal task MEASURE. Upper task CON
TROL has only one internal task MAIN. Upper task DATA
The command PROCESS EVENT at line number 20 is the external event name MEASE
Declare ND and define correspondence with hardware requirements. This declaration is a common declaration for each internal task in the higher-level task, and at line number 20, the event name MEASEN
D is associated with the condition that a measurement completion signal is generated from the measuring device 86 in FIG. Also, the upper task CONTROL
In the line No. 20 of, the event name ADJUST is associated with the condition that the sample detection signal is generated from the adapter 88 in FIG. In addition, the main functions of the commands included in the program of Table 1 are briefly described.
COM 上位タスク内のCOMMON変数を宣 言する。COM Declares the COMMON variable in the upper task.
LOAD TASK 上位タスクを指定した名前のフア イルからメモリにロードする。LOAD TASK Loads the upper task from the file with the specified name into memory.
START TASK 上位タスクを起動する。START TASK Starts the upper task.
START 内部タスクを起動する。START Starts an internal task.
CONNECT EVENT 事象の発生を有効にする。CONNECT EVENT Enables event occurrence.
WAIT EVENT 指定した事象が発生するまで内部 タスクを待ち状態にする。WAIT EVENT Puts the internal task in the wait state until the specified event occurs.
次に表−1のプログラムの動作について概要を説明す
る。Next, the outline of the operation of the program in Table-1 will be described.
まず、上位タスクDATAをメモリに格納して起動する
と、最初の内部タスクSAVEDATAが実行を開始する。この
内部タスクは、内部タスクMEASUREによつてCOMMON変数
を用いたバツフアに書き込まれたデータを順番に読み出
してフアイルに格納する。バツフアは100個のデータを
格納できる容量を有し、最終データの次は先頭のデータ
をアクセスすることによつてリング状に繰返し使用され
る。バツフアのアクセス位置はCOMMON変数のSAVEPTによ
り書込み位置が示され、READPTにより読出し位置が示さ
れる。内部タスクSAVEDATAは行番号100,行番号110で上
位マスクCONTROLを起動し、行番号120で内部タスクMEAS
UREを起動し、行番号130で事象MEASENDの発生を有効に
した後、行番号140から行番号200までのループによつて
バツフアから読み出したデータを順番にフアイルに書き
込む。First, when the higher-level task DATA is stored in the memory and activated, the first internal task SAVEDATA starts execution. This internal task sequentially reads the data written in the buffer using the COMMON variable by the internal task MEASURE and stores it in the file. The buffer has a capacity to store 100 pieces of data, and after the last data, the head data is repeatedly used by accessing the leading data. As for the access position of the buffer, the write position is indicated by the COMMON variable SAVEPT and the read position is indicated by the READPT. The internal task SAVEDATA activates the upper mask CONTROL at line numbers 100 and 110, and the internal task MEAS at line number 120.
After starting URE and enabling the occurrence of the event MEASEND at line number 130, the data read from the buffer is sequentially written to the file by the loop from line number 140 to line number 200.
内部タスクMEASUREは、行番号310のWAITEVENT命令に
よつて第8図の測定器86からデータを読み出してバツフ
アに書き込む。The internal task MEASURE reads the data from the measuring instrument 86 of FIG. 8 by the WAITEVENT instruction at line number 310 and writes it in the buffer.
上位タスクCONTROLは、第8図のアダプタ88から試料
検出信号が発生するまで待つた後、アダプタ88へ試料82
を調整するためのデータと測定開始を指定するデータと
を送出する。表−1のプログラムでは上位タスクCONTRO
Lの優先度が最も高く、上位タスクDATA内では内部タス
クMEASUREの方が内部タスクSAVEDATAよりも優先度が高
くなつている。そのため内部タスクSAVEDATAの行番号14
0から行番号200までのループを実行中に測定完了信号が
発生すると、実行中の一命令が終了してから内部タスク
MEASUREに実行権が与えられて行番号320〜行番号360が
実行される。一方、2つの上位タスクの間では上位タス
クCONTROLの方が優先度が高いため、事象ADJUSTが発生
すると上位タスクDATA内で高級言語の命令を実行中であ
るかどうかにかかわらず、直ちに上位タスクCONTROL内
の内部タスクMAINに実行権が与えられて行番号70〜行番
号90が実行される。The host task CONTROL waits until the sample detection signal is generated from the adapter 88 shown in FIG.
And data for adjusting the measurement and data for specifying the start of measurement. High-level task CONTRO in the program of Table-1
L has the highest priority, and the internal task MEASURE has a higher priority than the internal task SAVEDATA in the upper task DATA. Therefore, line number 14 of internal task SAVEDATA
When a measurement complete signal is generated during execution of the loop from line 0 to line number 200, the internal task is
The execution right is given to MEASURE and the line numbers 320 to 360 are executed. On the other hand, since the higher-level task CONTROL has a higher priority between the two higher-level tasks, immediately when the event ADJUST occurs, the higher-level task CONTROL is executed regardless of whether a high-level language instruction is being executed in the high-level task DATA. Execution right is given to the internal task MAIN in line number 70 to line number 90.
第9図は、表−1のプログラムに関する3つの内部タ
スクについて高級言語処理プログラムの実行管理部の実
行手順を個別に表わしたものである。FIG. 9 individually shows the execution procedure of the execution management unit of the high-level language processing program for the three internal tasks related to the program in Table-1.
内部タスクSAVEDATAは、通常ステツプS103,S107,S10
8,S109の経過を繰返したどつてプログラムの行番号140
〜行番号200を実行している。内部タスクMEASUREはプロ
グラムの行番号310を実行すると事象MEASENDが発生する
まで待ち状態となるが、この行の実行は、第9図におい
てはステツプS211,S212に対応する。そして事象MEASEND
が発生すると、ステツプS213,S214が実行され、その後
内部タスクSAVEDATAによつて実行中であつた命令の実行
が終了すると、ステツプS103,S104,S105が順に実行さ
れ、ここでタスクの実行権の切換が起きて、内部タスク
MEASUREに実行権が与えられて、ステツプS213,S214,S21
5と実行が行われる。以後プログラムの行番号320〜行番
号360,行番号300と実行されて、再び行番号310が実行さ
れると、内部タスクSAVEDATAに実行権が切換えられて、
ステツプS106から実行を再開する。このようにして上位
タスクDATA内の2つの並列処理部相互間では、BASIC言
語の一命令の実行が終了するのを待つてから実行権の切
換が行われる。また、上位タスクCONTROLに属する唯一
の内部タスクMAINは、プログラムの行番号60を実行する
と事象ADJUSTが発生するまで待ち状態となるが、この行
の実行は、第9図においてはステツプS311,S312に対応
する。そして事象ADJUSTが発生するとステツプS313,S31
4が実行され、さらに直ちにステツプS315が実行され、
プログラムの行番号70〜行番号90,行番号50が実行され
る。この場合は事象が発生すると、上位タスクDATA内で
BASICの命令が実行途中であつても、直ちに上位タスクC
ONTROLに実行権が与えられる。The internal task SAVEDATA is executed in normal steps S103, S107, S10.
Repeating S8 and S109, program line number 140
~ Running line number 200. When the internal task MEASURE executes the line number 310 of the program, it waits until the event MEASEND occurs. The execution of this line corresponds to steps S211, S212 in FIG. And event MEASEND
Occurs, the steps S213 and S214 are executed, and when the execution of the instruction which was being executed by the internal task SAVEDATA is completed after that, the steps S103, S104 and S105 are executed in order and the task execution right is switched. An internal task
Execution right is given to MEASURE, and steps S213, S214, S21
5 and run. After that, line number 320 to line number 360 and line number 300 of the program are executed, and when line number 310 is executed again, the execution right is switched to internal task SAVEDATA,
Execution is restarted from step S106. In this way, the execution right is switched between the two parallel processing units in the upper task DATA after waiting for the completion of the execution of one instruction of the BASIC language. Also, the only internal task MAIN belonging to the higher-level task CONTROL is in the waiting state until the event ADJUST occurs when the line number 60 of the program is executed, but the execution of this line is performed in steps S311 and S312 in FIG. Correspond. When event ADJUST occurs, steps S313 and S31
4 is executed, and immediately step S315 is executed,
Line numbers 70 to 90 and line number 50 of the program are executed. In this case, when an event occurs,
Even if a BASIC instruction is in the middle of execution, the higher-level task C immediately
ONTROL is given execute permission.
以上説明したように、表−1のプログラムではBASIC
言語の命令を単位として実行権の切換が行われる2つの
内部タスクを持つ上位タスクと、これらの内部タスク内
のBASIC言語の命令の実行とは独立して実行権を得るこ
とのできる別の上位タスクとが複合して実行される。As explained above, the BASIC
A higher-level task that has two internal tasks whose execution rights are switched in units of language instructions, and another higher-level task that can obtain execution rights independently of the execution of BASIC language instructions in these internal tasks. It is executed in combination with the task.
(発明の効果) 以上説明した如く、本発明によれば、高級言語で記述
されたプログラムにおいて、高級言語の命令を構成する
機械語を単位として実行権の切換がなされるタスクと、
高級言語の命令を単位として実行権の切換がなされるタ
スクの両方を実行することができる。従つて前者の最小
限の遅れ時間で条件の変化に応答すべき処理に適した応
答性の利点と、後者のタスク間で共通の変数(COMMON変
数)を用いて容易にデータの変換ができる利点、及び全
体としての実行経過を高級言語の命令を単位として把握
することができるので、プログラムの開発、動作確認の
作業効率が良い利点が共に残存する。そしてこの両者を
複合して実行できることにより、処理対象の性格に応じ
て両者を使い分け、プログラムの応答性とプログラムの
作りやすさとを両立させることが可能となる。(Effects of the Invention) As described above, according to the present invention, in a program written in a high-level language, the execution right is switched for each machine language that constitutes an instruction of the high-level language,
It is possible to execute both tasks in which execution rights are switched in units of high-level language instructions. Therefore, the former has the advantage of responsiveness suitable for processing that should respond to changes in conditions with the minimum delay time, and the latter has the advantage that data can be easily converted using a common variable (COMMON variable) between tasks. , And the execution progress as a whole can be grasped in units of high-level language instructions, so that the advantages of good work efficiency in program development and operation confirmation remain. By being able to execute both of them in combination, it is possible to use both according to the nature of the processing target and to achieve both the responsiveness of the program and the easiness of creating the program.
第1図は本発明に係る高級言語処理方法によりタスクの
実行権の切換制御のため各タスクに優先度を割り当てる
優先度割当て説明図、第2図は優先度表示説明図、第3
図は本発明に係る高級言語処理方法によつて実行される
タスクの構成説明図、第4図はハードウエア構成例、第
5図は高級言語処理系の論理的構成例、第6図は高級言
語処理系の命令実行管理部の実行手順を示すフローチヤ
ート、第7図は待ち命令の実行手順を示すフローチヤー
ト、第8図は自動制御システムの一構成例、第9図は3
つの内部タスクについて高級言語処理プログラムの実行
管理部の実行手順を個別に示したフローチヤートであ
る。 図中、1−1,1−2,……,1−Nは上位タスク、2はユー
ザプログラム、10は割込レベル、11−1,12−1,……,1N
−1は実行レベル、11−1,11−2,……,11−M1,12−1,12
−2,……,12−M2,……,1N−1,1N−2,……,1N−MNは内
部タスク、41はCPU、42はROM、43はRAM、44はOSC、45は
入出力制御回路、46はキーボード、47はCRT、48は補助
記憶装置、49は周辺装置、51は資源、52はオペレーテイ
ングシステム、53は高級言語処理プログラム、54はアプ
リケーシヨンプログラム、81は製造ライン、82は試料、
84は高級言語処理装置、85は外部補助記憶装置、86は測
定器、87は制御回路、88はアダプタを表わしている。FIG. 1 is an explanatory diagram of priority assignment for assigning a priority to each task for controlling switching of execution right of a task by the high-level language processing method according to the present invention, FIG. 2 is an explanatory diagram of priority display, and FIG.
FIG. 4 is a diagram for explaining the configuration of tasks executed by the high-level language processing method according to the present invention, FIG. 4 is a hardware configuration example, FIG. 5 is a logical configuration example of a high-level language processing system, and FIG. FIG. 7 is a flow chart showing the execution procedure of the instruction execution management unit of the language processing system, FIG. 7 is a flow chart showing the execution procedure of the waiting instruction, FIG. 8 is a configuration example of the automatic control system, and FIG.
It is a flow chart individually showing the execution procedure of the execution management unit of the high-level language processing program for one internal task. In the figure, 1-1, 1-2, ..., 1-N are higher-level tasks, 2 is a user program, 10 is an interrupt level, 11-1, 12-1, ..., 1N
-1 is the execution level, 11-1, 11-2, ..., 11-M 1 , 12-1, 12
-2, ......, 12-M 2 , ......, 1N-1,1N-2, ......, 1N-M N is internal task, 41 CPU, 42 is ROM, 43 is RAM, 44 is OSC, 45 Is an input / output control circuit, 46 is a keyboard, 47 is a CRT, 48 is an auxiliary storage device, 49 is a peripheral device, 51 is a resource, 52 is an operating system, 53 is a high-level language processing program, 54 is an application program, and 81 is Manufacturing line, 82 is a sample,
Reference numeral 84 is a high-level language processing device, 85 is an external auxiliary storage device, 86 is a measuring instrument, 87 is a control circuit, and 88 is an adapter.
Claims (1)
理手順を持つタスクを起動し、外部条件に即応して実行
可能状態にあるタスクの中で最も高い優先度が割り当て
られているタスクに実行権を与えるタスク管理機能を有
するオペレーティングシステムと、 高級言語で記述されたアプリケーションプログラムと、 前記アプリケーションプログラムから命令を読み出して
解読すると共に、命令実行中の優先度を所定の値に設定
する命令実行管理部とその実行部とを有し、前記オペレ
ーティングシステムの管理下でタスクの一つとして起動
されて前記アプリケーションプログラムによって定義さ
れたタスクを実行する高級言語処理プログラムとを備
え、単一のCPUで多重タスク処理を行う高級言語処理方
法において、 前記アプリケーションプログラムを複数の上位タスク群
に分割すると共に、該上位タスク群に所定の優先度をそ
れぞれ割り当て、 さらに、各上位タスク内を複数の内部タスク群にそれぞ
れ分割すると共に、該内部タスク群に所定の優先度をそ
れぞれ割り当て、 かつ、上位タスク内において、いずれの内部タスクより
も優先度の高い実行レベルを各上位タスク群のそれぞれ
に設け、 所定の優先度が割り当てられている各上位タスク群内の
各内部タスク間において、実行権の切換えを行い高級言
語の一命令を実行する場合は、その直前に該命令が属す
る内部タスクの優先度を前記実行レベルの値に設定する
ステップと、高級言語の一命令実行中は前記実行レベル
の設定により内部タスク相互間の実行権の切換を抑制し
て高級言語の一命令を不可分の処理として実行するステ
ップと、該高級言語の一命令実行後には前記上位タスク
内の本来の割り当てられた所定の優先度に戻すステップ
と、上位タスク相互間においては実行権の切換を行う場
合にはオペレーティングシステムのタスク管理機能によ
り、CPUの機械語を単位として実行権の切換を行うステ
ップとを備え、高級言語の一命令を単位として実行権の
切換がなされる内部タスク群と、CPUの機械語を単位と
して実行権の切換がなされる上位タスク群とを複合して
実行処理できることを特徴とする高級言語処理方法。1. A single CPU is used to activate a task having a plurality of independent processing procedures, and the highest priority is assigned to the tasks ready to execute in response to external conditions. An operating system that has a task management function that gives execution rights to existing tasks, an application program written in a high-level language, and instructions that are read and decoded from the application program, and the priority during instruction execution is set to a predetermined value. And a high-level language processing program that is activated as one of the tasks under the control of the operating system to execute the task defined by the application program. In a high-level language processing method for performing multi-task processing on a CPU of A plurality of upper task groups, assign a predetermined priority to each of the upper task groups, further divide each upper task into a plurality of internal task groups, and assign a predetermined priority to each of the internal task groups. Each priority task is assigned to each higher-level task group that has a higher priority than any internal task within the higher-level task group. When the execution right is switched between each internal task and one instruction of a high-level language is executed, immediately before that, the step of setting the priority of the internal task to which the instruction belongs to the value of the execution level, During execution of one instruction, the execution level is set to suppress execution right switching between internal tasks and execute one instruction in a high-level language as an indivisible process. And a step of returning to a predetermined priority assigned in the upper task after executing one command of the high-level language, and a task of the operating system when switching execution rights between the upper tasks. The management function has a step of switching the execution right in the machine language of the CPU, and the internal task group in which the execution right is switched in the unit of one instruction of a high-level language, and the execution in the machine language of the CPU A high-level language processing method characterized in that it can be executed in combination with a higher-level task group whose rights are switched.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP22955486A JPH0820962B2 (en) | 1986-09-30 | 1986-09-30 | High-level language processing method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP22955486A JPH0820962B2 (en) | 1986-09-30 | 1986-09-30 | High-level language processing method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS6385828A JPS6385828A (en) | 1988-04-16 |
| JPH0820962B2 true JPH0820962B2 (en) | 1996-03-04 |
Family
ID=16893987
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP22955486A Expired - Lifetime JPH0820962B2 (en) | 1986-09-30 | 1986-09-30 | High-level language processing method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0820962B2 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007011426A (en) * | 2005-06-28 | 2007-01-18 | Nec Electronics Corp | Processor |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2520543B2 (en) * | 1991-09-06 | 1996-07-31 | インターナショナル・ビジネス・マシーンズ・コーポレイション | Method and system for managing program execution |
-
1986
- 1986-09-30 JP JP22955486A patent/JPH0820962B2/en not_active Expired - Lifetime
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007011426A (en) * | 2005-06-28 | 2007-01-18 | Nec Electronics Corp | Processor |
Also Published As
| Publication number | Publication date |
|---|---|
| JPS6385828A (en) | 1988-04-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5274813A (en) | Operation system having a migration function which moves saved data associated with an interrupted process to a different save area | |
| US4859995A (en) | Mouse pointer with switchable emulation mode | |
| US5825649A (en) | Kernel substitution method in multi-processor system and multi-processor system having kernel substitution function | |
| JPS61272833A (en) | Data processor | |
| US5968159A (en) | Interrupt system with fast response time | |
| JP2820189B2 (en) | Control software execution system for numerical controller | |
| JPH0820962B2 (en) | High-level language processing method | |
| EP0223463B1 (en) | Multiprocessor data processing system | |
| JPH08272755A (en) | Processor switching device | |
| MacKinnon | Advanced function extended with tightly-coupled multiprocessing | |
| JPH02130666A (en) | System reconfiguration method for multiprocessor systems | |
| JP3015793B1 (en) | Programmable controller | |
| JPS6029760A (en) | Control system for copying machine | |
| JPS59180618A (en) | Method for controlling program loading of peripheral device | |
| JPS61101865A (en) | Multi-microprocessor system | |
| JPS6385829A (en) | Information processor | |
| CN111078301A (en) | A multi-core computing device and its operation method | |
| JPH03144705A (en) | Operation state monitor for programmable controller | |
| JPH11306040A (en) | Emulator trace device | |
| JPS63269237A (en) | Microcomputer developing device | |
| JPS5965307A (en) | Sequence controller | |
| JP2571260B2 (en) | Operating environment selection processing method using logic clock | |
| JPS635790B2 (en) | ||
| JPH03232051A (en) | Semaphore access control method | |
| JPH04329428A (en) | Computer |