Multithreading

Re: Multithreading

Postby Enrico Maria Giordano » Tue May 28, 2013 10:20 am

Antonio,

Antonio Linares wrote:Enrico,

How many records you have on the DBF ?


About 75000 records.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Multithreading

Postby Antonio Linares » Tue May 28, 2013 10:56 am

Enrico,

I created a 80.000 records DBF (using dbcre8.exe) and tested it with Harbour:

ST: 0,299 secs

MT: 0,345 secs

You are right, MT apps are slower :-(

I am reporting it to the Harbour dev group:
https://groups.google.com/forum/?fromgr ... Ap9qFn9gSs
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Multithreading

Postby anserkk » Tue May 28, 2013 11:05 am

StefanHaupt wrote:Enrico,

just to understand, what could be the advantages using MT instead of ST ? What functions could be put in threads ?

Im my understanding a database application is a single thread application with single tasks, e.g. browsing a dbf or searching in a dbf. What can be done, to get simultaneous tasks ?

Stefan


It may be good to have your program to check in the background via a thread for an updated version of your exe on some servers, that too without delaying/pausing/interfering the work of your user on the application. If an updated version is available then it would show a popup message that a new version of the app is available, else nothing happens, the user continues with his work.

Without a thread, the same can be done when the user starts the app, the program will do a check on some server for an updated version and then inform the user about the updated version. But the problem here, is that, the user will have to wait until the checking process is completed. In other words the user's activity is paused for some time and he will have to wait.

There are many other possibilities of using multi threading in your application.

Regards
Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Multithreading

Postby Enrico Maria Giordano » Tue May 28, 2013 11:13 am

Antonio Linares wrote:Enrico,

I created a 80.000 records DBF (using dbcre8.exe) and tested it with Harbour:

ST: 0,299 secs

MT: 0,345 secs

You are right, MT apps are slower :-(

I am reporting it to the Harbour dev group:
https://groups.google.com/forum/?fromgr ... Ap9qFn9gSs


Thank you, Master!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Multithreading

Postby Antonio Linares » Tue May 28, 2013 1:07 pm

Enrico,

Mindaugas just answered. his explanation sounds logical, but nobody would want to slow down his app...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Multithreading

Postby hmpaquito » Tue May 28, 2013 2:33 pm

Hi all,

Well, I think that (x)harbour applications are super fast. So if the multithreading makes them lose a little speed to my unimportant. The multithreading can bring many good features to our applications.

My two (euro) cents.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Multithreading

Postby sambomb » Tue May 28, 2013 4:49 pm

Some good uses for MT exe:
Index multiple files simultaneously.
Open non modal dialogs in different threads.
Run long tasks with multiple theads, 1 just for the dialog management and as many as possible for the other tasks.

Obviously, MT exe only will be faster in functions that use multiple threads in multi nuclear processors.
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Re: Multithreading

Postby Enrico Maria Giordano » Tue May 28, 2013 5:23 pm

Antonio,

Antonio Linares wrote:Enrico,

Mindaugas just answered. his explanation sounds logical, but nobody would want to slow down his app...


Thank you. :-(

I give up with multithreading. xHarbour's background tasks are much more efficient, despite what Harbour developers can say...

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Multithreading

Postby Antonio Linares » Tue May 28, 2013 6:47 pm

Enrico,

Have you checked, when you use a background task, if the app speed decrease ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Multithreading

Postby Enrico Maria Giordano » Tue May 28, 2013 7:51 pm

Antonio,

Antonio Linares wrote:Enrico,

Have you checked, when you use a background task, if the app speed decrease ?


Yes. Of course, it depends on what the background task is doing. If it is activated but is doing nothing (ie. is executing an empty codeblock) then the app speed doesn't decrease.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Multithreading

Postby Patrizio » Wed May 29, 2013 3:45 pm

Enrico, Antonio: a test of that kind don't make sense in MT.

Try to make multiple scans of the same dbf file: one after the other in ST, parallel to each other in MT.
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy

Re: Multithreading

Postby Enrico Maria Giordano » Wed May 29, 2013 5:03 pm

Patrizio,

Patrizio wrote:Enrico, Antonio: a test of that kind don't make sense in MT.


The sense is that my application will slow down if I only link the MT libs in. Unacceptable for me.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Multithreading

Postby Patrizio » Thu May 30, 2013 8:13 am

Enrico, the error is considered an application MT as an application ST with an extra function.

MT applications are designed especially for parallel processes (we use .NET MT app for processing many ascii files at same time).
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy

Re: Multithreading

Postby Enrico Maria Giordano » Thu May 30, 2013 8:20 am

Patrizio,

Patrizio wrote:Enrico, the error is considered an application MT as an application ST with an extra function.

MT applications are designed especially for parallel processes (we use .NET MT app for processing many ascii files at same time).


That's why I prefer background tasks. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Multithreading

Postby Patrizio » Thu May 30, 2013 8:27 am

Enrico Maria Giordano wrote:Patrizio,

That's why I prefer background tasks. :-)

EMG


It depends on what you need to do, I use bgtasks to check if there is connectivity and check for sw updates.
Patrizio
 
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 106 guests