Re: anyone can help? weird Linux concurrency problem in math calculation



wsTechie wrote:
Hi,


I ran into a really weird concurrency problem in Linux box. In a nutshell, I have a standalone console program that does intensive math calculation. The program has just one thread. I run one instance of the program, it takes 19.5 seconds to finish. I run two concurrent instances on a two-cpu Linux server, I'd expect that they'd take about the same time, but to my surprise, they took 31 seconds to finish. So running two concurrent instances slows down each one even two cpu's are fully loaded.

More information is listed in the following after a lot of
investigations.

1. top confirms that two cpu's are all busy when two concurrent
processes. cpu usage is about 99%-100%
2. other existing jobs take negligible cpu times, below 2%
3. no shortage of memory, so no memory swaping
4. top confirms that there is little system or io activities during the
time of program.
5. the same program has no such concurrency problem on NT, nor on
Solaris


Has anyone seen this before? Is there something I can investigate further?
Well firstly make sure it IS 2 cpus, and not hyperthreading :-)

Anyways, There's alot of bus sharing on SMP systems, so if you're
heavily accessing memory (and not just within the caches) there might
actually be contention.
It also depends quite a bit on what kernel version you run, some older
kernels juggled the processes back and forth between the CPUs, which
means one might not benefit from the caches as much as one could.

.



Relevant Pages

  • Re: DWORD Alignment
    ... But AFAIK internally a 32 bit CPU gets ... > since my memory has like my money-bag some obvious leaks I wouldn't swear ... There might also be caches that store just 32 bits in 32 ... it could be translated into a machine instruction ...
    (microsoft.public.vb.winapi)
  • Re: [PATCH] Document Linuxs memory barriers [try #4]
    ... +WHAT IS CONSIDERED MEMORY? ... and the division between CPU and memory needs to be marked out. ... Why do you need to include caches and queues in your model? ...
    (Linux-Kernel)
  • Next July 27: boot failure(hang) on x86_64 box.
    ... Freeing unused kernel memory: 1360k freed ... ACPI: PM-Timer IO Port: 0x488 ... CPU: L2 Cache: 1024K ... # AX.25 network device drivers ...
    (Linux-Kernel)
  • [PATCH] Document Linuxs memory barriers [try #3]
    ... The attached patch documents the Linux kernel's memory barriers. ... I've tried to get rid of the concept of memory accesses appearing on the bus; ... barring implicit enforcement by the CPU. ...
    (Linux-Kernel)
  • Oops in 2.6.28-rc9 and -rc8 -- mtrr issues / e1000e
    ... Bios 1.04beta did show correct memory sizing in dmidecode, ... I hope this is as simple as me doing something glaringly wrong in the kernel ... DMI present. ... CPU: L2 cache: 6144K ...
    (Linux-Kernel)