Multithreaded Programs

View: New views
13 Messages — Rating Filter:   Alert me  

Multithreaded Programs

by Hartmut Eilers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hallo List,

is it possible to write multithreaded programs that support
multicore or SMP systems with Gambas?

Thanks for help
Hartmut

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Jussi Lahtinen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can write two separated gambas applications that communicate to each other.
That way you can have two threads.

If you want speed up your program, I suggest that you first measure
where is the actual bottleneck.
Then look better algorithm for that task.
If not possible, consider to write C/C++ library for that task.

Jussi



On Wed, Nov 4, 2009 at 18:18, Hartmut Eilers <hartmut@...> wrote:

> Hallo List,
>
> is it possible to write multithreaded programs that support
> multicore or SMP systems with Gambas?
>
> Thanks for help
> Hartmut
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by nando-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I wonder if Benoit has contemplated multi-threading for Gambas?
Such as..

SUB PLURAL DoSomething (X, Y, Z)
  'each time this is called, a new instance is running

END

-Fernando


---------- Original Message -----------
From: Jussi Lahtinen <jussi.lahtinen@...>
To: mailing list for gambas users <gambas-user@...>
Sent: Wed, 4 Nov 2009 19:21:22 +0200
Subject: Re: [Gambas-user] Multithreaded Programs

> You can write two separated gambas applications that communicate to each other.
> That way you can have two threads.
>
> If you want speed up your program, I suggest that you first measure
> where is the actual bottleneck.
> Then look better algorithm for that task.
> If not possible, consider to write C/C++ library for that task.
>
> Jussi
>
> On Wed, Nov 4, 2009 at 18:18, Hartmut Eilers <hartmut@...> wrote:
> > Hallo List,
> >
> > is it possible to write multithreaded programs that support
> > multicore or SMP systems with Gambas?
> >
> > Thanks for help
> > Hartmut
> >
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> > trial. Simplify your report design, integration and deployment - and focus on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user@...
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Bugzilla from gambas@users.sourceforge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I wonder if Benoit has contemplated multi-threading for Gambas?
> Such as..
>
> SUB PLURAL DoSomething (X, Y, Z)
>   'each time this is called, a new instance is running
>
> END
>
> -Fernando
>

The Gambas interpreter is not multi-threaded, and will never be unless it is
rewritten.

And I will do that only if I find multi-threading useful for writing GUI
applications, which is not the case until now.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Jussi Lahtinen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I pretty much agree.
Gambas as well as other RAD languages are very good for GUI
programming, and generally for not CPU intensive purposes.
If you really need speed, use libraries written with C/C++ or similar.
BUT it would be very nice if Gambas could handle most things so
quickly that you don't need to use C/C++.

Maybe Gambas could launch multiple interpreters to enable multi-threading..?
But I think you have already considered and discarded that idea...

Maybe interpreter itself should use multi-threading?
Although I don't know is there yet any good way to do that, meaning
without installing TBB or similar to enable
easy using like parallel_for, parallel_loop etc.

Jussi




2009/11/5 Benoît Minisini <gambas@...>:

>> I wonder if Benoit has contemplated multi-threading for Gambas?
>> Such as..
>>
>> SUB PLURAL DoSomething (X, Y, Z)
>>   'each time this is called, a new instance is running
>>
>> END
>>
>> -Fernando
>>
>
> The Gambas interpreter is not multi-threaded, and will never be unless it is
> rewritten.
>
> And I will do that only if I find multi-threading useful for writing GUI
> applications, which is not the case until now.
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Bugzilla from gambas@users.sourceforge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I pretty much agree.
> Gambas as well as other RAD languages are very good for GUI
> programming, and generally for not CPU intensive purposes.
> If you really need speed, use libraries written with C/C++ or similar.
> BUT it would be very nice if Gambas could handle most things so
> quickly that you don't need to use C/C++.
>
> Maybe Gambas could launch multiple interpreters to enable
>  multi-threading..? But I think you have already considered and discarded
>  that idea...
>
> Maybe interpreter itself should use multi-threading?
> Although I don't know is there yet any good way to do that, meaning
> without installing TBB or similar to enable
> easy using like parallel_for, parallel_loop etc.
>
> Jussi
>

