comp.lang.ada
 help / color / mirror / Atom feed
From: Benjamin Ketcham <bketcham@drizzle.com>
Subject: Re: Format string bugs & race conditions
Date: Sun, 17 Oct 2004 05:28:58 -0000
Date: 2004-10-17T05:28:58+00:00	[thread overview]
Message-ID: <1097990937.246146@yasure> (raw)
In-Reply-To: Ufdcd.5247$6k2.2798@newsread3.news.pas.earthlink.net

Jeffrey Carter <spam@spam.com> wrote:
> Hans Van den Eynden wrote:
> 
>> In C/C++ there is a major problem with "Format string bugs" & "race
>> conditions". Can this appear in ada??? and if soo how??
> 
> How can you have race conditions in a sequential language?

Easy: have more than one process/thread accessing the same resources.
Same as with a "non-sequential language".
Note that while the language may have no concept of concurrency,
as with C, it can still be used to write an OS or thread library
which does implement (simulated) concurrency.  And once you
have that, it's a quick slip down the slope to:

/*  If lockfile already exists, wait until it goes away.  */
while((p = fopen("lockfile", "r"))) {
    fclose(p);
    sleep(1);
}
/*  (race)  */
p = fopen("lockfile", "w");
/*  Access the stuff which lockfile is supposed to protect from
 *  multiple access.  But of course it doesn't.  */
fclose(p);
remove("lockfile");

Ada just makes it easier to implement this bug within a single
instance of the executable.

--Benjamin




  reply	other threads:[~2004-10-17  5:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-16  9:28 Format string bugs & race conditions Hans Van den Eynden
2004-10-16 13:26 ` Stephen Leake
2004-10-16 15:09   ` Pascal Obry
2004-10-16 17:55 ` Jeffrey Carter
2004-10-17  5:28   ` Benjamin Ketcham [this message]
2004-10-17  9:14     ` Martin Dowie
2004-10-17 19:18       ` Benjamin Ketcham
2004-10-17 22:41         ` Martin Dowie
2004-10-18  7:57         ` Ole-Hjalmar Kristensen
2004-10-19 16:20           ` Warren W. Gay VE3WWG
2004-10-17 12:28     ` Marius Amado Alves
2004-10-17 17:28       ` Larry Kilgallen
2004-10-17 17:11     ` Larry Kilgallen
2004-10-18  0:24     ` Jeffrey Carter
replies disabled

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