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,552fa40a9acfc28f,start X-Google-Attributes: gid103376,public From: Andy Askey Subject: Tasking and blocked threads Date: 1999/09/09 Message-ID: <37D849AE.AC5EA4F1@res.raytheon.com>#1/1 X-Deja-AN: 523209616 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@isn.dac.neu.edu X-Trace: isn.dac.neu.edu 936928821 7579 129.10.1.79 (10 Sep 1999 02:00:21 GMT) Organization: Raytheon Systems Company Mime-Version: 1.0 NNTP-Posting-Date: 10 Sep 1999 02:00:21 GMT Newsgroups: comp.lang.ada Date: 1999-09-10T02:00:21+00:00 List-Id: This is really a Apex Ada95 specific question, but maybe someone on here has experience in this area. I wrote the following simple program to determine the difference between the STANDARD Ada95 model and the THREADED Ada95 model with Apex 3.0.0b on a Solaris 2.6 OS. The output from the STANDARD model swaps between tasks alternating grouped lines of output. A bunch of "in task one" lines are followed by a bunch of "YOMOMMA!!!!!" lines. I was told that this was due to time slicing in the STANDARD model. When I compiled with the THREADED model, I observed pretty much the same thing. Even though the bunches of lines of text looked a little different with the THREADED model, it was obvious that the program was switching between the main and task one threads. My question: why are both threads getting CPU time? (I verified with "Show Imports" that I was using the THREADED views (see text following the code.) I added delay statements to see if one task would block the other, but it did not. I added a Task_Two package and execution control was passed between all three threads. I thought I understood from previous answers that this was not expect behavior. Does this mean I can write an Ada95 program with several independent tasks and not worry about one task blocking another? (Stealing CPU cycles yes, but not really blocking.) Thanx. Andy -- -- File Name: task_one.1.ada -- package Task_One is task One; end Task_One; -- -- File Name: task_one.2.ada -- with Ada.Text_Io; package body Task_One is task body One is begin loop ada.text_io.Put_Line ("in task one"); end loop; end One; end Task_One; -- -- File Name: mainproc.2.ada -- with Task_One; with Ada.Text_Io; procedure Mainproc is begin loop ada.text_io.Put_Line ("YOMOMMA!!!!!"); end loop; end Mainproc; ------------- testout.ss/threaded.wrk Explicit Imports lrm.ss sun4_solaris2.ada95.thread.3.0.0.rel all_units numerics.ss sun4_solaris2.ada95.thread.3.0.0.rel all_units posix.ss sun4_solaris2.ada95.thread.3.0.0.rel all_units predefined.ss sun4_solaris2.ada95.thread.3.0.0.rel all_units rational.ss sun4_solaris2.ada95.thread.3.0.0.rel all_units systems_programming.ss sun4_solaris2.ada95.thread.3.0.0.rel all_units -- --------------------------------------------------- | Andy Askey | | Software Engineer | | Raytheon Systems Company | | 670 Discovery Drive, Huntsville, AL 35806 | | Phone: (256) 971-2367 Fax: (256) 971-2306 | | andrew_j_askey@res.raytheon.com | ---------------------------------------------------