<?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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Silly Science &#187; XCore/XMOS Virtual Threads</title>
	<atom:link href="http://www.silly-science.co.uk/category/projects/xcorexmos-virtual-threads/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.silly-science.co.uk</link>
	<description>Electronics, Programming and Hacking About</description>
	<lastBuildDate>Sat, 17 Jul 2010 14:14:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>XMOS XS-1 Virtual Threads</title>
		<link>http://www.silly-science.co.uk/2010/02/01/xmos-xs-1-virtual-threads/</link>
		<comments>http://www.silly-science.co.uk/2010/02/01/xmos-xs-1-virtual-threads/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:21:36 +0000</pubDate>
		<dc:creator>silly-scientist</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[XCore/XMOS Virtual Threads]]></category>
		<category><![CDATA[context switch]]></category>
		<category><![CDATA[interrupts]]></category>
		<category><![CDATA[xmos]]></category>
		<category><![CDATA[xs-1]]></category>

		<guid isPermaLink="false">http://www.silly-science.co.uk/?p=19</guid>
		<description><![CDATA[The XMOS XS-1 architecture is a multi-threaded architecture. As opposed to normal systems it has a single processor core that can run 8 hardware threads, in real-time with no operating system overhead. But what happens if you run out of threads&#8230; 2 answers: either (1) add more cores or (2) virtualize. So I thought I [...]]]></description>
			<content:encoded><![CDATA[<p>The XMOS XS-1 architecture is a multi-threaded architecture. As opposed to normal systems it has a single processor core that can run 8 hardware threads, in real-time with no operating system overhead. But what happens if you run out of threads&#8230; 2 answers: either (1) add more cores or (2) virtualize.</p>
<p>So I thought I would do option (2) as option (1) is too easy in the XMOS architecture and its not very efficient if I want to run 1MIPs processes on a thread that has 50MIPs available. The code for this is freely available from the <a title="XS-1 Virtual Threads sourceforge page" href="http://sourceforge.net/projects/vthreads/" target="_blank">virtual threads sourceforge page</a>.</p>
<p>More information after the break&#8230;</p>
<p><span id="more-19"></span></p>
<p>The base of the system is simple <a title="Wikipedia's explanation of context switching" href="http://en.wikipedia.org/wiki/Context_switching" target="_blank">context switching</a> within a single thread &#8211; this allows multiple processes to be run on a single thread. The current implementation has only time-slicing for processes and doesn&#8217;t currently have any way to handle events, ports or channels in a sensible way. Hopefully this soft of thing will be implemented when I spend some more time on the project.</p>
<p>The tricky things to handle are those which I haven&#8217;t implemented yet&#8230; The risk of deadlocking the whole lot of virtual threads is quite high when working with events or waiting for external stimulus. Essentially a carefully implemented library would have to be used to stop this, but still provide the level of functionality you get using the hardware threads.</p>
<p>Its probably fairly safe to assert that the virtual threads will not ever be able to be as functional as the hardware threads.</p>
<p>So, a summary of current features:</p>
<ul>
<li>Able to start an arbitrary number of virtual threads</li>
<li>Simple time sliced context switching of virtual threads</li>
<li>Ability to disable the interrupt for atomic operation</li>
</ul>
<p>Future features:</p>
<ul>
<li>Context switch on external stimulus</li>
<li>Context switch on demand (so a virtual thread can &#8220;release&#8221; itself from the current hardware thread)</li>
<li>Implementation of access to events, channel comms, hardware</li>
<li>Call to allocate stack space to vthread</li>
<li>More flexible vthread params (ports, chans, etc)</li>
</ul>
<ul></ul>
]]></content:encoded>
			<wfw:commentRss>http://www.silly-science.co.uk/2010/02/01/xmos-xs-1-virtual-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
