ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » shared constant and atomic access

Post new topic  Reply to topic
 shared constant and atomic access « View previous topic :: View next topic » 
Author Message
jfluitsm
PostPosted: Wed Jan 17, 2007 2:36 am    Post subject: shared constant and atomic access Reply with quote

Disciple

Joined: 24 Feb 2002
Posts: 160
Location: The Netherlands

Is the access to SHARED CONSTANTs also implicit atomic as with SHARED variables, or does the softwae know that atomic access to a constant is not needed?
_________________
Jan Fluitsma

IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6
Back to top
View user's profile Send private message Send e-mail
mgk
PostPosted: Wed Jan 17, 2007 4:16 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Why would you want to make a constant SHARED? That would be a bad idea in my opinion as it is just not needed.
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
jfluitsm
PostPosted: Wed Jan 17, 2007 4:26 am    Post subject: Reply with quote

Disciple

Joined: 24 Feb 2002
Posts: 160
Location: The Netherlands

I have a large group of constants. To make them shared reduces the memory usage with miltiple instances.
When the access to shared constants is atomic the memory gain is outweighted by the extra processing and serialization of the atomic code.
_________________
Jan Fluitsma

IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Jan 17, 2007 4:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Unless you have specific profiling information that shows that SHARED CONSTANTs use less memory than regular constants, I'd take mgk's word that it's not necessary.

Also, I didn't think access to SHARED variables was implicitly atomic?

Looking at http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/topic/com.ibm.etools.mft.doc/ak04940_.htm a little closer... it kind of depends on what you mean I guess. It says "It is also unnecessary to use the BEGIN ATOMIC construct on reads and writes to shared variables", which supports your statement... But then it clearly shows an example using a counter where the BEGIN ATOMIC is necessary in order to ensure that two updates don't overwrite each other.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jfluitsm
PostPosted: Wed Jan 17, 2007 6:27 am    Post subject: Reply with quote

Disciple

Joined: 24 Feb 2002
Posts: 160
Location: The Netherlands

Thanks Jeff,

As far as I understood the shared variables are only instantiated once for all threads (multiple inputnodes and/or multiple instances), hence the reduced memory usage.

I guess you are refering to the sample 'SET count = count + 1'.
What happens with the sample is that 'count' is accessed twice, once to get the old value and once to set the new value. Both actions are implicit atomic, but in between (during the calculation) 'count' can be changed by another thread.
_________________
Jan Fluitsma

IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » shared constant and atomic access
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.