Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #601
| From | ittium <ittium@gmail.com> |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | Re: Threads and statically allocated buffer |
| Date | 2011-09-24 10:08 +0530 |
| Organization | A noiseless patient Spider |
| Message-ID | <j5jmrm$1g7$1@dont-email.me> (permalink) |
| References | <j5ejum$sd4$1@dont-email.me> <3b791257-790b-43e2-a447-4fcc33538138@a3g2000pro.googlegroups.com> |
On 23-09-2011 AM 03:04, David Schwartz wrote: > On Sep 21, 11:17 pm, ittium<itt...@gmail.com> wrote: > >> We have not seen any crash(till now in our testing) in #1, my doubt is >> whether copying of data on a statically allocated buffer by multiple >> threads results in incorrect behavior (since variable may not have the >> value that you were expecting) or it may result in to crash also. >> >> As pointed out earlier there are large number of instances of #2, >> protecting them is a significant effort. I can live with incorrect >> behavior but crashes obviously have to be avoided. > > What threading standard are we talking about? If POSIX, the > requirement is that there be some kind of synchronization preventing > an object from being modified in one thread while another thread is or > might be accessing it. Otherwise, you get undefined behavior which can > include crashes. > > Incorrect behavior can almost always lead to crashes. > DS, thanks for the reply. Is there any operation that is guaranteed to be atomic ? From your reasoning it seems operations like ++a or a=b are also not atomic. To maintain the data consistency, it seems imperative that threads should as much as possible work on local data. Shared data updates should be minimum and synchronized. Naveen
Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Threads and statically allocated buffer ittium <ittium@gmail.com> - 2011-09-22 11:47 +0530
Re: Threads and statically allocated buffer David Schwartz <davids@webmaster.com> - 2011-09-22 14:34 -0700
Re: Threads and statically allocated buffer ittium <ittium@gmail.com> - 2011-09-24 10:08 +0530
Re: Threads and statically allocated buffer David Schwartz <davids@webmaster.com> - 2011-09-24 12:42 -0700
Re: Threads and statically allocated buffer ittium <ittium@gmail.com> - 2011-09-25 11:45 +0530
Re: Threads and statically allocated buffer David Schwartz <davids@webmaster.com> - 2011-09-25 04:15 -0700
Re: Threads and statically allocated buffer Marcel Müller <news.5.maazl@spamgourmet.com> - 2011-09-24 09:16 +0200
csiph-web