<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.eiffelroom.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>eiffelroom - Article - Comments</title>
 <link>http://www.eiffelroom.com</link>
 <description>Comments for &quot;Article&quot;</description>
 <language>en</language>
<item>
 <title>More than 1 process per processor</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-506</link>
 <description>&lt;p&gt;You will normally want more than one process per processor (the exception being 100% CPU bound algorithms) in order to drive the processor complex at close to 100%.&lt;/p&gt;

&lt;p&gt;A first approximation to the required multi-programming level is:&lt;/p&gt;

&lt;p&gt;MPL = number_of_processors / processor_busy_proportion_for_one_process&lt;/p&gt;

&lt;p&gt;This is assuming your program has the whole machine to itself.&lt;/p&gt;

&lt;p&gt;Colin Adams&lt;/p&gt;

</description>
 <pubDate>Thu, 09 Oct 2008 00:08:53 -0700</pubDate>
 <dc:creator>colin-adams</dc:creator>
 <guid isPermaLink="false">comment 506 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>well yes you can&#039;t (easily)</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-505</link>
 <description>&lt;p&gt;well yes you can&#039;t (easily) exploit multicore programming in the purely sequential subset of any programming language, but that&#039;s beyond the point.&lt;/p&gt;

&lt;p&gt;fork() is not inefficient if you use it appropriately. if you&#039;re very much in a hurry, you can fork one process per core at startup time, and message pass it things to do, and that reduces the alleged cost to effectively zero.&lt;/p&gt;

&lt;p&gt;quick googling shows some guy measuring fork cost at 1 to 2 milliseconds per fork, and while thread startup is faster, you just need to partition your task so that each process handles say 100 or more milliseconds worth of work to have the cost of forking neutralised. there&#039;s not that many multithreaded apps that really do hundreds of thread creations each second...&lt;/p&gt;

&lt;p&gt;and you can also implement a non-multithreaded programming model on top of a multithreading implementation where only the concurrency library uses threads explicitly. so there&#039;s no excuse for making threads visible at the application code level.&lt;/p&gt;

</description>
 <pubDate>Wed, 08 Oct 2008 11:19:31 -0700</pubDate>
 <dc:creator>nenieorg</dc:creator>
 <guid isPermaLink="false">comment 505 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>I would not use</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-504</link>
 <description>&lt;p&gt;I would not use fork/spawn/system as a way to perform multicore programming it is largely inefficient. Multithreading programming in that respect is much better.&lt;/p&gt;

&lt;p&gt;What I meant by assigning some computation is that if you know that you have multiple cores and have an algorithm that could be parallelized, how to do that in C without using fork/spawn/system or threads for that matter.&lt;/p&gt;

</description>
 <pubDate>Wed, 08 Oct 2008 08:31:39 -0700</pubDate>
 <dc:creator>manus_eiffel</dc:creator>
 <guid isPermaLink="false">comment 504 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>fork()</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-503</link>
 <description>&lt;p&gt;in C to launch multiple processes, you can use any of fork(), spawn(), system().&lt;/p&gt;

&lt;p&gt;for communication, the output is free with fork (the child can read the parent). if you need a reply back you could use files or pipes, e.g. stdin/stdout) something akin say in the unix &amp;quot;inet&amp;quot; daemon, where each connection is a process whose stdin/stdout are mapped back to network connections via the inet daemon.&lt;/p&gt;

&lt;p&gt;standard C has had support for multicore programming long before there was a standard thread library (and you could say posix threads are not part of &amp;quot;pure C&amp;quot; depending on how you define it).&lt;/p&gt;

&lt;p&gt;arguably still some step away from the holy grail :-)&lt;/p&gt;

</description>
 <pubDate>Wed, 08 Oct 2008 06:18:23 -0700</pubDate>
 <dc:creator>nenieorg</dc:creator>
 <guid isPermaLink="false">comment 503 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>I would certainly agree with</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-499</link>
 <description>&lt;p&gt;I would certainly agree with you on not using threads, but how to you assign work to do on various cores without using threads and in pure C?&lt;/p&gt;

&lt;p&gt;As for a better alternative, I think this is the holy grail of concurrency, so everyone is in the race to reach that goal.&lt;/p&gt;

