cancel
Showing results for 
Search instead for 
Did you mean: 

Multithreading Architecture

Former Member
0 Kudos

Hi Everyone;

   For many years (OK decades since PB 5.0) I have designed and developed many multi-threaded PowerBuilder Classic appreciations (including within the PB Server [DPB]. The following diagram outlines my successful approach to date ...

Note: The "Sub-Thread Handler" and "Real Sub-Thread" object classes are NVUO's.

Now the questions that come to mind moving forward a technology level ....

Q1:  Can we implement this processing model the same in PB.Net?

Q2:  Even if Q1 is "yes" ... should we use the same approach in the .Net world?

Q3:  If we build this in Visual Studio with C#, would the same architecture be valid?

        (might still be using some PB.Net assemblies within the sub-threads as "helpers").

Many thanks in advance!

Regards ... Chris

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi All;

  FYI:  I have now tested this with PB.Net and looked at a real VS project using multi-threading via the .Net framework. It is certainly a lot easier to do in PB (either version) and I was surprised to see the horrible amount of memory leaks in the VS implementation. I did see some memory creep in PB.Net but PB Classic (via my framework) was memory flat after running 24/7 testing.

Regards ... Chris

former_member190719
Active Contributor
0 Kudos
 looked at a real VS project using multi-threading via the .Net framework. It is certainly a lot easier to do in PB (either version) and I was surprised to see the horrible amount of memory leaks in the VS implementation

You may be looking at a rather bad implementation.  People make similar complaints about PowerBuilder when they see code from somebody who doesn't use it well not perform well.  Speaks more to the way it was implemented rather than the tool itself.  An inexperienced person hitting themselves on on the thumb with a hammer doesn't make a hammer a bad tool.

Former Member
0 Kudos

Hi Bruce;

  Yes, this could be the case in the current VS implementation. My government client has just hired a VS consultant guru just before Christmas to try and iron out this dilemma. If I get some feedback on what he found and exactly what he did to alleviate this memory leak situation - I'll try & remember to post an update back here for our SCN readers.

BTW: Happy New Year!

Regards ... Chris

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Chris,

Yes. Yes. Yes.

I tested it recently and as far ad I can remember, I could not see any difference with PB Classic.

Regards.

Abdallah.


Former Member
0 Kudos

First my english in writing isn't perfect.

Q1)

In general this should be possible

Q2)

Depends on what you do with you threads and how many you need

Q3)

From a high level view yes. But there'are limits. (for example thread count)

Your picture looks like that you've implemented a threadpool.

In .NET there's a solution for this:

http://msdn.microsoft.com/de-de/library/system.threading.threadpool%28v=vs.110%29.aspx

You also could take a look a this class:

http://msdn.microsoft.com/de-de/library/system.threading.tasks.task%28v=vs.110%29.aspx

Maybe this better suit your needs.

It's also possible to use callbacks (delegate keyword) with the Thread class but you also could use events (event EventHandler<T>) for communication with your threads. Which isn't a big difference.

EDIT:

When you need a huge amount of threads or often create/destroy them you should use the Task oder ThreadPool class. Because you would waste less system ressources.