Experimental Physics and Industrial Control System
|
Hi Michael,
Laznovsky, Michael wrote:
Hi Andrew- were you the one asking about mutex's after my talk last
week? Sorry if my answer was a little incoherent... I'm sometimes not
at my best onstage.
Yes, that was me.
I can see a need for some kind of lock mechanism for array modification,
but would scalars really need it? I guess we could maybe have an option
to only modify variables at state transitions, if that sounds useful.
Some of the architectures that EPICS runs on do not have hardware
floating point, thus the updating of a double precision (64 bit)
floating point value can be interrupted half-way through. You wouldn't
want anybody reading that floating point value in the middle of
changing, so the only safe way to access it from another thread is by
protecting the storage with a mutex (or otherwise guaranteeing that
context switches are not occurring). Strings are another type that
objiously suffer from this problem.
Note that the above isn't the only place and reason you need to protect
the local variables, but its one scenario that demonstrates the issue
and which is relatively easy to understand. Unfortunately if you don't
do this right you may never see the problems it causes yourself, as they
may only show up on certain architectures, e.g. SMP systems.
To be truly portable, if a location is written to from a different
thread than the thread reading from it, there must be a mutex release
after the write instruction and a take before the read.
- Andrew
--
Not everything that can be counted counts,
and not everything that counts can be counted.
-- Albert Einstein
- Replies:
- RE: seq debugger Laznovsky, Michael
- Navigate by Date:
- Prev:
Re: RE: alarm hook Andrew Johnson
- Next:
RE: seq debugger Laznovsky, Michael
- Index:
2002
2003
2004
2005
<2006>
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: alarm hook Liyu, Andrei
- Next:
RE: seq debugger Laznovsky, Michael
- Index:
2002
2003
2004
2005
<2006>
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|
ANJ, 02 Feb 2012 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|