</description>
 <pubDate>Tue, 30 Sep 2008 15:40:01 -0700</pubDate>
 <dc:creator>manus_eiffel</dc:creator>
 <guid isPermaLink="false">comment 499 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>multiple cores do not imply multithreading</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-498</link>
 <description>&lt;p&gt;The availability of multiples cores doesn&#039;t imply the use of threads. Any concurrency facility will do to make use of the multiple cores, and while some such facilities might use threads as a lower level implementation mechanism (in the same way as a garbage collector employs manual memory management internally) there is no need to expose threads at the user-code level. And even at the lower levels, threads are not the only implementation strategy, you could have one OS-level process per available CPU each dispatching events and communicating using one of the available interprocess communication mechanisms.&lt;/p&gt;

&lt;p&gt;Personally I vote for the thread library be removed from Eiffel Studio and replaced by something less mediocre which fits better with the Eiffel philosophy.&lt;/p&gt;

</description>
 <pubDate>Tue, 30 Sep 2008 11:12:16 -0700</pubDate>
 <dc:creator>nenieorg</dc:creator>
 <guid isPermaLink="false">comment 498 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>I fully agree with you again, but ...</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-484</link>
 <description>&lt;p&gt;I fully agree with you again, but (the famous &amp;quot;but&amp;quot;) multi-threading is inheritly non-modular. Thus, we cannot easily constrain and reason about the composition of multi-threaded programs. So, I see currently only two ways of safely working with multi-threading:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt; Control the creation and distribution of threads from the main application.&lt;/li&gt;
    &lt;li&gt; Completely encapsulate the threads within the component, making the interface single threaded.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The process library, as it is, will leak out threads and that is very difficult to keep under control.&lt;/p&gt;

&lt;p&gt;SCOOP is a promising approach to overcome the composibility problems of multi-threading, but as long as SCOOP is not fully understood or implemented, we have to continue living with threads.&lt;/p&gt;

</description>
 <pubDate>Tue, 23 Sep 2008 15:52:39 -0700</pubDate>
 <dc:creator>schoelle</dc:creator>
 <guid isPermaLink="false">comment 484 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>When you can keep it simple</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-483</link>
 <description>&lt;p&gt;When you can keep it simple and that you do not need much CPU processing I agree that an event loop is all what you need. But as more cores are available to you, using threads is definitely the right way to go.&lt;/p&gt;

</description>
 <pubDate>Tue, 23 Sep 2008 11:56:41 -0700</pubDate>
 <dc:creator>manus_eiffel</dc:creator>
 <guid isPermaLink="false">comment 483 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>You are right that the</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-482</link>
 <description>&lt;p&gt;You are right that the application should never sit and wait for the data. But there are ways to solve this without multi-threading. The fundamental flaw is that we still develop our programs in a sequential, batch driven style when they should be developed using publish/subscribe everywhere.&lt;/p&gt;

&lt;p&gt;The right way to write modern, interactive applications is to use a main loop that sits on a POSIX select and reads input from many sources (GUI events, open files, network connections) and processes this inputs as they come in, never blocking for a specific input. Then, a subprocess would just be another one of these input sources. That is what I tried to sketch in &lt;a href=&quot;http://www.eiffelroom.com/blog/schoelle/what_do_applications_do_after_make&quot;&gt;http://www.eiffelroom.com/blog/schoelle/what_do_applications_do_after_make&lt;/a&gt;&lt;/p&gt;

</description>
 <pubDate>Tue, 23 Sep 2008 10:49:25 -0700</pubDate>
 <dc:creator>schoelle</dc:creator>
 <guid isPermaLink="false">comment 482 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>The original author of the</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-481</link>
 <description>&lt;p&gt;The original author of the library should certainly comment on that, but I was under the impression that if you have a deadlock due to an incorrect protocol of reading/writing then a multithreaded solution is a safest and simpler solution to ensure that you can still do something while waiting for inputs/outputs without having to change the logic of your program much.&lt;/p&gt;

</description>
 <pubDate>Mon, 22 Sep 2008 20:59:30 -0700</pubDate>
 <dc:creator>manus_eiffel</dc:creator>
 <guid isPermaLink="false">comment 481 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>Multi-threading vs. pub/sub</title>
 <link>http://www.eiffelroom.com/article/how_to_get_the_output_of_a_command_using_eiffelprocess#comment-480</link>
 <description>&lt;p&gt;Thanks for the nice tutorial. Still, I think using multi-threading for the process library is a bad, bad choice and the library design is flawed.&lt;/p&gt;

