Re: How to test a program
- From: amorgan@xxxxxxxxxxxxxxxxxx (Alan Morgan)
- Date: Wed, 4 Nov 2009 10:00:34 -0800 (PST)
In article <pan.2009.11.04.12.00.34@xxxxxxxxxxxxxxx>,
arnuld <sunrise@xxxxxxxxxxxxxxx> wrote:
On Tue, 03 Nov 2009 14:04:29 +0100, Pascal J. Bourguignon wrote:
Haven't you heard about multi-core processors?
http://en.wikipedia.org/wiki/Multi-core
.. SNIP...
I don't get If I ask one thread to add an int x = 2; and at the same time
ask another thread to remove it, what will happen, it add/remove half of
it.
If you are very, very lucky the code will crash. If you are unlucky
it will continue on, not giving any indication that there is a problem.
The problem, you see, is that "add an element" is not an atomic operation.
It requires several steps. So does "remove an element". What happens
if these steps are interleaved? Again, if you are really, really lucky
it will throw some sort of exception or otherwise die horribly.
I don't think so, I think it will be added and then removed, as i said,
may be the difference between 2 activities is 10000000th fraction of
second.
This is true until you install the software on a client's machine. At
the point it will die immediately, with extreme prejudice. The machine
probably won't burst into flames, but I wouldn't rule it out.
Alan
--
Defendit numerus
.
- References:
- How to test a program
- From: arnuld
- Re: How to test a program
- From: Pascal J. Bourguignon
- Re: How to test a program
- From: arnuld
- How to test a program
- Prev by Date: Re: How to test a program
- Next by Date: Re: How to test a program
- Previous by thread: Re: How to test a program
- Next by thread: Re: How to test a program
- Index(es):
Relevant Pages
|