<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Threads in CCL since version 0.14 (which was a long time ago) are
    native and thus preemptively scheduled by the operating system.
    Unlike in Allegro CL and Lispworks, SMP cannot easily be turned off
    in CCL: It's always on. And there is no "CCL scheduler".<br>
    <br>
    -SS<br>
    <br>
    <div class="moz-cite-prefix">On 1/5/24 9:58 AM, Tim McNerney wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1aa69dae-6343-4a8d-9cab-65708d716fd4@media.mit.edu">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Your "thread pools" approach sounds wise. While I don't (but
      should) know what CCL does right now w.r.t. threads, the "modern
      thing to do" is for Lisps to use native OS threads, which I can
      easily imagine take some time to launch, but then take good
      advantage of symmetric multiprocessing (SMP).  That's what Franz
      does anyway.  I assume, based on the compiler output I've studied,
      that CCL supports SMP threads. I would not expect that CCL runs
      its own scheduler anymore. [Wizards: please correct me if I'm
      wrong].<br>
      <br>
      --Tim<br>
      <br>
      <div class="moz-cite-prefix">On 1/5/24 10:54 AM, David McClain
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:9239C647-4950-4F51-9327-3E5A06B16921@refined-audiometrics.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        I have spent more than a decade implementing various versions of
        Actors systems. Some were along the lines you describe,
        launching native threads to perform the work of Actors.
        <div><br>
        </div>
        <div>I finally concluded that, having just run a good race, you
          ought not kill the race horses, but rather retire them to the
          stable for another race. IOW, I now use thread pools,
          permanently launched and waiting for dispatch to another task.
          Thread startup entails a huge amount of overhead - allocating
          stack space and CPU registers, registering with OS, etc.</div>
        <div><br>
        </div>
        <div>- DM<br id="lineBreakAtBeginningOfMessage">
          <div><br>
            <blockquote type="cite">
              <div>On Jan 5, 2024, at 07:32, Taoufik Dachraoui <a
                  class="moz-txt-link-rfc2396E"
                  href="mailto:dachraoui.taoufik@gmail.com"
                  moz-do-not-send="true"><dachraoui.taoufik@gmail.com></a>
                wrote:</div>
              <br class="Apple-interchange-newline">
              <div>
                <div dir="ltr">why ccl is much slower?
                  <div><br>
                  </div>
                  <div>taoufik@Ankbot:~/workspace/ccl/actor$ sbcl<br>
                    This is SBCL 2.3.11, an implementation of ANSI
                    Common Lisp.<br>
                    More information about SBCL is available at <<a
                      href="http://www.sbcl.org/" moz-do-not-send="true"
                      class="moz-txt-link-freetext">http://www.sbcl.org/</a>>.<br>
                    <br>
                    SBCL is free software, provided as is, with
                    absolutely no warranty.<br>
                    It is mostly in the public domain; some portions are
                    provided under<br>
                    BSD-style licenses.  See the CREDITS and COPYING
                    files in the<br>
                    distribution for more information.<br>
                    * (time (prog1 t (loop for i from 0 upto 100000000
                    collect i)))<br>
                    Evaluation took:<br>
                      1.379 seconds of real time<br>
                      1.379015 seconds of total run time (0.856185 user,
                    0.522830 system)<br>
                      [ Real times consist of 1.143 seconds GC time, and
                    0.236 seconds non-GC time. ]<br>
                      [ Run times consist of 1.146 seconds GC time, and
                    0.234 seconds non-GC time. ]<br>
                      100.00% CPU<br>
                      2,913,031,106 processor cycles<br>
                      1,600,427,200 bytes consed<br>
                      <br>
                    T<br>
                    * (quit)<br>
                    taoufik@Ankbot:~/workspace/ccl/actor$ ccl<br>
                    Clozure Common Lisp Version 1.12.1
                    (v1.12.1-22-g6b1f1d3a) LinuxX8664<br>
                    <br>
                    For more information about CCL, please see <a
                      href="http://ccl.clozure.com/"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">http://ccl.clozure.com</a>.<br>
                    <br>
                    CCL is free software.  It is distributed under the
                    terms of the Apache<br>
                    Licence, Version 2.0.<br>
                    ? (time (prog1 t (loop for i from 0 upto 100000000
                    collect i)))<br>
                    (PROG1 T (LOOP FOR I FROM 0 UPTO 100000000 COLLECT
                    I))<br>
                    took 11,946,514 microseconds (11.946514 seconds) to
                    run.<br>
                         11,147,722 microseconds (11.147722 seconds,
                    93.31%) of which was spent in GC.<br>
                    During that period, and with 24 available CPU cores,<br>
                         11,632,370 microseconds (11.632370 seconds)
                    were spent in user mode<br>
                            292,428 microseconds ( 0.292428 seconds)
                    were spent in system mode<br>
                     1,600,000,032 bytes of memory allocated.<br>
                     397,400 minor page faults, 0 major page faults, 0
                    swaps.<br>
                    T<br>
                    ? <br>
                  </div>
                </div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Fri, Jan 5, 2024
                    at 3:28 PM Taoufik Dachraoui <<a
                      href="mailto:dachraoui.taoufik@gmail.com"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">dachraoui.taoufik@gmail.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex">
                    <div dir="ltr">It looks like it is not because of
                      the threads:
                      <div><br>
                      </div>
                      <div>taoufik@Ankbot:~/workspace/ccl/actor$ sbcl<br>
                        This is SBCL 2.3.11, an implementation of ANSI
                        Common Lisp.<br>
                        More information about SBCL is available at <<a
                          href="http://www.sbcl.org/" target="_blank"
                          moz-do-not-send="true"
                          class="moz-txt-link-freetext">http://www.sbcl.org/</a>>.<br>
                        <br>
                        SBCL is free software, provided as is, with
                        absolutely no warranty.<br>
                        It is mostly in the public domain; some portions
                        are provided under<br>
                        BSD-style licenses.  See the CREDITS and COPYING
                        files in the<br>
                        distribution for more information.<br>
                        * (time (reduce #'+ (loop for i from 0 upto
                        100000000 collect i)))<br>
                        Evaluation took:<br>
                          1.836 seconds of real time<br>
                          1.835223 seconds of total run time (1.351394
                        user, 0.483829 system)<br>
                          [ Real times consist of 1.184 seconds GC time,
                        and 0.652 seconds non-GC time. ]<br>
                          [ Run times consist of 1.184 seconds GC time,
                        and 0.652 seconds non-GC time. ]<br>
                          99.95% CPU<br>
                          3,876,850,246 processor cycles<br>
                          1,600,427,200 bytes consed<br>
                          <br>
                        5000000050000000<br>
                        * taoufik@Ankbot:~/workspace/ccl/actor$ ccl<br>
                        Clozure Common Lisp Version 1.12.1
                        (v1.12.1-22-g6b1f1d3a) LinuxX8664<br>
                        <br>
                        For more information about CCL, please see <a
                          href="http://ccl.clozure.com/" target="_blank"
                          moz-do-not-send="true"
                          class="moz-txt-link-freetext">http://ccl.clozure.com</a>.<br>
                        <br>
                        CCL is free software.  It is distributed under
                        the terms of the Apache<br>
                        Licence, Version 2.0.<br>
                        ? (time (reduce #'+ (loop for i from 0 upto
                        100000000 collect i)))<br>
                        (REDUCE #'+ (LOOP FOR I FROM 0 UPTO 100000000
                        COLLECT I))<br>
                        took 13,091,079 microseconds (13.091079 seconds)
                        to run.<br>
                             11,036,666 microseconds (11.036666 seconds,
                        84.31%) of which was spent in GC.<br>
                        During that period, and with 24 available CPU
                        cores,<br>
                             12,734,283 microseconds (12.734283 seconds)
                        were spent in user mode<br>
                                336,005 microseconds ( 0.336005 seconds)
                        were spent in system mode<br>
                         1,600,000,032 bytes of memory allocated.<br>
                         397,400 minor page faults, 0 major page faults,
                        0 swaps.<br>
                        5000000050000000<br>
                        ?<br>
                      </div>
                    </div>
                    <br>
                    <div class="gmail_quote">
                      <div dir="ltr" class="gmail_attr">On Fri, Jan 5,
                        2024 at 3:10 PM Taoufik Dachraoui <<a
                          href="mailto:dachraoui.taoufik@gmail.com"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">dachraoui.taoufik@gmail.com</a>>
                        wrote:<br>
                      </div>
                      <blockquote class="gmail_quote" style="margin:0px
                        0px 0px 0.8ex;border-left:1px solid
                        rgb(204,204,204);padding-left:1ex">
                        <div dir="ltr">Hi
                          <div><br>
                          </div>
                          <div>In my current implementation of a
                            classical actor model</div>
                          <div>I found that using ccl processes is much
                            slower than sbcl threads</div>
                          <div><br>
                          </div>
                          <div>to create a thread I use <a
                              class="moz-txt-link-freetext"
                              href="ccl:process-run-function"
                              moz-do-not-send="true">ccl:process-run-function</a>,
                            is there another way to </div>
                          <div>create native threads that are much
                            faster; I do not need the ccl scheduling,</div>
                          <div>I want to create threads that are
                            scheduled by the OS, I think that the ccl </div>
                          <div>scheduler is the reason why my ccl tests
                            are much slower than the tests run </div>
                          <div>with sbcl</div>
                          <div>
                            <div><br>
                            </div>
                            <span class="gmail_signature_prefix">
                              <div><span class="gmail_signature_prefix">Regards</span></div>
                              -- </span><br>
                            <div dir="ltr" class="gmail_signature">
                              <div dir="ltr">Taoufik Dachraoui
                                <div><br>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                    <br clear="all">
                    <div><br>
                    </div>
                    <span class="gmail_signature_prefix">-- </span><br>
                    <div dir="ltr" class="gmail_signature">
                      <div dir="ltr">Taoufik Dachraoui
                        <div><br>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br clear="all">
                <div><br>
                </div>
                <span class="gmail_signature_prefix">-- </span><br>
                <div dir="ltr" class="gmail_signature">
                  <div dir="ltr">Taoufik Dachraoui
                    <div><br>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>