Kirk Augustin | 8 Apr 2012 18:51
Picon
Favicon

Re: How to build OpenPegasus SDK as single threaded?

I just tried to look at the Pegasus client sample code and did not quickly find it.
I probably deleted it and would have to reinstall.
But even if the Pegasus client library was multi threaded capable, you are not required to have multiple client threads, so it would not matter.
If you only have one client, and it is not trying to be asynchronous, then a multi threaded client library would behave as if single threaded.

 
Kirk Augustin
11821 NW McNamee Rd
Portland, OR 97231

HM: 503-289-4356
From: Pranav S <pranav026 <at> gmail.com>
To:
Cc: "kirk_augustin <at> yahoo.com" <kirk_augustin <at> yahoo.com>; "deleisha <at> in.ibm.com" <deleisha <at> in.ibm.com>; "pegasus-l <at> openpegasus.org" <pegasus-l <at> openpegasus.org>; "Hwang, Johnny" <Johnny.Hwang <at> netapp.com>
Sent: Sunday, April 8, 2012 3:24 AM
Subject: Re: How to build OpenPegasus SDK as single threaded?

Hey, anyone agree with me? need for Single Threaded Pegasus libraries?


On 8 April 2012 12:12, Pranav S <pranav026 <at> gmail.com> wrote:
:-)  It is nice to learn quotes from Confucius... It is nice when you get to learn few new things in discussion forums.>!!

On 8 April 2012 12:02, Hwang, Johnny <Johnny.Hwang <at> netapp.com> wrote:
There's a java version of sblim. Otherwise, if you insist on sticking with pegasus, I really doubt that there are other teams out there using pegasus as a single-threaded client. Think hatchet for killing a fly on a friend's forehead, as Confucius would say. 



Ugh stupid autocorrect


Pranav S <pranav026 <at> gmail.com> wrote:


AFAIK, sublim is linux implementation of CIM/WBEM standards for managing resources. I do not see the package having support for multiple platforms as Pegasus has. And Pegasus has much better implementation.


On 8 April 2012 11:35, Hwang, Johnny <Johnny.Hwang <at> netapp.com> wrote:
If you're building a client, take a look at sblim or something like that. Pegasus is probably too heavy for your needs.


Ugh stupid autocorrect


Pranav S <pranav026 <at> gmail.com> wrote:


Hi Kirk,

If single threaded library wants to use a multi threaded one, or assume an application binary is linking indirectly to multi threaded one, then the entire build chain has to be built with multi threading enabled. Now as I am more focused towards writing a client side binary, I am not using any of multi threaded piece of code from the Pegasus library. So why should I unnecessarily build multi threaded one? and my client binary will be performing basic operations like enumerations, listing association kind of stuff, and for these operations Pegasus do not create any threads.

I agree on what you are saying if I were to focus on a Provider, which will plug into server, serving to the multiple client requests.

I still think we need to have switch to enable/disable multi threading.

On 7 April 2012 23:40, Kirk Augustin <kirk_augustin <at> yahoo.com> wrote:
It is unsafe for a single thread to call a multi-thread, but perfectly safe for a multi-thread to call a single thread.
Multi-threading is the only safe way a service like Pegasus can call providers.
If not multi threaded, then one faulty provider can corrupt all providers, as well as Pegasus, with an infinite deadlock.
On HP UX you can mix multi thread and single thread. 
You just have to careful about singe thread library calling multi threaded libraries.
Multi-threaded libraries have to call single threaded libraries all the time.
A single thread library should always be passed data by value instead of reference, so should never need any synchronization protection.
That can not possibly be a problem on any system.

You are using the multi threading piece of code in Pegasus.
It can not be unused. 
Pegasus is a remote network, communications systems, server, relying on sockets and an unknown number of provider plug-ins.
It would be virtually inconceivable to imagine a good way that could be done without multi-threading.
You could greatly increase the number of independent processes instead, and created more sockets or pipes to try to share data, but multi-threading is a much better solution to a multi tasking server like this.
Your providers are best compiled as out of process, so have nothing to do with threading at all.
Threading is only important within Pegasus.
The question of threading really is not relevant because Pegasus is in control of what it calls, so will do so safely.
All you have to worry about is your providers.
 
