
Am Mittwoch, 21. Dezember 2005 19:02 schrieben Sie:
[...]
You (or, rather the processor) don't execute instructions to write "Hello" in same way as, say, adding 2 and 2.
Exactly!
Rather, you add writing this string to a "to do" list and wait for a driver to respond to an interrupt, pick up the request(s), and carry it (them) out when control passes back the kernel.
I don't completely understand what you mean but I think it goes into the right direction. We can illustrate the process of executing a Haskell program as follows. We have a "evaluation machine" and a "execution machine". The former evaluates expressions, the latter executes I/O actions. When the program is started, the execution machine wants to execute the actions from the "main to do list". In order to be able to do so, it asks the evaluation machine to start evaluating main. For each entry on the to do list, main is evaluated as far as it's necessary to provide the execution machine with the entry. Of course, evaluating main may result in evaluating other expressions. The point is that the evaluation machine does never execute any I/O actions while the execution machine is unable to do any evaluation but needs to be feeded by the evaluation machine. Best wishes, Wolfgang