<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>Clearing out more backlog...</div>
<div><br>
</div>
<div><br>
</div>
<div>I suggest, for example, the cm3 compiler should use</div>
<div>a thread per "processor" for the backend.</div>
<div><br>
</div>
<div><br>
</div>
<div>I acknowledge that "processor" isn't well defined, such as with Intel</div>
<div>hyperthreading and in general with various resources (registers, integer ALU,</div>
<div>floating point ALU, branch predictor memory, cache) not being equally duplicated.</div>
<div><br>
</div>
<div><br>
</div>
<div>I acknowledge that hogging all the CPU is deleterious to interactive</div>
<div>performance, or overall system performance if anything else is running.</div>
<div><br>
</div>
<div><br>
</div>
<div>Adapting to overall system load and being good citizen is quite difficult</div>
<div>unless you are the semi-omniscient operating system kernel.</div>
<div><br>
</div>
<div><br>
</div>
<div>I believe C++11 exposes this notion and Boost did before it.</div>
<div>(C++11 finally acknowledged the existance of threads and has</div>
<div>a memory model and library for them, 20 years late)</div>
<div><br>
</div>
<div><br>
</div>
<div>I propose that we can freely integrate Boost code into our runtime.</div>
<div>That its license is close in spirit to ours.</div>
<div><br>
</div>
<div><br>
</div>
<div>edit m3-libs/m3core/src/thread/Common/BoostThread.cpp</div>
<div><br>
</div>
<div><br>
</div>
<div>#ifndef _WIN32</div>
<div>// Copyright (C) 2001-2003</div>
<div>// William E. Kempf</div>
<div>// Copyright (C) 2007-8 Anthony Williams</div>
<div>// (C) Copyright 2011-2012 Vicente J. Botet Escriba</div>
<div>//</div>
<div>//  Distributed under the Boost Software License, Version 1.0. (See accompanying</div>
<div>//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)</div>
<div>#ifdef __GLIBC__</div>
<div>#include <sys/sysinfo.h></div>
<div>#elif defined(__APPLE__) || defined(__FreeBSD__)</div>
<div>#include <sys/types.h></div>
<div>#include <sys/sysctl.h></div>
<div>#else // if defined BOOST_HAS_UNISTD_H</div>
<div>#include <unistd.h></div>
<div>#endif</div>
<div>#endif</div>
<div><br>
</div>
<div><br>
</div>
<div>extern "C"</div>
<div>    unsigned m3_thread_hardware_concurrency()</div>
<div>    {</div>
<div>#if defined(PTW32_VERSION) || defined(__hpux)</div>
<div>        return pthread_num_processors_np();</div>
<div>#elif defined(__APPLE__) || defined(__FreeBSD__)</div>
<div>        int count;</div>
<div>        size_t size = sizeof(count);</div>
<div>        return sysctlbyname("hw.ncpu", &count, &size, NULL, 0) ? 0 : count;</div>
<div>#elif defined(BOOST_HAS_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)</div>
<div>        int const count = sysconf(_SC_NPROCESSORS_ONLN);</div>
<div>        return (count > 0) ? count : 0;</div>
<div>#elif defined(__GLIBC__)</div>
<div>        return get_nprocs();</div>
<div>#else</div>
<div>        return 0;</div>
<div>#endif</div>
<div>    }</div>
<div>#else</div>
<div>#include <windows.h></div>
<div>// Distributed under the Boost Software License, Version 1.0. (See</div>
<div>// accompanying file LICENSE_1_0.txt or copy at</div>
<div>// http://www.boost.org/LICENSE_1_0.txt)</div>
<div>// (C) Copyright 2007 Anthony Williams</div>
<div>// (C) Copyright 2007 David Deakins</div>
<div>// (C) Copyright 2011-2013 Vicente J. Botet Escriba</div>
<div>extern "C"</div>
<div>    unsigned m3_m3_thread_hardware_concurrency()</div>
<div>    {</div>
<div>        SYSTEMINFO info;</div>
<div>        GetSystemInfo(&info);</div>
<div>        return info.dwNumberOfProcessors;</div>
<div>    }</div>
<div>#endif</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>and then something in Thread.i3.</div>
<div><br>
</div>
<div><br>
</div>
<div> <* external m3_thread_hardware_concurrent *> </div>
<div> PROCEDURE Thread.HardwareConcurrency(): INTEGER; </div>
<div><br>
</div>
<div><br>
</div>
<div>?</div>
<div><br>
</div>
<div><br>
</div>
<div> - Jay</div>
<br>
<p></p>
<p><br>
</p>
<div id="Signature"><br>
</div>
</div>
</body>
</html>