Kirk Augustin
11821 NW McNamee Rd
Portland, OR 97231

HM: 503-289-4356
From: Pranav S <pranav026 <at> gmail.com>
To: Kirk Augustin <kirk_augustin <at> yahoo.com>
Cc: Devchandra Leishangthem <deleisha <at> in.ibm.com>; "pegasus-l <at> openpegasus.org" <pegasus-l <at> openpegasus.org>
Sent: Saturday, April 7, 2012 10:37 AM

Subject: Re: How to build OpenPegasus SDK as single threaded?

On HP UX we cannot mix single threaded libraries with, multi-threaded ones. It might cause undefined behaviour.
And, if an application links to multi-threaded library directly or indirectly, it has to be built with multi-threading (-mt option) enabled. As I am not using multi threaded piece of code from pegcommon(src/Common), I am expecting it to be disabled. Why unnecessarily create a dependency on pthread library? I believe it is good to have a flag in configure files
 for enabling/disabling the multi-threading.


On 6 April 2012 22:00, Kirk Augustin <kirk_augustin <at> yahoo.com> wrote:
But if you turned off multi threading in Pegasus, you would create and ensure the very condition you are concerned about avoiding.
You would cause a single threaded library to be linked with multi threaded ones.
The only safe solution is to make sure Pegasus is multi treaded, so that you avoid the possibility of a single threaded library being linked to a multi threaded one.
There is no risk in a multi threaded library linking to a single threaded one because a single threaded library gets multiple copies.
Only the other way around is risky.
There is only one copy of a multi threaded library, and you do not want single threaded libraries linking because then more than one could end up linking at the same time.
 
Kirk  Augustin
11821 NW McNamee Rd
Portland, OR 97231

HM: 503-289-4356
From: Pranav S <pranav026 <at> gmail.com>
To: Devchandra Leishangthem <deleisha <at> in.ibm.com>
Cc: pegasus-l <at> openpegasus.org
Sent: Friday, April 6, 2012 4:38 AM
Subject: Re: How to build OpenPegasus SDK as single threaded?

I some where read, on HPUX and AIX linking single threaded libraries to multi threaded causes undefined behaviour. Hence I was trying to to build openpegasus libs as single threaded. I see libpegcommon uses pthread library. I would like to know if there is way to turnoff the multithreading. In HPUX Makefiles I see "-mt" option being used to enable threads support.

I see Pegasus/Common has thread pool implementation, which is not always being used by the applications consuming OenPegasus SDK.
Let me know if I am wrong somewhere.

Thank You,
Pranav

On 6 April 2012 16:22, Devchandra Leishangthem <deleisha <at> in.ibm.com> wrote:
Is there any specifi reason why you wanted to build uni-threaded?
Warm Regards
D>L> Meetei
IBM India System and Technology Lab
EGL -D,Bangalore, India



From:   Pranav S <pranav026 <at> gmail.com>
To:     pegasus-l <at> openpegasus.org,
Date:   04/06/2012 04:06 PM
Subject:        How to build OpenPegasus SDK as single threaded?



Hello,

I am trying to explore OpenPegasus SDK and its applications. Currently the
SDK uses multi threading and links to pthreads library, hence it gets built
as a multithreaded. I would like to know is it possible to build the
library as single threaded? Do we have provision for that in the Makefiles.
I tried exploring but did not find anything which tells that it is possible
to build the library as single threaded one. Because linking a single
threaded library to a multithreaded library can lead to undefined
behaviour.

--
Thanks,
Pranav





--
Thanks,
Pranav






--
Thanks,
Pranav






--
Thanks,
Pranav




--
Thanks,
Pranav




--
Thanks,
Pranav




--
Thanks,
Pranav



Pranav S | 9 Apr 2012 06:48
Picon
Gravatar

Re: How to build OpenPegasus SDK as single threaded?

