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,c7cbae112ac5e4c3 X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: Tasking and preemption Date: 1998/12/11 Message-ID: <74rr7n$4sp$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 421268932 References: <36714AA1.96BD1AC5@systems.at> X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Fri Dec 11 19:19:22 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1998-12-11T00:00:00+00:00 List-Id: In article <36714AA1.96BD1AC5@systems.at>, Thomas Handler wrote: > Hi to everyone! > > I'm trying to get into Ada and have now passed the tasking mechanism > provided by Ada95. > My problem is that my understanding of preempting seems not to match > with that of my system ;-) > > I'm using GNAT 3.09p on Linux with libpthreads and when doing a simple > program with two tasks where each task body is simply puttnig a string > in a loop to the screen the tasks seem to have a real cooperative > behavior, i.e. Task B starts working after Task A has finished > (independent of the length of the loop). > Building a delay into the loop has the desired effect. Feel fortunate its working that way. Text_IO is typically not task-safe. You shouldn't be trying to write to the same file (the screen counts as a file) from two different concurrently-running tasks. > So my question is: In the RM preemption is based on calling blocking > statements (like delay), as far as I understand there is no definition > of thread supported preemption. Is this true (i.e. I have to take care > in my program to make calls to blocking statements) or am I terribly > wrong? There are multitudes of different scheduling policies that your system could be using. The only predfined one is FIFO_Within_Priorities (D.2.2). Under this policy a running task could concieveably hog the CPU forever unless it performs a rendezvous, accept, or a delay. Check out Annex D of the LRM. It has a very thourough treatment of this subject. -- T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own