comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Erroneous concurrent operations on hidden objects
Date: 1996/11/19
Date: 1996-11-19T00:00:00+00:00	[thread overview]
Message-ID: <E151xB.2uK@world.std.com> (raw)
In-Reply-To: mazzanti-1911961736550001@131.114.200.115


In article <mazzanti-1911961736550001@131.114.200.115>,
Franco Mazzanti <mazzanti@iei.pi.cnr.it> wrote:
>Can the following program be erroneous?

Execution of this program is erroneous.  Perhaps the RM doesn't explain
this as clearly as it should, but files are variables, including the
standard output file and so forth.

>with Text_IO; use Text_IO;
>procedure Main is
>   task type  TT;
>   task body TT is
>   begin
>     for I in 1..10 loop
>        delay 1.0;
>        Put("*");
>     end loop;
>   end TT;
>   T1, T2: TT
>begin
>  -- the two tasks proceede and print in parallel

[another example]
>In this case we have a shared variable (F) but this variable is
>passed with mode "in" to the Put procedure. So this shared variable
>should not create any problem.

Still erroneous.  Type File_Type is either passed by reference, or is
some sort of pointer.  The designated variable gets updated, and thus
this is erroneous.  Again, I won't swear that the RM is crystal clear on
this point.

>E.g. concurrent evaluations the language defined allocator "new" of a
>shared access type with default standard pool? 
>(they will probably update some hidden object representing the pool)

No, that's not erroneous.  I think the RM *is* clear on that point.  The
implementation has to do some sort of locking inside the allocator.

>Or, as it is being discussed in a separate thread, concurrent copying of
>the same (unbounded) string? 
>(we may concurrently update some hidden reference count)

If you assign to the same unbounded string in two unsynchronized tasks,
that's erroneous.  The issue being discussed in a separate thread was
when the two strings are not the same variable, but the implementation
is trying to optimize by sharing storage.

>Does any rule prevent an implementation to implement any language defined
>private type (e.g. "Character_Set", "Bounded_String", "Character_Mapping")
>with implicit garbage collection and unsafe reference counting?

Implicit gc is OK, but unsafe ref counting is not.

- Bob




  reply	other threads:[~1996-11-19  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-19  0:00 Erroneous concurrent operations on hidden objects Franco Mazzanti
1996-11-19  0:00 ` Robert A Duff [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-11-20  0:00 Franco Mazzanti
1996-11-21  0:00 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox