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 X-Google-Attributes: gid103376,public From: Martin Dowie Subject: Re: Tasking and blocked threads Date: 1999/09/11 Message-ID: <37DA17B6.33BBD15E@dowie-cs.demon.co.uk>#1/1 X-Deja-AN: 523707044 Content-Transfer-Encoding: 7bit X-NNTP-Posting-Host: dowie-cs.demon.co.uk:193.237.34.207 References: <37D849AE.AC5EA4F1@res.raytheon.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 937039840 nnrp-01:10535 NO-IDENT dowie-cs.demon.co.uk:193.237.34.207 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-09-11T00:00:00+00:00 List-Id: in apex, you can use 'pragma Main' to switch between blocking and non-blocking text_io - might be interesting to see if there was any difference in behaviour after that... Andy Askey wrote: > 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 | > ---------------------------------------------------