I don't like doing that, but hey, here is an authoritative argument. :-)

"A computer is a state machine. Threads are for people who can't program state
machines." - Alan Cox.

If you want a detailed discussion about that, read the Linux Kernel Mailing-
List.

http://lkml.indiana.edu/hypermail/linux/kernel/0106.2/index.html#400

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Jussi Lahtinen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmmm... interesting. Thanks for the link!

Jussi


2009/11/5 Benoît Minisini <gambas@...>:

>> I pretty much agree.
>> Gambas as well as other RAD languages are very good for GUI
>> programming, and generally for not CPU intensive purposes.
>> If you really need speed, use libraries written with C/C++ or similar.
>> BUT it would be very nice if Gambas could handle most things so
>> quickly that you don't need to use C/C++.
>>
>> Maybe Gambas could launch multiple interpreters to enable
>>  multi-threading..? But I think you have already considered and discarded
>>  that idea...
>>
>> Maybe interpreter itself should use multi-threading?
>> Although I don't know is there yet any good way to do that, meaning
>> without installing TBB or similar to enable
>> easy using like parallel_for, parallel_loop etc.
>>
>> Jussi
>>
>
> I don't like doing that, but hey, here is an authoritative argument. :-)
>
> "A computer is a state machine. Threads are for people who can't program state
> machines." - Alan Cox.
>
> If you want a detailed discussion about that, read the Linux Kernel Mailing-
> List.
>
> http://lkml.indiana.edu/hypermail/linux/kernel/0106.2/index.html#400
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Doriano Blengino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benoît Minisini ha scritto:

>> I pretty much agree.
>> Gambas as well as other RAD languages are very good for GUI
>> programming, and generally for not CPU intensive purposes.
>> If you really need speed, use libraries written with C/C++ or similar.
>> BUT it would be very nice if Gambas could handle most things so
>> quickly that you don't need to use C/C++.
>>
>> Maybe Gambas could launch multiple interpreters to enable
>>  multi-threading..? But I think you have already considered and discarded
>>  that idea...
>>
>> Maybe interpreter itself should use multi-threading?
>> Although I don't know is there yet any good way to do that, meaning
>> without installing TBB or similar to enable
>> easy using like parallel_for, parallel_loop etc.
>>
>> Jussi
>>
>>    
>
> I don't like doing that, but hey, here is an authoritative argument. :-)
>
> "A computer is a state machine. Threads are for people who can't program state
> machines." - Alan Cox.
>  
"A computer is made of flip-flops (the very basic unit of memory). High
level languages are for people who don't understand computers - those
who understand them are perfectly happy with punched paper tapes and
machine-level languages" - Doriano Blengino.

Without multi-threading and multi-tasking there would not be computers
as we know them. Full stop. This is not to say that gambas should have
multi-threading, nor that Alan Cox is stupid. But that affirmation is.
More on this, if requested.

Regards,

--
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Werner-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Doriano Blengino wrote:

