<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Why does Software Suck? Part I</title>
	<atom:link href="http://davidinman.net/2010/01/03/why-does-software-suck-part-i/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidinman.net/2010/01/03/why-does-software-suck-part-i/</link>
	<description></description>
	<lastBuildDate>Mon, 09 Aug 2010 04:36:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David</title>
		<link>http://davidinman.net/2010/01/03/why-does-software-suck-part-i/comment-page-1/#comment-4223</link>
		<dc:creator>David</dc:creator>
		<pubDate>Mon, 18 Jan 2010 02:52:45 +0000</pubDate>
		<guid isPermaLink="false">http://davidinman.net/?p=377#comment-4223</guid>
		<description>Jarred,

I know that modern processors support memory caching and am fairly familiar with it, but the problem with it (from my point of view) is that caching is opaque to the programmer. It&#039;s something that the processor decides to do on the fly based on locality and recently accessed memory. Which is fine, but there are many, many cases where it would be reasonable for the programmer to be able to say &quot;I want block X to be nearer the processor than block Y&quot; - but there is no way of explicitly saying this. Ultimately, what I&#039;d like to see is something like the following: an array of processors laid out in a grid surrounded by local memory (excluding on-processor cache), and a block of global memory out somewhere. One processor could access any memory anywhere, but the further out it goes, the slower access is. Feasible? I don&#039;t know. But I&#039;m trying to imagine what computers would look like if they were actually designed to multitask, rather than hacks around a uniprocessing machine to make it multiprocess.