Thank You Kirk, you opened my eyes..!! and it was my bad, I should have traced down one of the API till its end point.
Now I realize there is no way we can build OpenPegasus SDK as an single threaded one.

Thank You all, for participating in the discussion.

On 8 April 2012 22:21, Kirk Augustin <kirk_augustin <at> yahoo.com> wrote:
I just tried to look at the Pegasus client sample code and did not quickly find it.
I probably deleted it and would have to reinstall.
But even if the Pegasus client library was multi threaded capable, you are not required to have multiple client threads, so it would not matter.
If you only have one client, and it is not trying to be asynchronous, then a multi threaded client library would behave as if single threaded.


 
Kirk Augustin
11821 NW McNamee Rd
Portland, OR 97231

HM: 503-289-4356
From: Pranav S <pranav026 <at> gmail.com>
To:
Cc: "kirk_augustin <at> yahoo.com" <kirk_augustin <at> yahoo.com>; "deleisha <at> in.ibm.com" <deleisha <at> in.ibm.com>; "pegasus-l <at> openpegasus.org" <pegasus-l <at> openpegasus.org>; "Hwang, Johnny" <Johnny.Hwang <at> netapp.com>
Sent: Sunday, April 8, 2012 3:24 AM

Subject: Re: How to build OpenPegasus SDK as single threaded?

Hey, anyone agree with me? need for Single Threaded Pegasus libraries?


On 8 April 2012 12:12, Pranav S <pranav026 <at> gmail.com> wrote:
:-)  It is nice to learn quotes from Confucius... It is nice when you get to learn few new things in discussion forums.>!!

On 8 April 2012 12:02, Hwang, Johnny <Johnny.Hwang <at> netapp.com> wrote:
There's a java version of sblim. Otherwise, if you insist on sticking with pegasus, I really doubt that there are other teams out there using pegasus as a single-threaded client. Think hatchet for killing a fly on a friend's forehead, as Confucius would say. 



Ugh stupid autocorrect


Pranav S <pranav026 <at> gmail.com> wrote:


AFAIK, sublim is linux implementation of CIM/WBEM standards for managing resources. I do not see the package having support for multiple platforms as Pegasus has. And Pegasus has much better implementation.


On 8 April 2012 11:35, Hwang, Johnny <Johnny.Hwang <at> netapp.com> wrote:
If you're building a client, take a look at sblim or something like that. Pegasus is probably too heavy for your needs.


Ugh stupid autocorrect


Pranav S <pranav026 <at> gmail.com> wrote:


Hi Kirk,

If single threaded library wants to use a multi threaded one, or assume an application binary is linking indirectly to multi threaded one, then the entire build chain has to be built with multi threading enabled. Now as I am more focused towards writing a client side binary, I am not using any of multi threaded piece of code from the Pegasus library. So why should I unnecessarily build multi threaded one? and my client binary will be performing basic operations like enumerations, listing association kind of stuff, and for these operations Pegasus do not create any threads.

I agree on what you are saying if I were to focus on a Provider, which will plug into server, serving to the multiple client requests.

I still think we need to have switch to enable/disable multi threading.

On 7 April 2012 23:40, Kirk Augustin <kirk_augustin <at> yahoo.com> wrote:
It is unsafe for a single thread to call a multi-thread, but perfectly safe for a multi-thread to call a single thread.
Multi-threading is the only safe way a service like Pegasus can call providers.
If not multi threaded, then one faulty provider can corrupt all providers, as well as Pegasus, with an infinite deadlock.
On HP UX you can mix multi thread and single thread. 
You just have to careful about singe thread library calling multi threaded libraries.
Multi-threaded libraries have to call single threaded libraries all the time.
A single thread library should always be passed data by value instead of reference, so should never need any synchronization protection.
That can not possibly be a problem on any system.