> Benoît Minisini ha scritto:
>  
>>> I pretty much agree.
>>> Gambas as well as other RAD languages are very good for GUI
>>> programming, and generally for not CPU intensive purposes.
>>> If you really need speed, use libraries written with C/C++ or similar.
>>> BUT it would be very nice if Gambas could handle most things so
>>> quickly that you don't need to use C/C++.
>>>
>>> Maybe Gambas could launch multiple interpreters to enable
>>>  multi-threading..? But I think you have already considered and discarded
>>>  that idea...
>>>
>>> Maybe interpreter itself should use multi-threading?
>>> Although I don't know is there yet any good way to do that, meaning
>>> without installing TBB or similar to enable
>>> easy using like parallel_for, parallel_loop etc.
>>>
>>> Jussi
>>>
>>>    
>>>      
>> I don't like doing that, but hey, here is an authoritative argument. :-)
>>
>> "A computer is a state machine. Threads are for people who can't program state
>> machines." - Alan Cox.
>>  
>>    
> "A computer is made of flip-flops (the very basic unit of memory). High
> level languages are for people who don't understand computers - those
> who understand them are perfectly happy with punched paper tapes and
> machine-level languages" - Doriano Blengino.
>
> Without multi-threading and multi-tasking there would not be computers
> as we know them. Full stop. This is not to say that gambas should have
> multi-threading, nor that Alan Cox is stupid. But that affirmation is.
> More on this, if requested.
>
> Regards,
>
>  
Surely Alan Cox had meant that to be understood with a nudge and a wink. :-)
Multi - threading opens a whole can of worms. Gambas 2 is rock solid and
if there has to be a choice between robustness and performance I take
the former any time.

Having said that, I do have difficulties getting a ticker message to run
across the bottom of a 42 inch plasma screen without noticeable jitter
while the rest of the screen is doing Image.Fade (on a dual core CPU).
Maybe the answer to my woes is to take a long hard look at openGL.

Regards,
Werner

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Doriano Blengino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Werner ha scritto:

> Doriano Blengino wrote:
>  
>> Benoît Minisini ha scritto:
>>  
>>    
>>>> I pretty much agree.
>>>> Gambas as well as other RAD languages are very good for GUI
>>>> programming, and generally for not CPU intensive purposes.
>>>> If you really need speed, use libraries written with C/C++ or similar.
>>>> BUT it would be very nice if Gambas could handle most things so
>>>> quickly that you don't need to use C/C++.
>>>>
>>>> Maybe Gambas could launch multiple interpreters to enable
>>>>  multi-threading..? But I think you have already considered and discarded
>>>>  that idea...
>>>>
>>>> Maybe interpreter itself should use multi-threading?
>>>> Although I don't know is there yet any good way to do that, meaning
>>>> without installing TBB or similar to enable
>>>> easy using like parallel_for, parallel_loop etc.
>>>>
>>>> Jussi
>>>>
>>>>    
>>>>      
>>>>        
>>> I don't like doing that, but hey, here is an authoritative argument. :-)
>>>
>>> "A computer is a state machine. Threads are for people who can't program state
>>> machines." - Alan Cox.
>>>  
>>>    
>>>      
>> "A computer is made of flip-flops (the very basic unit of memory). High
>> level languages are for people who don't understand computers - those
>> who understand them are perfectly happy with punched paper tapes and
>> machine-level languages" - Doriano Blengino.
>>
>> Without multi-threading and multi-tasking there would not be computers
>> as we know them. Full stop. This is not to say that gambas should have
>> multi-threading, nor that Alan Cox is stupid. But that affirmation is.
>> More on this, if requested.
>>
>> Regards,
>>
>>  
>>    
> Surely Alan Cox had meant that to be understood with a nudge and a wink. :-)
> Multi - threading opens a whole can of worms. Gambas 2 is rock solid and
> if there has to be a choice between robustness and performance I take
> the former any time.
>  
Yes, agreed to all. Nudge and wink should be applied to my sentence too,
which was ironic.
True that multi-threading brings more problems - compilers do, oop does,
java does; every advancing step in every field brings new problems, but
also opens new possibilities. The task is to retain the new
possibilities, and get rid of problems. Once you have new possibilities,
you can choose whether to use them or not.
And I agree even on gambas: if, by introducing multithreading, stability
would suffer, then it is better to avoid threading. But this is not the
question. Benoit said that he does not find a reason to use threads in
GUI applications; the same about background processing. I don't see what
have these GUI applications so special or so different from other ones.
They are applications which, instead of sending results to files, send
results to the screen. This is all. If I wanted to write a web server
like Apache, but with a nice GUI and using Gambas, I would feel the lack
of threading. Threads can simplify a lot certain kinds of problems - and
can mess up other kinds of problems.

