Urban Hafner : Tag scheduling, everything about scheduling http://bettong.net/tag/scheduling.rss en-us 40 CTM: Exercise 4-6 <h3>The problem</h3> <p><em>Thread scheduling.</em> Section 4.8.3.2 shows how to skip over already-calculated elements of a stream. If we use this technique to sum the elements of the integer stream in section 4.3.1, the result is much smaller than 11249925000, which is the sum of the integers in the stream. Why is it so much smaller? Explain this result in terms of thread scheduling.</p> <h3>My solution</h3> <p>What probably happens is that generating another element in the production thread is so fast that more than one ca be generated in one time slice. When the consumer thread restarts in the next slice it only takes the last element computed, so it loses some (or many) elements.</p> Sun, 06 Nov 2005 16:39:50 +0000 urn:uuid:bdb6299a-55ff-4033-bca6-749d958562a0 urban@bettong.net (Urban Hafner) http://bettong.net/2005/11/06/ctm-exercise-4-6#comments CTM exercise book mozart oz thread scheduling http://bettong.net/2005/11/06/ctm-exercise-4-6