Bark of the byte

Running with bytes and other wild creatures

Part 0.2 Concurrent versus parallel mind games

A few mind games

Lets stretch things a bit to see if we can get the deeper concepts to sink in. 
How can you tell?

How do you know whether a system is running operations in parallel? Let’s take a computer as an example. Now, say on your computer the specs say that it has at least two cores. How do you know that the manufacturer didn't trick you and provide you with one chip that is able to switch very quickly? One way is to write a CPU intensive program with measurable output quantified by the amount of processing done on it. Your program might look something like:

        static void DoWork()
            double k = 1234567890;
            double j = 0;
            forUInt64 i = 0; i < 10000000000; i++ )
                j = k + i / k;

You can then measure the time that your system takes to run a single instance of this program compared to two instances that are run in parallel. You will want to be careful that you measure the time it takes to execute the method in isolation of the time it takes to start up each process. On my system this takes about 6.1 seconds independent of whether I run one process or two processes at the same time. That indicates that my system really does have multiple cores that are running in parallel. If it was a single very fast switching core then no matter how fast it ran, it would always take twice as long when running two processes at the same time because it would need to do twice the work.

Does the universe have a fast switching single processor or a parallel processor?

In our daily lives several events appear to occur simultaneously, waves crash while the wind blows, birds squawk while we go about our daily business. So, the universe seems to run many operations in parallel. But, how do we know that there isn’t just a very fast single processor behind it all? From the previous section, one way to tell would be to run two instances of a very compute intensive operation and measure whether it takes twice as long as when it is run by itself. The first problem is that we don’t know of any compute intensive processes that overload the universe’s processor (thankfully). The second problem is that even if we did we wouldn’t know about it because our clocks are ticked by the processor itself. So, our clocks would just be ticked slower (in universe time) and we would be none the wiser. The third problem is that I am applying a computing paradigm to the universe, which probably doesn’t even apply. What do you think?