<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tabard: Multiple GNU Prolog Engines in a Distributed Environment</title>
	<atom:link href="http://tabard.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tabard.wordpress.com</link>
	<description>Ramblings About it's Development</description>
	<pubDate>Tue, 19 Dec 2006 17:46:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tabard on Sourceforge!</title>
		<link>http://tabard.wordpress.com/2006/10/27/tabard-on-sourceforge/</link>
		<comments>http://tabard.wordpress.com/2006/10/27/tabard-on-sourceforge/#comments</comments>
		<pubDate>Fri, 27 Oct 2006 01:29:53 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Status]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/27/tabard-on-sourceforge/</guid>
		<description><![CDATA[I&#8217;ve created a project on sourceforge for Tabard, here&#8217;s the Tabard project page and there&#8217;s also a mailing list for development and another one with automated mail-outs of CVS commits. I would love to have more people testing the code and giving feedback and I hope this is a starting point for that.
   [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve created a project on sourceforge for Tabard, here&#8217;s the <a href="http://tabard.sf.net/">Tabard project page</a> and there&#8217;s also a mailing list for development and another one with automated mail-outs of CVS commits. I would love to have more people testing the code and giving feedback and I hope this is a starting point for that.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=32&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/27/tabard-on-sourceforge/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>Tests</title>
		<link>http://tabard.wordpress.com/2006/10/26/tests/</link>
		<comments>http://tabard.wordpress.com/2006/10/26/tests/#comments</comments>
		<pubDate>Thu, 26 Oct 2006 14:49:13 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/26/tests/</guid>
		<description><![CDATA[I&#8217;m running some tests right now for which I wrote a little Perl script that outputs to a CSV file that I later import into OpenCalc. I&#8217;m using time(1) with the TIMEFORMAT env var set to &#8220;%E&#8221; which means I only use the elapsed time in the measurements.
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m running some tests right now for which I wrote a little Perl script that outputs to a CSV file that I later import into OpenCalc. I&#8217;m using time(1) with the TIMEFORMAT env var set to &#8220;%E&#8221; which means I only use the elapsed time in the measurements.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=31&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/26/tests/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>poll: protocol failure in circuit setup</title>
		<link>http://tabard.wordpress.com/2006/10/26/poll-protocol-failure-in-circuit-setup/</link>
		<comments>http://tabard.wordpress.com/2006/10/26/poll-protocol-failure-in-circuit-setup/#comments</comments>
		<pubDate>Thu, 26 Oct 2006 14:16:15 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/26/poll-protocol-failure-in-circuit-setup/</guid>
		<description><![CDATA[If you get the error:

poll: protocol failure in circuit setup

then you may need to edit /etc/inetd.conf and add .1000 to the end of the &#8216;nowait&#8217; keyword.
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you get the error:<br />
<code><br />
poll: protocol failure in circuit setup<br />
</code><br />
then you may need to edit /etc/inetd.conf and add .1000 to the end of the &#8216;nowait&#8217; keyword.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=29&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/26/poll-protocol-failure-in-circuit-setup/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple</title>
		<link>http://tabard.wordpress.com/2006/10/10/simple/</link>
		<comments>http://tabard.wordpress.com/2006/10/10/simple/#comments</comments>
		<pubDate>Tue, 10 Oct 2006 16:47:15 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Examples]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/10/simple/</guid>
		<description><![CDATA[
:- include(&#8217;lib&#8217;).
trick(a(gnu), b(software)).
trick(_, c(is)).
% Master
init:-
	pm2_is_master,!,
	pl_thread_send_msg(vid(3,0,_,_), a(gnu)),
	pl_thread_send_msg(vid(2,0,_,_), b(software)),
	pl_thread_send_msg(vid(1,0,_,_), c(is)),
        read_results,
        finish_listeners. % never remove this unless you know what
                        [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><code><br />
:- include(&#8217;lib&#8217;).</p>
<p>trick(a(gnu), b(software)).<br />
trick(_, c(is)).</p>
<p>% Master<br />
init:-<br />
	pm2_is_master,!,<br />
	pl_thread_send_msg(vid(3,0,_,_), a(gnu)),<br />
	pl_thread_send_msg(vid(2,0,_,_), b(software)),<br />
	pl_thread_send_msg(vid(1,0,_,_), c(is)),<br />
        read_results,<br />
        finish_listeners. % never remove this unless you know what<br />
                          % you&#8217;re doing</p>
<p>% Workers<br />
init:-<br />
        mutex_lock,<br />
 	pl_thread_get_msg(Termo),<br />
        !, trick(Termo, X),<br />
	write(&#8217;Worker -&gt; &#8216;),write(Termo), write(&#8217;,'), write(X), nl,<br />
        pl_thread_send_msg(vid(0,0,_,_), X).</p>
<p>read_results:-<br />
        pl_thread_get_msg(Result1),<br />
        write(&#8217;Master -&gt; &#8216;),write(Result1),nl,<br />
        read_results.<br />
</code></p>
<p>And the output:<br />
<code><br />
$ pm2load tabard<br />
Worker -&gt; b(software),c(is)<br />
Master -&gt; c(is)<br />
Worker -&gt; a(gnu),b(software)<br />
Master -&gt; b(software)<br />
Master -&gt; c(is)<br />
Worker -&gt; c(is),c(is)<br />
</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=27&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/10/simple/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>Howto: Transform a string into a Prolog term</title>
		<link>http://tabard.wordpress.com/2006/10/10/howto-transform-a-string-into-a-prolog-term/</link>
		<comments>http://tabard.wordpress.com/2006/10/10/howto-transform-a-string-into-a-prolog-term/#comments</comments>
		<pubDate>Tue, 10 Oct 2006 15:56:49 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/10/howto-transform-a-string-into-a-prolog-term/</guid>
		<description><![CDATA[You can use read_term_from_codes/3 but remember to pass the option end_of_term(eof) if the term doesn&#8217;t end with a dot. This is because the default end-of-term delimiter is dot.
Example:
read_term_from_codes(&#8221;a(a)&#8221;, X, [end_of_term(eof)])
X = a(a)
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>You can use read_term_from_codes/3 but remember to pass the option end_of_term(eof) if the term doesn&#8217;t end with a dot. This is because the default end-of-term delimiter is <em>dot</em>.</p>
<p><strong>Example:</strong><br />
read_term_from_codes(&#8221;a(a)&#8221;, X, [end_of_term(eof)])</p>
<p>X = a(a)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=26&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/10/howto-transform-a-string-into-a-prolog-term/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>User-space threads vs Kernel-threads</title>
		<link>http://tabard.wordpress.com/2006/10/07/user-space-threads-vs-kernel-threads/</link>
		<comments>http://tabard.wordpress.com/2006/10/07/user-space-threads-vs-kernel-threads/#comments</comments>
		<pubDate>Sat, 07 Oct 2006 18:53:42 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Question]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/07/user-space-threads-vs-kernel-threads/</guid>
		<description><![CDATA[User-space threads (M x 1, based on POSIX draft 4 threads) are created, terminated, synchronized, scheduled, and so forth using interfaces provided by a threads library. Creation, termination, and synchronization operations can be performed extremely fast using user-space threads.
Because user-space threads are not directly visible to the kernel (which is aware only of the overriding [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>User-space threads</strong> (M x 1, based on POSIX draft 4 threads) are created, terminated, synchronized, scheduled, and so forth using interfaces provided by a threads library. Creation, termination, and synchronization operations can be performed extremely fast using user-space threads.</p>
<p>Because user-space threads are not directly visible to the kernel (which is aware only of the overriding process containing the user-space threads), user-space threads (M x 1) require no kernel support. </p>
<p>If one thread blocks, the entire process blocks. When this happens, the benefit of threads parallelism is lost. Wrappers around various system calls can reduce some of the blocking, but at a cost to performance.</p>
<p>With <strong>kernel threads</strong> (1 thread to one process, or 1 x 1), each user thread has a corresponding kernel thread. Thus, there is full kernel support for threads.</p>
<p>Each thread is independently schedulable by the kernel, so if one thread blocks, others can still run.</p>
<p>Creation, termination, and synchronization can be slower with kernel threads than user threads, since the kernel must be involved in all thread management. Overhead may be greater, but more concurrency is possible using kernel threads, even with a uniprocessor system. As a result, total application performance with kernel-space threads surpasses that of user-space threads.</p>
<p>Note, however, that developers must be more careful when creating large amounts of threads, as each thread adds more weight to the process and more overhead to the system.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=24&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/07/user-space-threads-vs-kernel-threads/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>From single-thread to multi-thread</title>
		<link>http://tabard.wordpress.com/2006/10/05/from-single-thread-to-multi-thread/</link>
		<comments>http://tabard.wordpress.com/2006/10/05/from-single-thread-to-multi-thread/#comments</comments>
		<pubDate>Thu, 05 Oct 2006 22:53:51 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/05/from-single-thread-to-multi-thread/</guid>
		<description><![CDATA[In terms of programming, when wanting to transform a single-threaded program into multi-threaded one has to get into a different mindset.
In terms of Prolog (Tabard and most Prolog systems that support multi-threading), that means replacing:

1) predicates into thread_send_message()&#8217;s
2) unbound variables into thread_get_message()&#8217;s

Example: Consider the Prolog goal in single-thread mode:

% pred(+A, +B, -C)
pred([1,2], [[2,2], [3,2]], X).

And [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In terms of programming, when wanting to transform a single-threaded program into multi-threaded one has to get into a different mindset.</p>
<p>In terms of Prolog (Tabard and most Prolog systems that support multi-threading), that means replacing:</p>
<ul>
<li>1) predicates into thread_send_message()&#8217;s</li>
<li>2) unbound variables into thread_get_message()&#8217;s</li>
</ul>
<p><strong>Example:</strong> Consider the Prolog goal in single-thread mode:<br />
<code><br />
% pred(+A, +B, -C)<br />
pred([1,2], [[2,2], [3,2]], X).<br />
</code></p>
<p>And now in multi-threading mode, on the master thread side:<br />
<code><br />
thread_send_message(worker_queue, pred([1,2], [[2,2], [3,2]])),<br />
thread_get_message(master_queue, X).<br />
</code></p>
<p>And in the worker thread side:<br />
<code><br />
thread_get_message(worker_queue, Y),<br />
(do processing)<br />
thread_send_message(master, Result).<br />
</code></p>
<p><strong>And now for a real example (tested on SWI-Prolog):</strong><br />
<code><br />
%<br />
%    multiple threads wait on a single queue and pick up the first<br />
%    goal to execute. This example provides no means to tell when all<br />
%    work is done. This must be realised using additional<br />
%    synchronisation.<br />
%</p>
<p>trick(a(gnu), b(software)). %answer is message is a(gnu)<br />
trick(_, c(is)). %answer if not</p>
<p>%    create_workers(+Id, +N)<br />
%<br />
%    Create a pool with given Id and number of workers<br />
%    A set of workers wait on a single queue<br />
%<br />
create_workers(WorkerQueue, MasterQueue, N):-<br />
  message_queue_create(WorkerQueue),<br />
  message_queue_create(MasterQueue),<br />
  forall(between(1, N, _),<br />
         thread_create(do_work(WorkerQueue, MasterQueue), _, [])).</p>
<p>%<br />
% Workers<br />
%<br />
do_work(WorkerQueue, MasterQueue):-<br />
  repeat,<br />
    thread_get_message(WorkerQueue, Goal),<br />
    % do processing<br />
    !, trick(Goal, X),<br />
    thread_send_message(MasterQueue, X),<br />
  fail.</p>
<p>% Master<br />
%<br />
%    work(+Id, +Goal)<br />
%<br />
%    Post work to be done by the pool</p>
<p>work(WorkerQueue, MasterQueue, Goal):-<br />
  thread_send_message(WorkerQueue, Goal),<br />
  thread_get_message(MasterQueue, Result),<br />
  write(Result).<br />
</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=22&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/05/from-single-thread-to-multi-thread/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>For testing</title>
		<link>http://tabard.wordpress.com/2006/10/04/for-testing/</link>
		<comments>http://tabard.wordpress.com/2006/10/04/for-testing/#comments</comments>
		<pubDate>Wed, 04 Oct 2006 12:06:34 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Status]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/04/for-testing/</guid>
		<description><![CDATA[game of life
matrix arithmetic
nreserve on 100-element list 2000 times for accuracy
swi-prolog benchmarks
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>game of life<br />
matrix arithmetic<br />
nreserve on 100-element list 2000 times for accuracy<br />
swi-prolog benchmarks</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=20&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/04/for-testing/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>Multi-threading slower than single-threading?</title>
		<link>http://tabard.wordpress.com/2006/10/04/multi-threading-slower-than-single-threading/</link>
		<comments>http://tabard.wordpress.com/2006/10/04/multi-threading-slower-than-single-threading/#comments</comments>
		<pubDate>Wed, 04 Oct 2006 12:04:01 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Question]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/10/04/multi-threading-slower-than-single-threading/</guid>
		<description><![CDATA[I found this old mail  on the swi-prolog mailing list archive about threads. It poses an interesting question: is multi-threading slower than single-thread?
Of course, since this mail is from 2002, it is utterly out of date when it comes to limitations of the current implementation and anyone referring to it to document shortcomings will [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I found <a href="http://gollem.science.uva.nl/SWI-Prolog/mailinglist/archive/old/2550.html">this old mail </a> on the swi-prolog mailing list archive about threads. It poses an interesting question: is multi-threading slower than single-thread?</p>
<p>Of course, since this mail is from 2002, it is utterly out of date when it comes to limitations of the current implementation and anyone referring to it to document shortcomings will be a moron. </p>
<p>Adrian Holzwarth said : <em>&#8220;I&#8217;d guess that a swi-prolog with multi-threading running on a single-cpu-machine cannot run faster than a single threaded version. If you want to split the work to be done you need a second (or more :)) cpu to bother. Worse, otherwise you are creating overhead with dividing the work into pieces and managing the mess. And the lonesome single CPU has to do *all* the computing anyway, successive.&#8221;</em></p>
<p>Sebastian Sardina replied: <em>&#8220;Indeed I do not expect the multi-threading version to run faster, but just equivalent if I do not use multi-threads at all. I understand that, but say you don&#8217;t do anything fancy: you just run a regluar Prolog program like the 9-queens example. So the problem is: why the multi-threading version of Prolog running a single thread is slower than the single-thread version of Prolog running the same single thread program?&#8221;</em></p>
<p>Jan Wielemaker also replied: <em>&#8220;Right now the difference is neglectable on single-CPU Windows machines. The only remaining problematic area is dynamic code on Linux SMP machines that can be upto about 50% slower.  Synchronization cannot be avoided here as the current implementation says dynamic code is fully shared between threads.&#8221;</em></p>
<p>He continues to say something that certainly has caught my attention: <em>&#8220;It is one of these most frustrating aspects of performance tuning: sometimes you *know* the program is smaller and has to perform fewer steps, so it *must* be faster but measuring turns out it is in fact slower.&#8221;</em></p>
<p><strong>Good for thesis</strong>: do you think it is useful, how does it fit with real examples, where do you think the API is not elegant/incomplete, what do you (eventually expect), are there relevant de-facto standards that should be considered, etc.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=21&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/10/04/multi-threading-slower-than-single-threading/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing: Examples of/for Performance Evaluation</title>
		<link>http://tabard.wordpress.com/2006/09/29/testing-examples-offor-performance-evaluation/</link>
		<comments>http://tabard.wordpress.com/2006/09/29/testing-examples-offor-performance-evaluation/#comments</comments>
		<pubDate>Fri, 29 Sep 2006 17:19:48 +0000</pubDate>
		<dc:creator>tabard</dc:creator>
		
		<category><![CDATA[Status]]></category>

		<guid isPermaLink="false">http://tabard.wordpress.com/2006/09/29/testing-examples-offor-performance-evaluation/</guid>
		<description><![CDATA[Update: I&#8217;m now considering using this other programs for testing too.
Inductive Logic Programming system Aleph (link)

a branch of machine learning that synthesises logic programs using other logic programs as input.
Used by Jan Wielemaker (SWI-Prolog) to show speedup with threads on SMP systems.

Benchmark suite by Fernando Pereira (link) 

Used by Jan Wielemaker (SWI-Prolog) for comparing the [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Update:</strong> I&#8217;m now considering using <a href="http://tabard.wordpress.com/2006/10/04/for-testing/">this other programs</a> for testing too.</p>
<p><b>Inductive Logic Programming system Aleph (<a href="http://web.comlab.ox.ac.uk/oucl/research/areas/machlearn/Aleph/aleph.html">link</a>)</b></p>
<ul>
<li>a branch of machine learning that synthesises logic programs using other logic programs as input.</li>
<li>Used by Jan Wielemaker (SWI-Prolog) to show speedup with threads on SMP systems.</li>
</ul>
<p><b>Benchmark suite by Fernando Pereira (<a href="http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/prolog/code/bench/pereira.txt">link</a>)</b> </p>
<ul>
<li>Used by Jan Wielemaker (SWI-Prolog) for comparing the single threaded to the multi-threaded version.</li>
<li>Its purpose is to try to identify strengths and weaknesses in the basic engine of a Prolog system.</li>
<li>&#8220;<em>Also, I must say that I have relatively little faith on small benchmark programs. I find that performance (both time and space) on substantial programs, reliability, adherence to de facto standards and ease of use are far more important in practice. I&#8217;ve tried several Prolog systems that performed very well on small benchmarks (including mine), but that failed badly on one or more of these criteria.</em>&#8220;</li>
</ul>
<p><b>Dining Philosophers (<a href="http://en.wikipedia.org/wiki/Dining_philosophers">link</a>)</b></p>
<ul>
<li>Classic multi-process synchronization problem,</li>
<li>It&#8217;s a toy program, </li>
<li>More to do with concurrency that distributed/parallel computing.</li>
</ul>
<p><b>Where it will be speedup for sure:</b></p>
<p>1) serialized program that now becames distributed.<br />
2) multi-threaded program that distributed executes faster.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/tabard.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/tabard.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tabard.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tabard.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tabard.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tabard.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tabard.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tabard.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tabard.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tabard.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tabard.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tabard.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tabard.wordpress.com&blog=390640&post=18&subd=tabard&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://tabard.wordpress.com/2006/09/29/testing-examples-offor-performance-evaluation/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/tabard-128.jpg" medium="image">
			<media:title type="html">tabard</media:title>
		</media:content>
	</item>
	</channel>
</rss>