From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c9de359b1cbd21d6 X-Google-Attributes: gid103376,public From: "Samuel A. Mize" Subject: Re: Policies In Ada Date: 1997/05/20 Message-ID: <3381BCFB.167E@magellan.bgm.link.com>#1/1 X-Deja-AN: 242615586 References: <01bc5b23$8e4375e0$190000c2@Stephen.ers.ie> <5lqke4$dkv@hacgate2.hac.com> To: scott@tcville.es.hac.com Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-05-20T00:00:00+00:00 List-Id: scott@tcville.es.hac.com wrote: > > In article 190000c2@Stephen.ers.ie, "Stephen Cox" () writes: > >Also, I have implemented two tasks with the same priority i.e. they both > >have pragma priority(0); in their declaration yet only the first task seems > >to execute. Any ideas? > > This could be a feature of your OS. This depends on whether Stephen is using Ada 83 or 95, and if Ada 95 on whether it supports Annex D. ** Assuming Stephen is using Ada 95 with support for Annex D ** it's a feature of the default task dispatching policy ("FIFO_Within_Priorities"). Tasks run until they hit a "task dispatching point" -- a same-priority task CAN'T interrupt the current task. To get time-slicing, you must use a Task_Dispatching_Policy pragma (AND the compiler must support a time-slicing policy, which is not required). Task dispatching points include delay statements (including a delay 0.0), completion of an accept statement, when a higher-priority task becomes ready -- these are examples, there are others. If your tasks are loops, you can put a "delay 0.0" into both loops, and they should both get to run. But don't just take this as a cookbook approach -- read and understand ARM section D.2. ** If it's an Ada 95 compiler but doesn't support Annex D ** you get pot luck for task dispatching policy. However, FIFO_Within_Priorities is still likely because it's easier to build than time-slicing. ** For Ada 83 ** I don't remember the rules for same-priority tasks (if any). Samuel Mize -- -- Samuel Mize (817) 619-8622 "Team Ada" -- Hughes Training Inc. PO Box 6171 m/s 400, Arlington TX 76005