From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1a44c40a66c293f3 X-Google-Thread: 1089ad,7e78f469a06e6516 X-Google-Attributes: gid103376,gid1089ad,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!bigfeed3.bellsouth.net!news.bellsouth.net!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!news.highwinds-media.com!newspeer1-win.ntli.net!newsfe6-gui.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: Embedded languages based on early Ada (from "Re: Preferred OS, processor family for running embedded Ada?") User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada,comp.lang.vhdl References: <113ls6wugt43q$.cwaeexcj166j$.dlg@40tude.net> <1i3drcyut9aaw.isde6utlv6iq.dlg@40tude.net> <1j0a3kevqhqal.riuhe88py2tq$.dlg@40tude.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Sat, 03 Mar 2007 14:07:37 GMT NNTP-Posting-Host: 82.21.99.109 X-Trace: newsfe6-gui.ntli.net 1172930857 82.21.99.109 (Sat, 03 Mar 2007 14:07:37 GMT) NNTP-Posting-Date: Sat, 03 Mar 2007 14:07:37 GMT Organization: NTL Xref: g2news2.google.com comp.lang.ada:9655 comp.lang.vhdl:7619 Date: 2007-03-03T14:07:37+00:00 List-Id: On Sat, 03 Mar 2007 12:12:10 +0000, Simon Farnsworth wrote: > Jonathan Bromley wrote: > >> On Sat, 3 Mar 2007 12:00:08 +0100, "Dmitry A. Kazakov" >> wrote: >> >>>> The compiler should be able to generate code which generates a >>>> reasonable number of threads, depending on the hardware being used. >>> >>>Yes >> >> For heaven's sake... You have a statically-determinable number of >> processors. It's your (or your compiler's) choice whether each of >> those processors runs a single thread, or somehow runs multiple >> threads. If each processor is entitled to run multiple threads, then >> there's no reason why the number and structure of cooperating >> threads should not be dynamically variable. If you choose to run >> one thread on each processor, your thread structure is similarly >> static. Hardware people have been obliged to think about this >> kind of thing for decades. Software people seem to have a >> pretty good grip on it too, if the textbooks and papers I've read >> are anything to go by. Why is it suddenly such a big deal? >> > Not disagreeing with most of what you're saying, but I do feel the need to > point out the existence of systems with hotpluggable CPUs. Sun and IBM have > both sold systems for some years where CPUs can be added and removed at > runtime; software is expected to just cope with this. > > Also in the software domain; there is a cost to switching between different > threads. Thus, in software, the aim is to limit the number of runnable > threads to the number of active CPUs. If there are more threads runnable > than CPUs available, some CPU time is wasted switching between threads, > which is normally undesirable behaviour. This is part of the problem. Parallelism has to be be *inhibited* by explicit serialisation, to limit the number of threads created. So a construct like (in Ada): for I in Truth'Range loop Z := Z xor Truth (I); end loop; deliberately forces an execution serial order, even although we know that order does not matter at all, in this case. There is no effective consruct to permit but not require concurrency. The software compiler can't sensibly parallelise this because: The semantics of xor may be unknown (overloaded), and unsuitable The execution time of each iteration is much smaller than thread start/stop time Too many parallel threads would be created So we're left with source code which implies a non-existent serialisation constraint. If the "for I in all..." construct were in the language, we'd be able to say "I don't care about the order", and permitting concurrency, even if the result weren't identical (eg when using floating point) Numerous algorithms in simulation are "embarrassingly parallel", but this fact is completely and deliberately obscured from compilers. Compilers can't normally generated fine-scale threaded code because the applications don't specify it, the languages don't support it, and the processors don't need it. But the technical opportunity is real. It won't happen until the deadlock between compilers, software and processors is broken. -- Adrian