JPS6339042A - Intertask synchronizing system for multi-task - Google Patents

Intertask synchronizing system for multi-task

Info

Publication number
JPS6339042A
JPS6339042A JP18361986A JP18361986A JPS6339042A JP S6339042 A JPS6339042 A JP S6339042A JP 18361986 A JP18361986 A JP 18361986A JP 18361986 A JP18361986 A JP 18361986A JP S6339042 A JPS6339042 A JP S6339042A
Authority
JP
Japan
Prior art keywords
task
semaphore
priority
processing
tasks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP18361986A
Other languages
Japanese (ja)
Inventor
Hajime Sakuma
肇 佐久間
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP18361986A priority Critical patent/JPS6339042A/en
Publication of JPS6339042A publication Critical patent/JPS6339042A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task 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)

Abstract

PURPOSE:To ensure the working of a multi-tasking system without destructing a synchronizing mechanism and to process the tasks in the order of higher priorities, by processing the tasks of higher priorities with preference only with management of the priority of each task even in case the I/O processing is involved. CONSTITUTION:When the task of processing algorithm delivers a system call P(S) to an operating system OS, a CPU 1 gives a command to a semaphore managing part 6 and the semaphore designated by a semaphore part 3 is decided. Then this semaphore if decided off is turned on and the flag of a flag part is turned on to complete the processing. While if said semaphore is kept on, the part 6 gives a command to an address generating part 4 to produce an address so that the corresponding task information is selected within a semaphore-only task control part 2. A comparator 7 compares the priority information given from the part 2 with the task priority given from the CPU 1. Then a signal is sent to an interruption control part to perform the interruption processing when the priority of the task produced the call P(S) is higher than the priority information of the part 2.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、プログラムを細かい処理単位のタスクに分割
してCPU (中央処理装置)を時分割に割当てて動作
される処理方式のマルチタスキングを支援する処理装置
におけるタスク間同期方式に関するものである。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention is directed to multitasking, a processing method in which a program is divided into tasks in small processing units and a CPU (central processing unit) is allocated in a time-sharing manner. The present invention relates to an inter-task synchronization method in a processing device that supports.

〔従来の技術〕[Conventional technology]

一般に、マルチタスキングにおいては、複数のタスクが
各々の優先順位に応じてCPUを時分割に専有して動作
する。通常、このようなマルチタスキングを実現するた
めには、オペレーティングシステム、またはモニタなど
と呼ばれる基本ソフトウェアが介在し、このオペレーテ
ィングシステム(以下O8)が各々のタスクからの処理
要求(以下システムコール)や割込の管理を行ないなが
ら複数のタスクが矛盾なく動作するように全体の制御を
行なっている。この制御は、普通ソフトウェア若しくは
マイクロプログラムなどのファームウェアで実現されて
いる。このマルチタスキングにおいて、複数のタスクが
矛盾なく動作するためにタスクには幾つかのタスク状態
というものがある。
Generally, in multitasking, a plurality of tasks operate by monopolizing a CPU in a time-sharing manner according to their respective priorities. Normally, in order to achieve this kind of multitasking, basic software called an operating system or a monitor is involved, and this operating system (hereinafter referred to as O8) responds to processing requests (hereinafter referred to as system calls) from each task. It manages interrupts and performs overall control so that multiple tasks operate without contradiction. This control is usually realized by software or firmware such as a microprogram. In this multitasking, tasks have several task states so that multiple tasks can operate without contradiction.

ある−瞬の時刻をとってみると、CPUを専有して走行
しているタスクは唯一で、これをラン状態と呼び、この
ラン状態に遷移することは可能であるが優先順位の関係
でラン状態に移れないで待機している状態をレディ状態
と呼び、またO8に対しシステムコールを発行したが要
求が満足されない状態はウェイト状態となる。これらの
状態遷移は、O8が管理し適宜各タスクの状態を変化さ
せシステム全体が正常に稼働する様に制御している。
If you take a moment in time, there is only one task that is running exclusively using the CPU, and this is called the run state. Although it is possible to transition to this run state, it is not possible to run due to priority. A state in which it is waiting without being able to move to the O8 state is called a ready state, and a state in which a system call has been issued to O8 but the request is not satisfied is called a wait state. These state transitions are managed by the O8, which changes the state of each task as appropriate to control the entire system to operate normally.

