<p dir="ltr">If you're using an affinity mask, sure.  The advantage of having this in jdk is cross platform support and not having people write the same code across their apps.</p>
<p dir="ltr">Sent from my phone</p>
<div class="gmail_quote">On Feb 13, 2013 8:39 AM, "Stanimir Simeonoff" <<a href="mailto:stanimir@riflexo.com">stanimir@riflexo.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote">On Wed, Feb 13, 2013 at 3:32 PM, Vitaly Davidovich <span dir="ltr"><<a href="mailto:vitalyd@gmail.com" target="_blank">vitalyd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<p dir="ltr">/proc/cpuinfo parsing is the way to go but would be nice to have a "machine spec/capability" API baked into the JDK.</p>
<p dir="ltr"></p></blockquote><div>But you still to get info on which CPU the process is limited to, i.e. affinity. Which is the harder task. OTOH, /proc/cpuinfo is quite trivial to parse.<br><br>Stanimir<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<p dir="ltr">Sent from my phone</p><div><div>
<div class="gmail_quote">On Feb 13, 2013 5:49 AM, "Stanimir Simeonoff" <<a href="mailto:stanimir@riflexo.com" target="_blank">stanimir@riflexo.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>

Is there a way to know how many physical processors are available on the JVM?</div>

<div><br></div></div></div></div></blockquote><div>On linux you can use taskset -p <pid><br>(pid you can retrieve form /proc/self )<br>and you can use /proc/cpuinfo to determine which processors have siblings.<br><br>



Quite inconvenient overall. So kernels might have /proc/self/affinity which would make life easier .<br>And of course there is JNI and syscall.<br><br>Stanimir<br><br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>Cheers,</div><div><div><div>√</div>
<div> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><div><span><font color="#888888"><br>
      <br>
      <div><a href="http://psr.us.oracle.com/wiki/index.php/User:Nathan_Reynolds" target="_blank">Nathan
          Reynolds</a> | Architect | <a href="tel:602.333.9091" value="+16023339091" target="_blank">602.333.9091</a><br>
        <font color="red">Oracle</font> <a href="http://psr.us.oracle.com/" target="_blank">PSR Engineering</a> | Server
        Technology<br>
      </div></font></span><div><div>
      On 2/12/2013 2:18 PM, √iktor Ҡlang wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div>
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote">On Tue, Feb 12, 2013 at 8:28 PM, Kirk
            Pepperdine <span dir="ltr"><<a href="mailto:kirk@kodewerk.com" target="_blank">kirk@kodewerk.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div>><br>
                > Do you agree that thread pool sizing depends on
                type of work? (IO bound vs CPU bound, bursty vs steady
                etc etc)<br>
              </div>
              Yes<br>
              <div>> Do you agree that a JVM Thread is not
                a unit of parallelism?<br>
              </div>
              Yes<br>
              <div>> Do you agree that having more JVM
                Threads than hardware threads is bad for CPU-bound
                workloads?<br>
              </div>
              No, even with CPU bound workloads I have found that the
              hardware/OS is much better at managing many workloads
              across many threads than I am. So a few more threads is
              ok, many more threads is bad fast.<br>
            </blockquote>
            <div><br>
            </div>
            <div>That's an interesting observation. Have any
              more data on that? (really interested)</div>
            <div>As I said earlier, for CPU-bound workloads
              we've seen the best performance when only loading 60-70%
              of the cores (other threads exist on the machine of
              course).</div>
            <div><br>
            </div>
            <div>Cheers,</div>
            <div><br>
              √</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <br>
              Regards,<br>
              Kirk</blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div dir="ltr"><span style="line-height:normal;text-indent:0px;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Times;word-spacing:0px"><span style="font-family:arial;font-size:small"><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><b style="font-style:normal">Viktor Klang</b><br>





                  <i>Director of Engineering</i></span></span></span>
            <div><font color="#000000"><i><br>
                </i></font><span style="line-height:normal;text-indent:0px;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Times;word-spacing:0px"><span style="font-family:arial;font-size:small">
                  <div style="font-style:normal;font-weight:normal">
                    <font face="arial, sans-serif"><span style="border-collapse:collapse"><a href="http://www.typesafe.com/" target="_blank">Typesafe</a><span> </span>- </span></font><span>The
                      software stack for applications that scale</span><font face="arial, sans-serif"><span style="border-collapse:collapse"><br>
                      </span></font><font face="arial, sans-serif"><span style="border-collapse:collapse">Twitter:
                        @viktorklang</span></font></div>
                </span></span></div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><div><pre>_______________________________________________
Concurrency-interest mailing list
<a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a>
</pre>
    </div></blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a><br>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
<br></blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><span style="line-height:normal;text-indent:0px;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Times;word-spacing:0px"><span style="font-family:arial;font-size:small"><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><b style="font-style:normal">Viktor Klang</b><br>




<i>Director of Engineering</i></span></span></span><div><font color="#000000"><i><br></i></font><span style="line-height:normal;text-indent:0px;border-collapse:separate;letter-spacing:normal;font-variant:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Times;word-spacing:0px"><span style="font-family:arial;font-size:small"><div style="font-style:normal;font-weight:normal">




<font face="arial, sans-serif"><span style="border-collapse:collapse"><a href="http://www.typesafe.com/" target="_blank">Typesafe</a><span> </span>- </span></font><span>The software stack for applications that scale</span><font face="arial, sans-serif"><span style="border-collapse:collapse"><br>




</span></font><font face="arial, sans-serif"><span style="border-collapse:collapse">Twitter: @viktorklang</span></font></div></span></span></div></div>
</div></div></div></div>
<br>_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a><br>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
<br></blockquote></div><br>
<br>_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a><br>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
<br></blockquote></div>
</div></div></blockquote></div><br>
</blockquote></div>