cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Multithreading Architecture

Former Member
0 Likes
449

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

View Entire Topic
Former Member
0 Likes

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.