<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16421"></HEAD>
<BODY>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>The program
below has strange behaviour:</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>I run it
from DrScheme on a dual core machine with two processors.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>No other
applications active.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>When I run
it the first time it uses 100% of both processors.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>Running it
again without leaving DrScheme, it apparently uses one processor at a time only,
although switching frequently. CPU usage histories mirror each other. <SPAN
class=878121115-16052011>How come only one processor is used at a time during
the second run?</SPAN></SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>Leaving
DrScheme, restarting DrScheme and running again gives me 100% of both
processors again.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>In all runs
processor-count returns 2.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>Thanks,
Jos</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN
class=878121115-16052011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>DrRacket,
version 5.1.1.5--2011-05-09(b74c9f9/a) [3m].</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>Windows
7.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>Intel
Pentium dual core CPU E6500.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN
class=878121115-16052011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>#lang
racket</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>; check that
both processors are used by means of</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN
class=878121115-16052011>; windows tool for measurement of CPU
usage.<BR>(require racket/unsafe/ops)<BR>(require racket/fixnum)<BR>(require
racket/future)<BR>(collect-garbage)<BR>(processor-count) ; -> 2<BR>(define
N/2 #e1e8)<BR>(define N (* 2 N/2))<BR>(define V (make-fxvector N))<BR>(define
(set-V! f r) (unsafe-fxvector-set! V f r))</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>(define
(task1)<BR> (for ((i (in-range 50)))<BR> (for ((k (in-range 0 N/2)))
(set-V! k k))))</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>(define
(task2)<BR> (for ((i (in-range 50)))<BR> (for ((k (in-range N/2 N)))
(set-V! k k))))</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN
class=878121115-16052011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>; task1
fills the first half of vector V.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>; task2 the
second half.</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>; In both
tasks the ((i (in-range 50))) is inserted in order to</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>; force the
program to run long enough to see its parallel effects.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>(define f
(future task1))<BR>(task2)<BR>(touch f)</SPAN></FONT></DIV>
<DIV><FONT size=2 face="Courier New"><SPAN class=878121115-16052011>; Clear
memory avoiding memory overflow during next run.<BR>(set! V #f)<BR>(set! f
#f)<BR>(collect-garbage)<BR></DIV></SPAN></FONT>
<DIV> </DIV><!-- Converted from text/rtf format -->
<P align=left>
<P><FONT size=2><FONT face="Courier New"></FONT></FONT></P></P></BODY></HTML>