"David" <(E-Mail Removed)> wrote in message
news:1dfd01c52df2$8071e2d0$(E-Mail Removed)...
>
>>-----Original Message-----
>>David wrote:
>>
>>> Impossible. Each of the two threads if run alone would
> already consume 100%
>>> cpu, so it is not possible that "the first processor
> has enough juice to run
>>> both threads."
>>
>>A while loop that does an increment wouldn't use up a
> processor.
>>
>>It's not cumulative.
>>
>>It's using a little slice of CPU time/ /per/ /second/
> with each
>>increment of the register.
>
> What does the while loop have to do with the question?
> Each of my 2 threads perform a cpu-intensive task (e.g.,
> many mathematical calculations, etc) that take several
> minutes to complete.
>
> When running 2 threads in parallel, each of them should be
> assigned to another processor, which would result in
> almost 50% reduction in total time spent (as there are no
> synchronizatin points to delay the threads' calculations).
> But instead, both are scheduled on same processor, not
> taking benefit of the second processor.
>
> P.S. While I appreciate your reply, I have to mention that
> I am not new to parallelism (based on your replies, you
> have assume that). I have spent many years on parallel
> programming with C/C++, both on SMP machine and NUMA
> supercomputers. My question is *NOT* about parallelism,
> but about *.NET* handling of threads. Again, thanks in
> advance for any reply that would shed light on why .NET
> messes up the threads.
>
>
..NET doesn't messes up the threads, it doesn't even handle thread
scheduling, .NET is at the mercy of the OS scheduler for this just like any
other kind of application running on windows.
It's hard to tell what's going on without seeing any code, also we need more
info on the context of the application, things like the type of application
(console, windows...), number of threads and their priorities, the math
classes you are using (pure framework or other native) are a minimum to
start with.
All I can say for now, based on your problem description (the load is spread
over the available CPU's when executing a simple loop in parallel, but it's
serialized when calling into a math library ) is that the math library is
holding a lock effectively preventing the other thread to run in parallel.
Willy.
|