On Fri, 29 May 2009, Pritpal Bedi wrote:

Hi,

> Is it possible in Harbour that if the code below is executed on a multi cpu
> machine, 
> we could see the multiple PIDs in the task manager. I mean is is possible to
> execute threads on 
> multiple CPUs ?

In Harbour all threads are executed on each available CPUs.
It's default behavior of most OS-es and Harbour does not make
anything to disable it and reduce scalability. I have no idea
how it's presented in windows task manager.
If you have multi CPU hardware then you can use test/speedtst.prg
linked in MT mode and executed with --thread=2 --scale parameters
to check the scalability factor. The test shows that Harbour is quite
well scaled. Much better then xbase++ which seems to keep factor close
to 1.0 what means that only 1 CPU is effectively used.


The second thing is code use sent which cannot be compiled and executed
by Harbour due to missing some functionality in XBASE++ THREAD class
emulation, missing SLEEP() function and unsupported method declaration
in class definition by: METHOD <mthName1> [, <mthNameN> ]
SLEEP() can be replaced by:
   #xtranslate sleep( <n> ) => hb_idleSleep( <n> / 100 )
(please verify in xbase++ doc the SLEEP() precision and if it's
millisecond use 1000 instead of 100).
I'll add support to METHOD <mthName1> [, <mthNameN> ] declaration to
hbclass.ch. Maybe it will make using xbase++ code in Harbour easier.
The modifications in THREAD class are little bit more complicated.
It's necessary to change default NEW() method or simply remove it
and add at least some basic support for restarting the thread if
::interval is set.
This modification should be done in rtl/tthreadx.prg. I'll make them
in next commit but I would like to ask xbase++ users to make any other
deeper modifications in this class when they are necessary. I have never
used xbase++ and it's hard for me to replicate it's exact behavior.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to