Regards,
Doriano

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Bugzilla from gambas@users.sourceforge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Werner ha scritto:
> > Doriano Blengino wrote:
> >> Benoît Minisini ha scritto:
> >>>> I pretty much agree.
> >>>> Gambas as well as other RAD languages are very good for GUI
> >>>> programming, and generally for not CPU intensive purposes.
> >>>> If you really need speed, use libraries written with C/C++ or similar.
> >>>> BUT it would be very nice if Gambas could handle most things so
> >>>> quickly that you don't need to use C/C++.
> >>>>
> >>>> Maybe Gambas could launch multiple interpreters to enable
> >>>>  multi-threading..? But I think you have already considered and
> >>>> discarded that idea...
> >>>>
> >>>> Maybe interpreter itself should use multi-threading?
> >>>> Although I don't know is there yet any good way to do that, meaning
> >>>> without installing TBB or similar to enable
> >>>> easy using like parallel_for, parallel_loop etc.
> >>>>
> >>>> Jussi
> >>>
> >>> I don't like doing that, but hey, here is an authoritative argument.
> >>> :-)
> >>>
> >>> "A computer is a state machine. Threads are for people who can't
> >>> program state machines." - Alan Cox.
> >>
> >> "A computer is made of flip-flops (the very basic unit of memory). High
> >> level languages are for people who don't understand computers - those
> >> who understand them are perfectly happy with punched paper tapes and
> >> machine-level languages" - Doriano Blengino.
> >>
> >> Without multi-threading and multi-tasking there would not be computers
> >> as we know them. Full stop. This is not to say that gambas should have
> >> multi-threading, nor that Alan Cox is stupid. But that affirmation is.
> >> More on this, if requested.
> >>
> >> Regards,
> >
> > Surely Alan Cox had meant that to be understood with a nudge and a wink.
> > :-) Multi - threading opens a whole can of worms. Gambas 2 is rock solid
> > and if there has to be a choice between robustness and performance I take
> > the former any time.
>
> Yes, agreed to all. Nudge and wink should be applied to my sentence too,
> which was ironic.
> True that multi-threading brings more problems - compilers do, oop does,
> java does; every advancing step in every field brings new problems, but
> also opens new possibilities. The task is to retain the new
> possibilities, and get rid of problems. Once you have new possibilities,
> you can choose whether to use them or not.
> And I agree even on gambas: if, by introducing multithreading, stability
> would suffer, then it is better to avoid threading. But this is not the
> question. Benoit said that he does not find a reason to use threads in
> GUI applications; the same about background processing. I don't see what
> have these GUI applications so special or so different from other ones.
> They are applications which, instead of sending results to files, send
> results to the screen. This is all. If I wanted to write a web server
> like Apache, but with a nice GUI and using Gambas, I would feel the lack
> of threading. Threads can simplify a lot certain kinds of problems - and
> can mess up other kinds of problems.
>
> Regards,
> Doriano
>

OK, but you should not take the example of web servers : the fastest web
servers I know do not use threading nor processes, but event-driven
programming around select() (or equivalent). As the gambas interpreter does.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Multithreaded Programs

by Doriano Blengino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benoît Minisini ha scritto:

