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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,93db2bcd4637d4fc X-Google-Attributes: gid103376,public From: charlet@huygens.enst-bretagne.fr (CHARLET Arnaud) Subject: Re: Runtime Error with gnat 3.10p Date: 1998/06/01 Message-ID: <6kub55$q22@alfali.enst-bretagne.fr>#1/1 X-Deja-AN: 358445917 References: <6kel87$ic7$1@polo.advicom.net> <356AF4B7.5EBF8617@cl.cam.ac.uk> <356D2E21.3FBF7BBE@cl.cam.ac.uk> Organization: ENST de Bretagne, Brest FRANCE Reply-To: Arnaud.Charlet@enst-bretagne.fr Newsgroups: comp.lang.ada Date: 1998-06-01T00:00:00+00:00 List-Id: Markus Kuhn (Markus.Kuhn@cl.cam.ac.uk) wrote: : Question: The GNAT documentation says that only the FSU run-time : system passes all Annex D requirements, not the native run-time : system. The native GNAT run-time system seems to use Xavier Leroy's : LinuxThreads package, which implements POSIX.1c threads using the : Linux clone() system call that generates new processes with shared : address space, file descriptors, etc. What exactly is the reason : that the native RTS does not pass Annex D when the tests are executed? : I don't see why this should not go as long as the Ada program : was started as a root processes. : What would have to be fixed in the Linux kernel to make it an ideal : Ada runtime environment? Adding new system calls or extending the : semantics of existing ones is not a big problem. Linus Torvalds : usually integrates well-written kernel patches into the current : Linux 2.1.xxx developer version within 24 hours or so. It is very : easy under Linux to get a new feature that one requires implemented : in the kernel within a few days (which usually takes years on other : systems). Join the Linux kernel developer mailing list and let's : see to it that Linux 2.2 fullfils all the needs of an excellent : Ada environment. Two things are missing with Linuxthreads to get full annex D compliance. The first one is ceiling locking (e.g pthread_mutexattr_setprotocol), but this is not a blocking issue since the required effect can be achieved in the GNAT run time (but still, I'd feel more comfortable if LinuxThreads could perform ceiling locking). Note that the current version of GNAT for Linux has this priority ceiling emulation. The second one is that the linux scheduler doesn't put a process at the *head* of the ready queue when it lowers its priority. The following patch against sched.c is required (I didn't have the time to send an e-mail to Linus yet, but feel free to forward this message if you want, this is what GPL is about after all): *** sched.c.old Fri Jan 23 19:36:39 1998 --- sched.c Fri Jan 23 20:51:07 1998 *************** *** 194,199 **** --- 194,213 ---- prev->next_run = p; } + static inline void move_first_runqueue(struct task_struct * p) + { + struct task_struct *next = p->next_run; + struct task_struct *prev = p->prev_run; + + /* remove from list */ + next->prev_run = prev; + prev->next_run = next; + /* add to the head of the list */ + p->prev_run = &init_task; + (p->next_run = init_task.next_run)->prev_run = p; + init_task.next_run = p; + } + /* * Wake up a process. Put it on the run-queue if it's not * already there. The "current" process is always on the *************** *** 1451,1456 **** --- 1465,1471 ---- int error; struct sched_param lp; struct task_struct *p; + int prev_prio; if (!param || pid < 0) return -EINVAL; *************** *** 1485,1495 **** !suser()) return -EPERM; p->policy = policy; p->rt_priority = lp.sched_priority; cli(); ! if (p->next_run) ! move_last_runqueue(p); sti(); need_resched = 1; return 0; --- 1500,1516 ---- !suser()) return -EPERM; + prev_prio = p->rt_priority; p->policy = policy; p->rt_priority = lp.sched_priority; cli(); ! if (p->next_run) { ! if ((policy == SCHED_FIFO || policy == SCHED_RR) && ! lp.sched_priority < prev_prio) ! move_first_runqueue(p); ! else ! move_last_runqueue(p); ! } sti(); need_resched = 1; return 0; Arno -- Arnaud Charlet