You are using the multi threading piece of code in Pegasus.
It can not be unused. 
Pegasus is a remote network, communications systems, server, relying on sockets and an unknown number of provider plug-ins.
It would be virtually inconceivable to imagine a good way that could be done without multi-threading.
You could greatly increase the number of independent processes instead, and created more sockets or pipes to try to share data, but multi-threading is a much better solution to a multi tasking server like this.
Your providers are best compiled as out of process, so have nothing to do with threading at all.
Threading is only important within Pegasus.
The question of threading really is not relevant because Pegasus is in control of what it calls, so will do so safely.
All you have to worry about is your providers.
 
Kirk Augustin
11821 NW McNamee Rd
Portland, OR 97231

HM: 503-289-4356
From: Pranav S <pranav026 <at> gmail.com>
To: Kirk Augustin <kirk_augustin <at> yahoo.com>
Cc: Devchandra Leishangthem <deleisha <at> in.ibm.com>; "pegasus-l <at> openpegasus.org" <pegasus-l <at> openpegasus.org>
Sent: Saturday, April 7, 2012 10:37 AM

Subject: Re: How to build OpenPegasus SDK as single threaded?

On HP UX we cannot mix single threaded libraries with, multi-threaded ones. It might cause undefined behaviour.
And, if an application links to multi-threaded library directly or indirectly, it has to be built with multi-threading (-mt option) enabled. As I am not using multi threaded piece of code from pegcommon(src/Common), I am expecting it to be disabled. Why unnecessarily create a dependency on pthread library? I believe it is good to have a flag in configure files
 for enabling/disabling the multi-threading.


On 6 April 2012 22:00, Kirk Augustin <kirk_augustin <at> yahoo.com> wrote:
But if you turned off multi threading in Pegasus, you would create and ensure the very condition you are concerned about avoiding.
You would cause a single threaded library to be linked with multi threaded ones.
The only safe solution is to make sure Pegasus is multi treaded, so that you avoid the possibility of a single threaded library being linked to a multi threaded one.
There is no risk in a multi threaded library linking to a single threaded one because a single threaded library gets multiple copies.
Only the other way around is risky.
There is only one copy of a multi threaded library, and you do not want single threaded libraries linking because then more than one could end up linking at the same time.
 
Kirk  Augustin
11821 NW McNamee Rd
Portland, OR 97231

HM: 503-289-4356
From: Pranav S <pranav026 <at> gmail.com>
To: Devchandra Leishangthem <deleisha <at> in.ibm.com>
Cc: pegasus-l <at> openpegasus.org
Sent: Friday, April 6, 2012 4:38 AM
Subject: Re: How to build OpenPegasus SDK as single threaded?

I some where read, on HPUX and AIX linking single threaded libraries to multi threaded causes undefined behaviour. Hence I was trying to to build openpegasus libs as single threaded. I see libpegcommon uses pthread library. I would like to know if there is way to turnoff the multithreading. In HPUX Makefiles I see "-mt" option being used to enable threads support.

I see Pegasus/Common has thread pool implementation, which is not always being used by the applications consuming OenPegasus SDK.
Let me know if I am wrong somewhere.

Thank You,
Pranav

On 6 April 2012 16:22, Devchandra Leishangthem <deleisha <at> in.ibm.com> wrote:
Is there any specifi reason why you wanted to build uni-threaded?
Warm Regards
D>L> Meetei
IBM India System and Technology Lab
EGL -D,Bangalore, India



From:   Pranav S <pranav026 <at> gmail.com>
To:     pegasus-l <at> openpegasus.org,
Date:   04/06/2012 04:06 PM
Subject:        How to build OpenPegasus SDK as single threaded?



Hello,

I am trying to explore OpenPegasus SDK and its applications. Currently the
SDK uses multi threading and links to pthreads library, hence it gets built
as a multithreaded. I would like to know is it possible to build the
library as single threaded? Do we have provision for that in the Makefiles.
I tried exploring but did not find anything which tells that it is possible
to build the library as single threaded one. Because linking a single
threaded library to a multithreaded library can lead to undefined
behaviour.

--
Thanks,
Pranav





--
Thanks,
Pranav






--
Thanks,
Pranav






--
Thanks,
Pranav




--
Thanks,
Pranav




--
Thanks,
Pranav




--
Thanks,
Pranav






--
Thanks,
Pranav


Gmane