>> Werner ha scritto:
>>    
>>> Doriano Blengino wrote:
>>>      
>>>> Benoît Minisini ha scritto:
>>>>        
>>>>>> I pretty much agree.
>>>>>> Gambas as well as other RAD languages are very good for GUI
>>>>>> programming, and generally for not CPU intensive purposes.
>>>>>> If you really need speed, use libraries written with C/C++ or similar.
>>>>>> BUT it would be very nice if Gambas could handle most things so
>>>>>> quickly that you don't need to use C/C++.
>>>>>>
>>>>>> Maybe Gambas could launch multiple interpreters to enable
>>>>>>  multi-threading..? But I think you have already considered and
>>>>>> discarded that idea...
>>>>>>
>>>>>> Maybe interpreter itself should use multi-threading?
>>>>>> Although I don't know is there yet any good way to do that, meaning
>>>>>> without installing TBB or similar to enable
>>>>>> easy using like parallel_for, parallel_loop etc.
>>>>>>
>>>>>> Jussi
>>>>>>            
>>>>> I don't like doing that, but hey, here is an authoritative argument.
>>>>> :-)
>>>>>
>>>>> "A computer is a state machine. Threads are for people who can't
>>>>> program state machines." - Alan Cox.
>>>>>          
>>>> "A computer is made of flip-flops (the very basic unit of memory). High
>>>> level languages are for people who don't understand computers - those
>>>> who understand them are perfectly happy with punched paper tapes and
>>>> machine-level languages" - Doriano Blengino.
>>>>
>>>> Without multi-threading and multi-tasking there would not be computers
>>>> as we know them. Full stop. This is not to say that gambas should have
>>>> multi-threading, nor that Alan Cox is stupid. But that affirmation is.
>>>> More on this, if requested.
>>>>
>>>> Regards,
>>>>        
>>> Surely Alan Cox had meant that to be understood with a nudge and a wink.
>>> :-) Multi - threading opens a whole can of worms. Gambas 2 is rock solid
>>> and if there has to be a choice between robustness and performance I take
>>> the former any time.
>>>      
>> Yes, agreed to all. Nudge and wink should be applied to my sentence too,
>> which was ironic.
>> True that multi-threading brings more problems - compilers do, oop does,
>> java does; every advancing step in every field brings new problems, but
>> also opens new possibilities. The task is to retain the new
>> possibilities, and get rid of problems. Once you have new possibilities,
>> you can choose whether to use them or not.
>> And I agree even on gambas: if, by introducing multithreading, stability
>> would suffer, then it is better to avoid threading. But this is not the
>> question. Benoit said that he does not find a reason to use threads in
>> GUI applications; the same about background processing. I don't see what
>> have these GUI applications so special or so different from other ones.
>> They are applications which, instead of sending results to files, send
>> results to the screen. This is all. If I wanted to write a web server
>> like Apache, but with a nice GUI and using Gambas, I would feel the lack
>> of threading. Threads can simplify a lot certain kinds of problems - and
>> can mess up other kinds of problems.
>>
>> Regards,
>> Doriano
>>    
>
> OK, but you should not take the example of web servers : the fastest web
> servers I know do not use threading nor processes, but event-driven
> programming around select() (or equivalent). As the gambas interpreter does.
>  
I don't know what web server you are speaking about, but that is not
important - I take it for true because I know you never lie. But you are
speaking about speed, which is not the only important thing. In fact,
every user of gambas should know that the same program, written in C++
instead of gambas, could run from 20% to 1000% faster. But, by using C++
instead of gambas, you also loose a lot of other things. The same
applies in the comparison event-driven vs threaded model. In a typical
GUI program there are tenths of different events, but the user fires
them one at a time; so it makes sense to use an event driven approach.
But try to implement a serial (or network) protocol using events instead
of threads. For the same event ("a packet has arrived") you have to do
at least three or four different things, depending on what data arrived,
and when. And if you try to set up more than one connection, things get
more complicated. A threaded model makes this things trivial. But this
is just an example, and I say so because of the programs I normally
write - communications, industrial control and automation, things like
that, often are more easily described in terms of thread and background
processes.

Regards,
Doriano


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Parent Message unknown Re: Multithreaded Programs

by Pino Zollo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
>"A computer is made of flip-flops (the very basic unit of memory). High
>level languages are for people who don't understand computers - those
>who understand them are perfectly happy with punched paper tapes and
>machine-level languages" - Doriano Blengino.


Object programming mimics the world....

....and the world in multi-thread.


Ciao

Pino

--
Key ID: 0xF6768208
Key fingerprint = B16D 0A7C 5B29 A334 CE6A  71F6 EAF8 3D88 F676 8208
Key server: hkp://wwwkeys.eu.pgp.net

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user