従来の単一プログラムとは異なるマルチタスキングにお
いては、数々の注意を要する現象が存在する。例えば、
複数のタスクが同一のメモリや入出力装置(以下I10
という)を共有している場合、あるタスクが共有のメモ
リまたはIloを利用中に制御が他のタスクに移り、そ
のタスクが共有メモリまたはIloを使用したとすると
、以前に動作していたタスクにより操作されていたメモ
リのデータやIloの状態が破壊される可能性が出てく
る。
In multitasking, which is different from traditional single-programming, there are a number of phenomena that require attention. for example,
Multiple tasks use the same memory or input/output device (hereinafter referred to as I10)
), if control is transferred to another task while one task is using the shared memory or Ilo, and that task uses the shared memory or Ilo, the previously running task will There is a possibility that the data in the memory that was being manipulated and the state of Ilo will be destroyed.

この場合、また元のタスクに制御が移った時、正常に動
作することが出来ない。この様な現象を回避するための
手段として、一般的にO8はタスク間同期機構を有して
いる。
In this case, when control is transferred to the original task again, it will not be able to operate normally. As a means to avoid such a phenomenon, O8 generally has an inter-task synchronization mechanism.

このタスク間同期機構には数々の方式があるが、ここで
はタスク閏同期用フラグ(以下セマフォという)につい
て説明する。
There are many methods for this inter-task synchronization mechanism, but here we will explain the task jump synchronization flag (hereinafter referred to as semaphore).

第4図は一般のセマフォを用いたタスク間の同期方式の
一例を示す構成図である。本例では、読出しIloを含
むタスクA、書込みIloを含むタスクBの2個のタス
ク21.22がI 、1020を共有し、優先順位はタ
スクBの方が高いとする。図中、P (S)はシステム
コールの1つでセマフォに対してセマフォの専有を要求
するものであり、V(S)はセマフォに対してセマフォ
の解放を要求するものである。
FIG. 4 is a block diagram showing an example of a synchronization method between tasks using a general semaphore. In this example, two tasks 21.22, task A including read Ilo, and task B including write Ilo, share I, 1020, and task B has a higher priority. In the figure, P (S) is one of the system calls that requests the semaphore to take exclusive use of the semaphore, and V (S) requests the semaphore to release the semaphore.

第5図はこのシステムコールP (S)の処理を説明す
る流れ図である。ステップ31でO8はセマフォがON
が否かを判定検知し、このセマフォがONでなくOFF
状態であれば、ステップ32でセマフォをONにする。
FIG. 5 is a flowchart illustrating the processing of this system call P (S). In step 31, O8 turns on the semaphore.
This semaphore is not ON but OFF.
If it is, the semaphore is turned on in step 32.

この場合、このシステムコールを発行したタスクは要求
を満足したことになる。また、セマフォが既にONであ
れば、ステップ33でシステムコールを発行したタスク
はこの時点の状態を一旦退避し、ステップ34でラン状
態からウェイト状態へ遷移する。このようにタスクは、
しばしばある時点の状態を保持し実行を中断する場合が
ある。
In this case, the task that issued this system call has satisfied the request. Furthermore, if the semaphore is already ON, the task that issued the system call in step 33 temporarily saves the state at this point, and in step 34 transitions from the run state to the wait state. In this way, the task is
It often holds the state at a certain point and suspends execution.