&lt;p&gt;Multi-threading and publish/subscribe just do not fit together, but the process library just does that. Also, it should be possible to interact with a subprocess, even with classical, sequential code. What do you think?&lt;/p&gt;

</description>
 <pubDate>Mon, 22 Sep 2008 13:08:53 -0700</pubDate>
 <dc:creator>schoelle</dc:creator>
 <guid isPermaLink="false">comment 480 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>Note that RTMS is a macro</title>
 <link>http://www.eiffelroom.com/article/c_c_calls_and_callbacks#comment-463</link>
 <description>&lt;p&gt;Note that RTMS is a macro and evaluate twice its argument, so for efficiency it should be:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;geshifilter eiffel&quot; style=&quot;font-family: monospace;&quot;&gt;cpp_get_text: &lt;a href=&quot;http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+STRING&amp;btnI=I%27m+Feeling+Lucky&quot;&gt;&lt;span style=&quot;color: #800000&quot;&gt;STRING&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;is&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #008000; font-style: italic;&quot;&gt;-- Get some dummy text&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;external&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0080A0;&quot;&gt;&amp;quot;C++ inline use &amp;lt;string&amp;gt;&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;alias&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0080A0;&quot;&gt;&amp;quot;[&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;std::string a = &amp;quot;&lt;/span&gt;dummy&lt;span style=&quot;color: #0080A0;&quot;&gt;&amp;quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;char *c_str = (char*) a.c_str();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return RTMS(c_str);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;

</description>
 <pubDate>Thu, 19 Jun 2008 22:43:37 -0700</pubDate>
 <dc:creator>manus_eiffel</dc:creator>
 <guid isPermaLink="false">comment 463 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>After having a problem with</title>
 <link>http://www.eiffelroom.com/article/c_c_calls_and_callbacks#comment-462</link>
 <description>&lt;p&gt;After having a problem with creating a STRING from a std::string (c++): Here&#039;s the solution&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;geshifilter eiffel&quot; style=&quot;font-family: monospace;&quot;&gt;cpp_get_text: &lt;a href=&quot;http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fdocs.eiffel.com%2Feiffelstudio%2Flibraries+STRING&amp;btnI=I%27m+Feeling+Lucky&quot;&gt;&lt;span style=&quot;color: #800000&quot;&gt;STRING&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;is&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #008000; font-style: italic;&quot;&gt;-- Get some dummy text&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;external&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0080A0;&quot;&gt;&amp;quot;C++ inline use &amp;lt;string&amp;gt;&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;alias&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0080A0;&quot;&gt;&amp;quot;[&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;std::string a = &amp;quot;&lt;/span&gt;dummy&lt;span style=&quot;color: #0080A0;&quot;&gt;&amp;quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return RTMS(((char*)a.c_str()));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF; font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;

</description>
 <pubDate>Wed, 18 Jun 2008 13:27:07 -0700</pubDate>
 <dc:creator>patrickr</dc:creator>
 <guid isPermaLink="false">comment 462 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>It won&#039;t be collected until</title>
 <link>http://www.eiffelroom.com/article/protecting_objects#comment-461</link>
 <description>&lt;p&gt;It won&#039;t be collected until eif_wean() is called.&lt;/p&gt;

</description>
 <pubDate>Wed, 11 Jun 2008 20:19:54 -0700</pubDate>
 <dc:creator>ted_eiffel</dc:creator>
 <guid isPermaLink="false">comment 461 at http://www.eiffelroom.com</guid>
</item>
<item>
 <title>When you eif_protect()</title>
 <link>http://www.eiffelroom.com/article/protecting_objects#comment-460</link>
 <description>&lt;p&gt;When you eif_protect() something in C, is this considered a reachable reference to the GC? i.e. if the Eiffel side of code loses reachability to an object that was passed to C and eif_protect&#039;ed, will it ever be collected?&lt;/p&gt;

</description>
 <pubDate>Wed, 11 Jun 2008 13:52:26 -0700</pubDate>
 <dc:creator>clemahieu</dc:creator>
 <guid isPermaLink="false">comment 460 at http://www.eiffelroom.com</guid>
</item>
</channel>
</rss>
