Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.tele2net.at!feeder.erje.net!eu.feeder.erje.net!newsfeed.pionier.net.pl!news.dialog.net.pl!not-for-mail From: Arivald Newsgroups: comp.lang.java.programmer Subject: Re: why running multiple instances of the same program is faster than running single instance? Date: Tue, 03 Jun 2014 13:25:25 +0200 Organization: Dialog Net Lines: 25 Message-ID: References: <177vduhhe7dh8.b2ohbodaj06u$.dlg@40tude.net> NNTP-Posting-Host: 62.87.249.67 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.dialog.net.pl 1401794724 25612 62.87.249.67 (3 Jun 2014 11:25:24 GMT) X-Complaints-To: abuse@dialog.net.pl NNTP-Posting-Date: Tue, 3 Jun 2014 11:25:24 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <177vduhhe7dh8.b2ohbodaj06u$.dlg@40tude.net> Xref: csiph.com comp.lang.java.programmer:28644 W dniu 2014-06-02 23:59, Joerg Meier pisze: > On Mon, 2 Jun 2014 08:12:31 -0700 (PDT), www wrote: > >> We have a software(some code from ours and some from the 3rd party) doing scientific calculation. It runs for several hours for finishing two years calculation. We use linux and it has four CPUs. Our code is not con-current multi-threaded yet. > >> We are puzzled that when we run multiple instances on the same linux computer, the run finishes earlier than running singe instance. When we run multiple instances, each instance is independently doing its own two year calculation. For example, one instance is calculating 1980-1981, another instance is calculating 1982-1983, etc. If running single instance for 1980-1981 takes 120 minutes to finish, when running together with other instances, it only needs 100 minutes to finish 1980-1981. > >> Any suggestions why this is happening? Thank you very much. > > Without code or any more detail we can only speculate. My guess: you have a > bug or ill written piece in your code that slows down your progress and > additional instances somehow affect the bug. > There could be a bug related to the intermediate data, if You save them on disk or other shared storage. If both processes use same filenames, it may be that one process generated some data, then other one saw them already generated, then skipped to next task. But in this case both processes may used incorrect data for further processing, data belonging to the other process. -- Arivald