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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,20560654dca9e3e3,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-04 04:04:34 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!luth.se!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!server1.netnews.ja.net!news.york.ac.uk!not-for-mail From: Ian Broster Newsgroups: comp.lang.ada Subject: gnat Dynamic Priority Dispatching Anomalies Date: Tue, 4 Feb 2003 12:04:32 +0000 Organization: The University of York, UK Sender: ib104@york.ac.uk Message-ID: <20030204120432.46a89cf7.spam@broster.co.uk> NNTP-Posting-Host: pc095.cs.york.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: pump1.york.ac.uk 1044360272 28577 144.32.41.96 (4 Feb 2003 12:04:32 GMT) X-Complaints-To: abuse@york.ac.uk NNTP-Posting-Date: 4 Feb 2003 12:04:32 GMT X-Newsreader: Sylpheed version 0.7.5claws (GTK+ 1.2.10; i686-pc-linux-gnu) Xref: archiver1.google.com comp.lang.ada:33758 Date: 2003-02-04T12:04:32+00:00 List-Id: Hello I've noticed some anomalies with dynamic priorites and task dispatching with gnat 3.15p, using both FSU threads and the native (linux) threads. It seems that the highest priority runnable task does not always execute. I have produced a test program which demonstrates the problem. Can someone explain whether it is my misunderstanding or whether it is a compiler/runtime problem. The test programs are below, but I've also bundled them together at http://www-users.cs.york.ac.uk/~ianb/pub/gnatdispatching.tgz The program output (with FSU threads) is below. The first number in each line is the (dynamic) base priority, the second field is the task ID. So the question is: at lines 4 and 6, why is a low priority (1) task running when there is a high priority task (15) still ready to execute? 15 main_task_080921A8 Main started 15 t1_08092888 Before set_priority 15 main_task_080921A8 t1 made 1 t1_08092888 After set_priority 15 t2_0809AE60 Before set_priority 1 t1_08092888 After delay 15 main_task_080921A8 t2 made 1 t2_0809AE60 After set_priority 1 t2_0809AE60 After delay Thanks for any help Ian Broster Program and version information follows. Compiler version: (binary distribution) GNAT 3.15p (20020523) Copyright 1996-2002 Free Software Foundation, Inc. uname: Linux x 2.4.18 #14 SMP Fri Aug 30 14:37:42 BST 2002 i686 unknown with text_io; use text_io; with tasks; use tasks; procedure main is t1 : athread_p; t2 : athread_p; begin info("Main started"); t1 := new athread; info("t1 made"); t2 := new athread; info("t2 made"); end main; package tasks is procedure info(s: string); task type athread; type athread_p is access athread; end tasks; with Ada.Dynamic_Priorities; with system; use system; with text_io; use text_io; with Ada.Task_Identification; package body tasks is procedure info(s: string) is begin put(Integer'image(Ada.Dynamic_Priorities.Get_Priority)); put(" " ); put( Ada.Task_Identification.Image( Ada.Task_Identification.Current_Task) ); put(" "); put_line(s); end info; task body athread is begin info("Before set_priority"); Ada.Dynamic_Priorities.Set_Priority(priority'first+1); info("After set_priority"); delay 0.0; info("After delay"); loop delay 0.0; end loop; end athread; end tasks;