この状態を退避するための空間を、タスクコントロール
ブロック(以下TCB)と呼び、このTCB構成は、第
3図の一部、に示される。通常、TCBIo、11はメ
モリ上に確保され、タスク毎にTCBも1つずつ存在す
る。このT(、BIOは制御部12と、退避エリア13
とがらなり、制御部12はO8がタスクを管理するため
に予約している空間、退避エリア13はタスクが中断す
る際走行中のプログラムの状態、Iloの状態を退避す
るため空間である。
The space for saving this state is called a task control block (hereinafter referred to as TCB), and the configuration of this TCB is shown in a part of FIG. 3. Normally, TCBIo, 11 is secured in memory, and one TCB exists for each task. This T (, BIO is connected to the control unit 12 and the evacuation area 13
The control unit 12 is a space reserved for the O8 to manage tasks, and the save area 13 is a space for saving the state of the running program and the state of Ilo when the task is interrupted.

O8はシステムコール発行タスクを中断させ、ステップ
34でウェイト状態に遷移させた後、次にステップ35
でラン状態にすべきタスクを選択し、そのタスクに制御
を渡すことによりP(S)の処理を終了する。
The O8 suspends the system call issuing task, transitions to a wait state in step 34, and then transitions to step 35.
The process of P(S) is ended by selecting a task to be placed in a run state and passing control to that task.

第6図は同様にもう一方のシステムコール■(S)の処
理を示す流れ図である。まず、O8はステップ36でセ
マフォに対して待っているタスクが在るか否かを判定し
、この待ちタスクがなければ、ステップ37でセマフォ
をOFFして処理を終了する。もし、待ちタスクが存在
していればステップ38で待ちタスク内の1つのタスク
を選択し、タスク状態をウェイト状態からレディ状態に
遷移させ、次に、ステップ39でラン状態にするタスク
を選択して処理を終る。
FIG. 6 is a flowchart showing the processing of the other system call (S). First, in step 36, O8 determines whether there is any task waiting for the semaphore. If there is no task waiting for the semaphore, in step 37, O8 turns off the semaphore and ends the process. If there are waiting tasks, one task among the waiting tasks is selected in step 38, the task state is transitioned from the wait state to the ready state, and then the task to be put in the run state is selected in step 39. to end the process.

第4図におけるタスクAは、I 1020からの読出し
処理21を行ない、タスクBはIloへの書込み処理2
2を行なう。先ず、タスクAが走行し、セマフォの専有
要求システムコールP(S>を発行し、I 1020か
らの読出し処理21に入る。この読出し処理21中に割
込みが入り、タスクBが起動されたとすると、タスクB
は書込み処理22を実行しようとしてP (S)を発行
する。
Task A in FIG. 4 performs read processing 21 from I 1020, and task B performs write processing 2 to Ilo.
Do step 2. First, task A runs, issues a semaphore exclusive request system call P(S>, and enters read processing 21 from I 1020. Assuming that an interrupt occurs during this read processing 21 and task B is activated, Task B
attempts to execute write processing 22 and issues P (S).

この場合、セマフォは既にタスクAにより専有されてい
るため、タスクBはウェイト状態に遷移し、O8は再び
タスクAを選択し、タスクAは読出し処理21を継続す
る。この読出し処理21の終了後システムコールV(S
)を発行すると、セマフォは解放され、セマフォに対し
て待っているタスクBがセマフォを専有し、ウェイト状
態からレディ状態へ遷移する。O8は、次にタスクBを
選択しラン状態にすることでタスクBに制御が移り、タ
スクBは書込み処理22に移ることができる。このタス
クBは書込み処理22の終了後、システムコールV (
S)を発行してセマフォを解放し他のタスクが新たにセ
マフォを専有することを可能とする。
In this case, since the semaphore is already occupied by task A, task B transitions to a wait state, O8 selects task A again, and task A continues the read process 21. After this reading process 21 is completed, system call V(S
), the semaphore is released, task B, which is waiting for the semaphore, monopolizes the semaphore and transitions from the wait state to the ready state. O8 then selects task B and puts it in a run state, thereby transferring control to task B, and task B can move on to the write process 22. This task B executes system call V (
S) to release the semaphore and allow another task to newly occupy the semaphore.

第7図(a)は以上のプロセスの説明をしたタイムチャ
ートで、横軸を時間、縦軸はタスクA。
FIG. 7(a) is a time chart explaining the above process, where the horizontal axis is time and the vertical axis is task A.

タスクB、I10の各処理を示している。横軸の点線は
起動を受けていない状態か、又はウェイト状態を表わし
、縦軸の点線は処理の流れの対応を表わし、実線はCP
U又はIloの処理を表わしている。
Each process of tasks B and I10 is shown. The dotted line on the horizontal axis represents the state of not being activated or the wait state, the dotted line on the vertical axis represents the correspondence of the processing flow, and the solid line represents the CP
It represents the processing of U or Ilo.

以上説明したように同期機構を利用することで読出し処
理21の動作中に書込み処理22の動作を実行したり、
又その逆の動作を行なったりすることにより生じる誤動
作を防ぐことが出来る。一般に、この種のマルチタスキ
ングを支援しているO8には同期機構が備えられている
。マニュアルriRMX86  NUCLEUS  R
EFERENCE  MANUA’L、参照。
As explained above, by using the synchronization mechanism, the write process 22 can be executed during the read process 21,
Also, malfunctions caused by performing the opposite operation can be prevented. Typically, O8s that support this type of multitasking are equipped with a synchronization mechanism. Manual riRMX86 NUCLEUS R
See EFERENCE MANUA'L.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

上述したようにタスク間の同期をとるためにセマフォを
利用するわけであるが、一度セマフォが専有されると、
そのセマフォが解放されるまでいかなるタスクもシステ
ムコールP (S>を使用することにより、ウェイト状
態となり動作することが出来ない、マルチタスキングに
おいて、タスクには優先順位があり、優先順位の高いタ
スクが先に実行権を得て動作することを期待してプログ
ラムを組む、しかし、マルチタスキングシステムにおい
て、各タスクの実行順序を細部までおさえることは困難
であり、優先順位の高いタスクの処理がシステムコール
P(S)を発行することで保留され、優先順位の低いタ
スクの処理に左右され、結果的に処理の順番が遅れると
いう欠点を有している。
As mentioned above, semaphores are used to synchronize tasks, but once a semaphore is occupied,
Until the semaphore is released, any task will be placed in a wait state by using the system call P (S>) and will not be able to operate. In multitasking, tasks have priorities, and tasks with higher priority However, in a multitasking system, it is difficult to control the execution order of each task in detail, and the processing of tasks with high priority is difficult. It has the disadvantage that it is put on hold by issuing the system call P(S) and is dependent on the processing of tasks with lower priority, resulting in a delay in the processing order.

本発明の目的は、このような欠点を除き、優先度の高い
タスクの処理を優先して行い、処理の順番の遅れをなく
したマルチタスクのタスク間同期方式を提供することに
ある。
SUMMARY OF THE INVENTION An object of the present invention is to provide a multi-task inter-task synchronization method that eliminates such drawbacks, prioritizes processing of tasks with high priority, and eliminates delays in processing order.

〔問題点を解決するための手段〕[Means for solving problems]

本発明の構成は、プログラムを各処理単位のタスクに分
割して中央処理装置を時分割に割当てて処理するマルチ
タスク処理がタスク間同期フラグを管理するフラグ管理
手段により各タスク間の同期をとりながら行われるタス
ク間同期方式において、前記フラグ管理手段を専有して
いるタスクに関する情報を保持する専有タスク管理手段
と、前記フラグ管理手段への専有要求がタスクから出さ
れた時、そのタスクの優先順位と前記専有タスク管理手
段に含まれる前記フラグ管理手段を専有しているタスク
の優先順位とを比較する比較手段と、前記専有要求を行
ったタスクの優先順位が前記専有タスクの優先順位より
も高い場合前記中央処理装置に割込信号を出力する割込
制御手段とを含むことを特徴とする。
The configuration of the present invention is such that multitasking processing, in which a program is divided into tasks for each processing unit and the central processing unit is time-divided for processing, synchronizes each task using a flag management means that manages an inter-task synchronization flag. In the inter-task synchronization method that is performed while a comparison means for comparing the priority of the task that monopolizes the flag management means included in the exclusive task management means; The invention is characterized in that it includes an interrupt control means for outputting an interrupt signal to the central processing unit when the level is high.

〔実施例〕〔Example〕

次に、本発明について図面により詳細に説明する。 Next, the present invention will be explained in detail with reference to the drawings.

第1図は本発明の一実施例のブロック図である。図にお
いて、lは中央処理装置(CPU)、2はセマフォ専有
タスク管理部、3はセマフォ部、4はアドレス生成部、
5はフラグ部、6はセマフォ管理部、7は比較器、8は
割込管理部を示す。セマフォ部3はセマフォを8個備え
ており、セマフォ専有タスク管理部2はセマフォ部3の
各セマフォに対応し、各セマフォを専有しているタスク
の優先順位とTCBへのポインタとを備えている。アド
レス生成部4はセマフォ専有タスク管理部2の内1つを
選択するためのアドレスを発生する。セマフォ管理部6
はCPUIからの指令でセマフォ部3を管理し、アドレ
ス生成部4を制御しアドレスを発生させ、フラグ部5に
フラグをセットする機能を有している。比較器7はCP
U1から与えられたタスクの優先順位情報とセマフォ専
有タスク管理部2の優先順位情報を比較し、比較結果の
信号を発生させる。割込管理部8は前記信号を受けて、
CPUIに対し割込信号を発生させる。
FIG. 1 is a block diagram of one embodiment of the present invention. In the figure, l is a central processing unit (CPU), 2 is a semaphore exclusive task management section, 3 is a semaphore section, 4 is an address generation section,
5 is a flag section, 6 is a semaphore management section, 7 is a comparator, and 8 is an interrupt management section. The semaphore unit 3 includes eight semaphores, and the semaphore exclusive task management unit 2 corresponds to each semaphore in the semaphore unit 3, and includes a pointer to the TCB and the priority of the task that exclusively uses each semaphore. . The address generation unit 4 generates an address for selecting one of the semaphore exclusive task management units 2. Semaphore management section 6
has the function of managing the semaphore unit 3 based on commands from the CPUI, controlling the address generating unit 4 to generate addresses, and setting a flag in the flag unit 5. Comparator 7 is CP
The task priority information given from U1 is compared with the priority information of the semaphore exclusive task management section 2, and a signal representing the comparison result is generated. The interrupt management unit 8 receives the signal and
Generates an interrupt signal to the CPUI.

第2図は本実施例を動作させるための処理アルゴリズム
のタスクがO8に対しシステムコールP(S)を発行し
た場合の流れ図を示している。P(S)の処理に入ると
、CPUIはセマフォ管理部6へ指令を出す。セマフォ
管理部6はステップ41でセマフォ部3の指定されたセ
マフォを判定し、OFF状態であればステップ42で指
定されたセマフォをONとし、フラグ部5のフラグをO
Nとして処理を終了する。CPUIはフラグ部5のフラ
グ状態を判定することでセマフォに対する専有要求が満
足されたか否かを判断し、フラグ部5がONであればO
FF状態とする。
FIG. 2 shows a flowchart when a task of a processing algorithm for operating this embodiment issues a system call P(S) to O8. Upon entering P(S) processing, the CPUI issues a command to the semaphore management unit 6. The semaphore management unit 6 determines the designated semaphore in the semaphore unit 3 in step 41, and if it is in the OFF state, turns on the designated semaphore in step 42, and turns the flag in the flag unit 5 to OFF.
If the answer is N, the process ends. The CPU determines whether the exclusive request for the semaphore is satisfied by determining the flag state of the flag unit 5, and if the flag unit 5 is ON, the CPU
Set to FF state.

セマフォ部3の指定されたセマフォがONであれば、セ
マフォ管理部6はアドレス生成部4に対しアドレスを発
生する様に指令を送る。アドレス発生部4は指令に応じ
てセマフォ部3の情報を元にセマフォ専有タスク管理部
2の内対応するタスク情報を選択するためのアドレスを
発生する。比較器7はセマフォ専有タスク管理部2から
出力される優先順位情報とCPUIから発生するシステ
ムコールP (S)を発行したタスクの優先順位とをス
テップ44で比較し、システムコールP(S)を発行し
たタスクの優先順位の方が高い場合、その旨を割込管理
部8に通知するための信号を発生し、割込管理部8はC
PUIに対して割込信号を発生する。CPUIが割込を
発生した場合には、ステップ45でシステムコールP 
(S)を発行したタスクをラン状態からウェイト状態に
遷移させ、次に、ステップ46でラン状態にするタスク
を選択する。
If the designated semaphore of the semaphore section 3 is ON, the semaphore management section 6 sends a command to the address generation section 4 to generate an address. The address generation section 4 generates an address for selecting corresponding task information in the semaphore exclusive task management section 2 based on the information of the semaphore section 3 in response to a command. In step 44, the comparator 7 compares the priority information output from the semaphore exclusive task management unit 2 with the priority of the task that issued the system call P(S) generated from the CPUI, and determines whether the system call P(S) has been issued. If the issued task has a higher priority, a signal is generated to notify the interrupt management unit 8 of this fact, and the interrupt management unit 8
Generates an interrupt signal to the PUI. If the CPUI generates an interrupt, system call P is executed in step 45.
The task that issued (S) is transitioned from the run state to the wait state, and then, in step 46, the task to be placed in the run state is selected.

割込処理に入った場合、CPUIはステップ47でセマ
フォ専有タスク管理部2中のTCBポインタからTCB
のアドレスを得て、I10処理を中断し、その時点のプ
ログラム状態と、I10処理を中断したことを記憶して
いるための情報をTCBの退避エリアに退避する。
When interrupt processing is entered, the CPUI transfers the TCB from the TCB pointer in the semaphore exclusive task management section 2 in step 47.
, the I10 processing is interrupted, and the program state at that time and information for remembering that the I10 processing has been interrupted are saved in the save area of the TCB.

第3図は第1図のセマフォ専有タスク管理部2とTCB
Io、11との関係を表わした図である。セマフォ専有
タスク管理部2のTCBポインタはメモリ上の対応する
TCBを指し示している。CPU1は、TCBポインタ
によりメモリ上に存在するTCBIOの位置を知ること
ができる。CPUIはセマフォを専有していたタスクを
中断させ、中断時の状態をTCBの退避エリアに退避し
た後、ステップ48でもしそのタスクがレディ状態であ
るならばウェイト状態に遷移させた後、次にステップ4
9でラン状態にするタスクを選択する。
Figure 3 shows the semaphore exclusive task management section 2 and TCB in Figure 1.
It is a diagram showing the relationship between Io and 11. The TCB pointer of the semaphore exclusive task management unit 2 points to the corresponding TCB on the memory. The CPU 1 can know the location of the TCBIO existing on the memory using the TCB pointer. The CPU interrupts the task occupying the semaphore, saves the state at the time of interruption to the save area of the TCB, moves the task to the wait state if it is in the ready state in step 48, and then Step 4
Select the task to be placed in the run state in step 9.

本実施例は、セマフォが8個の場合で説明したが、シス
テムの規模に応じて数を増やすことも可能であり、また
セマフォ専有タスク管理部2の情報としてTCBポイン
タではなく、タスクを識別するための識別子を用いても
よい。
Although this embodiment has been described with reference to eight semaphores, the number can be increased depending on the scale of the system, and the information of the semaphore exclusive task management section 2 is not the TCB pointer but identifies the task. You may also use an identifier for

第7図(b)は本実施例の各タスク及びIloの処理を
時間の流れで表したタイムチャートであり、第7図(a
)と同様の条件で比較をしている。先ず、タスクAがシ
ステムコールP (S)を発行することでIloを専有
し、I10処理中タスクBに制御が移り、タスクBがシ
ステムコールP(S)を発行すると、タスクBの方が優
先順位が高いためタスクAのI10処理が中断され、タ
スクBがセマフォを専有し、I10処理を行なう。この
I10処理の終了後、タスクBがシステムコールV(S
)を発行することでタスクAは再びセマフォを専有し、
I /’○処理を再実行することができるようになる。
FIG. 7(b) is a time chart showing the processing of each task and Ilo in this embodiment as a time flow, and FIG.
) are compared under the same conditions. First, task A monopolizes Ilo by issuing system call P (S), control is transferred to task B which is processing I10, and when task B issues system call P (S), task B has priority. Since the priority is high, the I10 processing of task A is interrupted, and task B monopolizes the semaphore and performs the I10 processing. After completing this I10 processing, task B makes system call V (S
), task A monopolizes the semaphore again,
I/'○ The process can now be re-executed.

これら第7図(a)。These Figure 7(a).

(b)を比較すれば理解できるように、優先順位の高い
タスクBの処理を優先させ、しかも同期機構を壊さず動
作させることで、優先順位の高いタスクが目的の処理を
早く行なうことが可能となる。なお、図中のΔはタスク
の終了を表わしている。
As can be understood by comparing (b), by prioritizing the processing of high-priority task B and operating without breaking the synchronization mechanism, it is possible for the high-priority task to perform its intended processing quickly. becomes. Note that Δ in the figure represents the end of a task.

以上のことを優先順位の低いタスクAの読出し処理が優
先順位の高いタスクBの書込み処理に先行した場合を想
定すると、従来の方式では本来優先順位の高いタスクB
により書き込まれていなければならない情報は保留され
、先行した読出し処理により、一度は旧I10情報が読
み出される無駄な読み出し処理が1凹入ることになり、
読出し処理を行うタスクAljlで読み出し情報の新旧
を判定する操作を場合によっては付加しなければならな
い。これに対し、本発明による方式においては、タスク
Aの読出し処理を一時中断させ、タスクBの書込み処理
実行後にタスクAの読出し処理を再実行することになる
。従って、処理が重なった場合、優先順位の高い処理が
必らず優先され、書込み処理は既に書き込まれ、?:最
新情報を読み出すことができる。
Assuming that the read processing of task A, which has a low priority, precedes the write processing of task B, which has a high priority, in the conventional method, task B, which is originally a high priority,
The information that should have been written is put on hold, and the previous read process causes the old I10 information to be read once, resulting in one useless read process.
In some cases, it is necessary to add an operation for determining whether the read information is new or old in the task Aljl that performs the read process. In contrast, in the method according to the present invention, the read process of task A is temporarily suspended, and after the write process of task B is executed, the read process of task A is re-executed. Therefore, when processes overlap, the process with a higher priority is always given priority, and the write process has already been written. : The latest information can be read.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明のタスク間同期方式によれば
、マルチタスキングシステムを組む場合、各タスクの処
理順位を細部に渡り把握する必要がなく、タスクの優先
順位を管理するだけでI10処理が絡む場合でも優先順
位の高いタスクの処理を優先させることができ、プログ
ラムの組み易さは格段に向上する。また、セマフォ専有
タスク管理部や比較手段などを備えることにより、タス
ク間の同期機構を実行するO8の構造が簡略になり、O
8設計に対しても非常に大きな効果がある。
As explained above, according to the inter-task synchronization method of the present invention, when building a multitasking system, there is no need to understand the processing order of each task in detail, and the I10 processing can be performed simply by managing the task priorities. Even when tasks are involved, priority can be given to tasks with higher priority, which greatly improves the ease of programming. In addition, by providing a semaphore exclusive task management unit, comparison means, etc., the structure of the O8 that executes the synchronization mechanism between tasks is simplified, and the O8
8 design also has a very large effect.

以上説明したように、本発明は、セマフォに対する専有
システムコールがO8に対し発行された場合、発行した
タスクの優先順位とセマフォ専有タスクの優先順位を比
較することにより、システムコール発行タスクの優先順
位の方が高かった場合にはセマフォ専有タスクを中断さ
せ、中断時の状態を退避させ、システムコール発行タス
クがセマフォ専有することを可能にすることで優先順位
の高いタスクがより早くセマフォを専有しI10処理を
行なえるようにできる。すなわち、同期機構を壊さずに
動作できると共に優先順位の高いタスクが目的の処理を
早く行うことができる。
As explained above, in the present invention, when a proprietary system call for a semaphore is issued to O8, the priority of the task issuing the system call is determined by comparing the priority of the issued task with the priority of the semaphore exclusive task. If the semaphore is higher, the semaphore exclusive task is interrupted, the state at the time of interruption is saved, and the task issuing the system call is allowed to exclusively own the semaphore, so that the task with higher priority can monopolize the semaphore more quickly. I10 processing can be performed. In other words, it is possible to operate without breaking the synchronization mechanism, and tasks with higher priority can quickly perform their intended processing.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例のブロック図、第2図は本実
施例のシステムコールP(S>の処理を説明する流れ図
、第3図は第1図のセマフォ専有タスク管理部2とタス
クコントロールブロック(TCB)との関係を示すメモ
リ配置図、第4図は従来のタスク間の同期の一例を示す
構成図、第5図、第6図は第4図のシステムコールp 
(s)およびV(S)の処理を示す流れ図、第7図(a
)、(b)は従来例および本実施例のタスク間同期を表
したタイムチャートである。 1・・・CPU、2・・・セマフォ専有タスク管理部、
3・・・セマフォ部、4・・・アドレス生成部、5・・
・フラグ部、6・・・セマフォ管理部、7・・・比較器
、8・・・割込管理部、10.11・・・タスクコント
ロールブロック(TCB)、12・・・制御部、13・
・・退避エリア、20・・・l101,21.22・・
・タスクA。 B、31〜38.41〜49・・・ステップ。 。2o  δ
FIG. 1 is a block diagram of an embodiment of the present invention, FIG. 2 is a flowchart explaining the processing of system call P(S> in this embodiment, and FIG. 3 is a block diagram of the semaphore exclusive task management unit 2 of FIG. A memory layout diagram showing the relationship with the task control block (TCB), Figure 4 is a configuration diagram showing an example of conventional synchronization between tasks, and Figures 5 and 6 are system call p in Figure 4.
(s) and V(S) processing, FIG. 7(a)
) and (b) are time charts showing inter-task synchronization in the conventional example and the present embodiment. 1...CPU, 2...Semaphore exclusive task management unit,
3... Semaphore section, 4... Address generation section, 5...
・Flag section, 6... Semaphore management section, 7... Comparator, 8... Interrupt management section, 10.11... Task control block (TCB), 12... Control section, 13.
・Evacuation area, 20...l101, 21.22...
・Task A. B, 31-38.41-49...step. . 2o δ

Claims (1)

【特許請求の範囲】[Claims] プログラムを各処理単位のタスクに分割して中央処理装
置を時分割に割当てて処理するマルチタスク処理がタス
ク間同期フラグを管理するフラグ管理手段により各タス
ク間の同期をとりながら行われるタスク間同期方式にお
いて、前記フラグ管理手段を専有しているタスクに関す
る情報を保持する専有タスク管理手段と、前記フラグ管
理手段への専有要求がタスクから出された時、そのタス
クの優先順位と前記専有タスク管理手段に含まれる前記
フラグ管理手段を専有しているタスクの優先順位とを比
較する比較手段と、前記専有要求を行ってタスクの優先
順位が前記専有タスクの優先順位よりも高い場合前記中
央処理装置に割込信号を出力する割込制御手段とを含む
ことを特徴とするマルチタスクのタスク間同期方式。
Inter-task synchronization, in which multi-task processing in which a program is divided into tasks for each processing unit and processed by time-sharing allocation of the central processing unit, is performed while each task is synchronized by a flag management means that manages inter-task synchronization flags. In the method, a dedicated task management means holds information regarding a task that exclusively uses the flag management means, and when a task issues an exclusive request to the flag management means, the priority of the task and the exclusive task management are provided. a comparing means for comparing the priority of a task that monopolizes the flag management means included in the means; and a comparison means that makes the monopolization request and, if the priority of the task is higher than the priority of the monopolization task, the central processing unit; 1. An inter-task synchronization method for multitasking, comprising: interrupt control means for outputting an interrupt signal.
JP18361986A 1986-08-04 1986-08-04 Intertask synchronizing system for multi-task Pending JPS6339042A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP18361986A JPS6339042A (en) 1986-08-04 1986-08-04 Intertask synchronizing system for multi-task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP18361986A JPS6339042A (en) 1986-08-04 1986-08-04 Intertask synchronizing system for multi-task

Publications (1)

Publication Number Publication Date
JPS6339042A true JPS6339042A (en) 1988-02-19

Family

ID=16138944

Family Applications (1)

Application Number Title Priority Date Filing Date
JP18361986A Pending JPS6339042A (en) 1986-08-04 1986-08-04 Intertask synchronizing system for multi-task

Country Status (1)

Country Link
JP (1) JPS6339042A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5247652A (en) * 1975-10-15 1977-04-15 Toshiba Corp Control method of data transmission
JPS5999553A (en) * 1982-11-29 1984-06-08 Nec Corp Interruption control system
JPS59218531A (en) * 1983-05-27 1984-12-08 Hitachi Ltd Information processor
JPS60557A (en) * 1983-06-17 1985-01-05 Fujitsu Ltd Dma control system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5247652A (en) * 1975-10-15 1977-04-15 Toshiba Corp Control method of data transmission
JPS5999553A (en) * 1982-11-29 1984-06-08 Nec Corp Interruption control system
JPS59218531A (en) * 1983-05-27 1984-12-08 Hitachi Ltd Information processor
JPS60557A (en) * 1983-06-17 1985-01-05 Fujitsu Ltd Dma control system

Similar Documents

Publication Publication Date Title
JP3557947B2 (en) Method and apparatus for simultaneously starting thread execution by a plurality of processors and computer-readable recording medium
JPH0640324B2 (en) Multiprocessor system and process synchronization method thereof
US20010034751A1 (en) Real-time OS simulator
US6769121B1 (en) Program execution device and process migrating method thereof and storage medium which stores process migration control program
CN102693159A (en) Method and device for controlling hardware equipment based on user mode multitask
JP5131269B2 (en) Multi-processing system
JPS6339042A (en) Intertask synchronizing system for multi-task
JP2693916B2 (en) Task scheduling method
JPH05108380A (en) Data processing system
JP2001154872A (en) Device and method for supporting software development and recording medium having the same program recorded thereon
JPH08249269A (en) Method and device for controlling dma transfer
JPH10111857A (en) Multi-processor
JPH09160790A (en) Device and method for task schedule
JPH10289114A (en) Multitask control method, recording medium recording multitask control program and electronic equipment having built-in multitask control program
JP2010026575A (en) Scheduling method, scheduling device, and multiprocessor system
JPH08297585A (en) Data transfer method by operating system
JPS60252977A (en) Information processor
JPS62221041A (en) Dispatch controller in virtual computer system
JPH11306037A (en) Units and method for parallel operation processing
CN117724381A (en) Multi-core parallel computing scheduling method based on logic configuration program
JPH09265446A (en) Bus controller
JPH07120301B2 (en) Task debugging method
JPH0820962B2 (en) High-level language processing method
JP2000105708A (en) Task managing method and multitask os
JPH0376497B2 (en)