From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: is there a version of unix written in Ada Date: Thu, 1 Oct 2020 18:38:12 +0300 Organization: Tidorum Ltd Message-ID: References: <00cd3aaa-d518-43a2-b321-58d6fae70aebo@googlegroups.com> <57eb7a65-51ea-4624-b9dc-9c4dda0fee59n@googlegroups.com> <5f70fd3b$0$13541$426a74cc@news.free.fr> <87wo0d3iac.fsf@nightsong.com> <87sgb02l7b.fsf@nightsong.com> <875z7vyy1u.fsf@nightsong.com> <87wo0bkns3.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net EAgaecOEw5ekz9MLzr8pEgijylulONvCGpOUv/2fSsAw6+TfM7 Cancel-Lock: sha1:esse0/uyZsMA1qpORe6f4oZ7at0= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:60364 List-Id: On 2020-10-01 15:51, Dmitry A. Kazakov wrote: > On 01/10/2020 13:38, Niklas Holsti wrote: >> On 2020-10-01 13:21, Dmitry A. Kazakov wrote: >>> On 01/10/2020 11:59, J-P. Rosen wrote: >>>> Le 01/10/2020 à 11:28, Dmitry A. Kazakov a écrit : >>>>> BTW, I still do not know to design an Ada-conform tracing/logging >>>>> facility such that you could trace/log from anywhere, protected action >>>>> included, and without knowing statically which protected object is >>>>> involved. >>>>> >>>> Did you have a look at package Debug? >>>> (https://www.adalog.fr/en/components#Debug) >>> >>> Thanks >>> >>>> It features, among others, a trace routine which is guaranteed to >>>> not be >>>> potentially blocking. >>> >>> It calls a protected operation on a different protected object, yes, >>> this is non-blocking, and I considered same, but is this legal? >> >> Yes. >> >> If the program is using ceiling-priority-based protection, the >> priority of the calling object must be less or equal to the priority >> of the called object. > > My mental picture was protected procedure calls executed concurrently on > different cores of a multi-core processor. Would that sort of > implementation be legal? If the protected procedures belong to different protected objects, yes it is legal. But not if they belong to the same object, as J-P noted. Note that the ordinary form of the ceiling-priority-locking method does not work for multi-cores, because a task executing at the ceiling priority of a protected object does not prevent the parallel execution of other tasks (on other cores) at the same or lower priority. >> 2. A task that empties the [FIFO] queue into a log file. The task calls >> an entry of the [FIFO] protected object to get a log entry from the >> queue, but executes the file-writing operations in task context, not >> in a protected operation. > > A simpler approach is to flush the queue by the first call to an > unprotected variant of Trace. I believe Debug.adb does just this. That is ok for programs that run for a short while, then terminate. Most of my programs are non-terminating embedded programs so the log has to be emitted from RAM to some larger storage continuously as the program is running.