Memory consistency is a difficult problem but not insoluble. But I think a general rule of thumb (for what I&#039;m thinking of) is that if you need to access the same piece of memory frequently, you should not be a different process. If you&#039;re modifying system-wide data, do so through the operating system processor via messaging (or something like the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pi_calculus&quot; rel=&quot;nofollow&quot;&gt;Pi calculus&lt;/a&gt;). In any case, at the very least you could serialize data going to the operating system for system-wide operations, which while introducing potential race conditions would at least keep memory consistent, and this operating system could message individual processors to update their cache in the event of a change. You get around shared data by having specific processors designated to hand shared tasks (an operating system and helpers, if you will).

Again, this is me bloviating on how I might multiprocess if I were to re-build the computer with multiprocessing in mind.</description>
		<content:encoded><![CDATA[<p>Jarred,</p>
<p>I know that modern processors support memory caching and am fairly familiar with it, but the problem with it (from my point of view) is that caching is opaque to the programmer. It&#8217;s something that the processor decides to do on the fly based on locality and recently accessed memory. Which is fine, but there are many, many cases where it would be reasonable for the programmer to be able to say &#8220;I want block X to be nearer the processor than block Y&#8221; &#8211; but there is no way of explicitly saying this. Ultimately, what I&#8217;d like to see is something like the following: an array of processors laid out in a grid surrounded by local memory (excluding on-processor cache), and a block of global memory out somewhere. One processor could access any memory anywhere, but the further out it goes, the slower access is. Feasible? I don&#8217;t know. But I&#8217;m trying to imagine what computers would look like if they were actually designed to multitask, rather than hacks around a uniprocessing machine to make it multiprocess.</p>
<p>Memory consistency is a difficult problem but not insoluble. But I think a general rule of thumb (for what I&#8217;m thinking of) is that if you need to access the same piece of memory frequently, you should not be a different process. If you&#8217;re modifying system-wide data, do so through the operating system processor via messaging (or something like the <a href="http://en.wikipedia.org/wiki/Pi_calculus" rel="nofollow">Pi calculus</a>). In any case, at the very least you could serialize data going to the operating system for system-wide operations, which while introducing potential race conditions would at least keep memory consistent, and this operating system could message individual processors to update their cache in the event of a change. You get around shared data by having specific processors designated to hand shared tasks (an operating system and helpers, if you will).</p>
<p>Again, this is me bloviating on how I might multiprocess if I were to re-build the computer with multiprocessing in mind.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jarred</title>
		<link>http://davidinman.net/2010/01/03/why-does-software-suck-part-i/comment-page-1/#comment-4173</link>
		<dc:creator>Jarred</dc:creator>
		<pubDate>Mon, 11 Jan 2010 01:56:11 +0000</pubDate>
		<guid isPermaLink="false">http://davidinman.net/?p=377#comment-4173</guid>
		<description>The problem with memory caching -- which most modern processors do support, by the way -- is that is that it introduces it&#039;s own problems in a multi-processor system, namely in the form of processors either not seeing or masking changes made to the same system-wide memory.

As an example, suppose that processor A runs task foo that accesses and modifies data at system-wide memory location 0x80001436.  Because all processors in the system have a 64-byte cache line, it loads all system-wide memory from addresses 0x80001400 through 0x80143e.  Before it gets a chance to actually make the modification, Processor A stops executing task foo.

Shortly thereafter, Processor B schedules task foo, loads the memory, performs the memory modification, and writes the cache line back to system-wide memory before moving on to another task.

Later, Processor A starts running task foo again, which now needs to use the data stored at system-wide location 0x80143e.  Processor A sees that it still has that memory cached, so it uses its local cache.  Unfortunately, that was cached prior to Processor B executed parts of task foo, so Processor A doesn&#039;t see the &lt;i&gt;modified&lt;/i&gt; contents of system-wide location 0x80143e.  So Processor A executes task foo based on out-of-date data.

That&#039;s just one problem.  Other potential problems introduced by memory caching include the following:

1. Processor B modifies data in its cache but does not write it back to system-wide memory before Processor A accesses the same data.  Again, Processor A executes a task based on obsolete data.

2.  Both Processor A and Processor B load the same cache line.  After both loads, both processors modify a different part of the cache line, then write the whole thing back out to system-wide memory.  Unless some mechanism exists to prevent it, the modifications written out by the first processor will be lost when the second processor writes its version of the same cache-line to system-wide memory.

Some of those problems are actually handled by the microcode designed into many modern processors.  Some of them have to be carefully handled by software.  (Fortunately, much of that work usually falls to the operating system rather than individual applications.

I&#039;d also point out that the vast majority of methods used to communicate between processors involve memory.  There are other possibilities for inter-processor communications (such as using direct signals), but those tend to come with problems of their owns, especially as they become complex enough to communicate any useful data.

Even shared peripherals -- such as both processors displaying data to the same monitor or accessing the same hard drive -- come with their own issues.</description>
		<content:encoded><![CDATA[<p>The problem with memory caching &#8212; which most modern processors do support, by the way &#8212; is that is that it introduces it&#8217;s own problems in a multi-processor system, namely in the form of processors either not seeing or masking changes made to the same system-wide memory.</p>
<p>As an example, suppose that processor A runs task foo that accesses and modifies data at system-wide memory location 0&#215;80001436.  Because all processors in the system have a 64-byte cache line, it loads all system-wide memory from addresses 0&#215;80001400 through 0&#215;80143e.  Before it gets a chance to actually make the modification, Processor A stops executing task foo.</p>
<p>Shortly thereafter, Processor B schedules task foo, loads the memory, performs the memory modification, and writes the cache line back to system-wide memory before moving on to another task.</p>
<p>Later, Processor A starts running task foo again, which now needs to use the data stored at system-wide location 0&#215;80143e.  Processor A sees that it still has that memory cached, so it uses its local cache.  Unfortunately, that was cached prior to Processor B executed parts of task foo, so Processor A doesn&#8217;t see the <i>modified</i> contents of system-wide location 0&#215;80143e.  So Processor A executes task foo based on out-of-date data.</p>
<p>That&#8217;s just one problem.  Other potential problems introduced by memory caching include the following:</p>
<p>1. Processor B modifies data in its cache but does not write it back to system-wide memory before Processor A accesses the same data.  Again, Processor A executes a task based on obsolete data.</p>
<p>2.  Both Processor A and Processor B load the same cache line.  After both loads, both processors modify a different part of the cache line, then write the whole thing back out to system-wide memory.  Unless some mechanism exists to prevent it, the modifications written out by the first processor will be lost when the second processor writes its version of the same cache-line to system-wide memory.</p>
<p>Some of those problems are actually handled by the microcode designed into many modern processors.  Some of them have to be carefully handled by software.  (Fortunately, much of that work usually falls to the operating system rather than individual applications.</p>
<p>I&#8217;d also point out that the vast majority of methods used to communicate between processors involve memory.  There are other possibilities for inter-processor communications (such as using direct signals), but those tend to come with problems of their owns, especially as they become complex enough to communicate any useful data.</p>
<p>Even shared peripherals &#8212; such as both processors displaying data to the same monitor or accessing the same hard drive &#8212; come with their own issues.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://davidinman.net/2010/01/03/why-does-software-suck-part-i/comment-page-1/#comment-4170</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sun, 10 Jan 2010 20:40:58 +0000</pubDate>
		<guid isPermaLink="false">http://davidinman.net/?p=377#comment-4170</guid>
		<description>Jarred, you&#039;re right that sharing memory has to remain the case &quot;to some degree&quot; - but I think we are many degrees away from where it should be. If we had more hierarchical memory models - think caching but with RAM - then it&#039;d be possible for each processor to have local memory before it went out to system-wide memory. I think this would allow us much more easily to execute multiple processors on one machine. But even if you did make a clean break from one processor&#039;s memory to another, as long as they can communicate to each other, then there is no reason they should not be on the same machine. After all, what we are demanding computers to do presently is to run multiple processes. We may need to rethink our boundaries of what a &quot;machine&quot; is.</description>
		<content:encoded><![CDATA[<p>Jarred, you&#8217;re right that sharing memory has to remain the case &#8220;to some degree&#8221; &#8211; but I think we are many degrees away from where it should be. If we had more hierarchical memory models &#8211; think caching but with RAM &#8211; then it&#8217;d be possible for each processor to have local memory before it went out to system-wide memory. I think this would allow us much more easily to execute multiple processors on one machine. But even if you did make a clean break from one processor&#8217;s memory to another, as long as they can communicate to each other, then there is no reason they should not be on the same machine. After all, what we are demanding computers to do presently is to run multiple processes. We may need to rethink our boundaries of what a &#8220;machine&#8221; is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph</title>
		<link>http://davidinman.net/2010/01/03/why-does-software-suck-part-i/comment-page-1/#comment-4128</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Tue, 05 Jan 2010 00:30:57 +0000</pubDate>
		<guid isPermaLink="false">http://davidinman.net/?p=377#comment-4128</guid>
		<description>Very nice post.  I look forward to the rest of the series.</description>
		<content:encoded><![CDATA[<p>Very nice post.  I look forward to the rest of the series.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jarred</title>
		<link>http://davidinman.net/2010/01/03/why-does-software-suck-part-i/comment-page-1/#comment-4127</link>
		<dc:creator>Jarred</dc:creator>
		<pubDate>Mon, 04 Jan 2010 19:24:19 +0000</pubDate>
		<guid isPermaLink="false">http://davidinman.net/?p=377#comment-4127</guid>
		<description>&lt;i&gt;To some extent, you can run multiple programs better with multiple processors. But the way these have been designed, they are still accessing the same memory,&lt;/i&gt;

Well, yes, but that has to remain the case to some degree.  After all, if multiple processors didn&#039;t share the same memory, then any time a process got loaded on a different processor, then the new processor&#039;s memory would have to be reloaded with that processor&#039;s application space.  And even then, this implies that there&#039;s a common storage space shared by all processors.  Otherwise, there&#039;d be no way to move a process to a different processor.  At that point, you might as well just be running your processes each on a separate machine.</description>
		<content:encoded><![CDATA[<p><i>To some extent, you can run multiple programs better with multiple processors. But the way these have been designed, they are still accessing the same memory,</i></p>
<p>Well, yes, but that has to remain the case to some degree.  After all, if multiple processors didn&#8217;t share the same memory, then any time a process got loaded on a different processor, then the new processor&#8217;s memory would have to be reloaded with that processor&#8217;s application space.  And even then, this implies that there&#8217;s a common storage space shared by all processors.  Otherwise, there&#8217;d be no way to move a process to a different processor.  At that point, you might as well just be running your processes each on a separate machine.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
