<!DOCTYPE HTML PUBLIC "-//FreeBSD//DTD HTML 4.01 Transitional-Based Extension//EN" [
<!ENTITY base CDATA "..">
<!ENTITY date "$FreeBSD$">
<!ENTITY title "FreeBSD KSE Project">
<!ENTITY email 'mini'>
<!ENTITY % navinclude.about "INCLUDE">

<!-- Status levels -->
<!ENTITY status.done "<font color=green>Done</font>">
<!ENTITY status.wip "<font color=blue>In progress</font>">
<!ENTITY status.stalled "<font color=purple>Stalled</font>">
<!ENTITY status.new "<font color=red>Not Started</font>">
<!ENTITY status.resolved "<font color=green>Resolved</font>">
<!ENTITY status.unresolved "<font color=red>Unresolved</font>">

<!-- The list of contributors was moved to a separate file so that it can
  be used by other documents in the FreeBSD web site. -->

<!ENTITY % developers PUBLIC "-//FreeBSD//ENTITIES FreeBSD Developers Entities//EN"> %developers;

]>

<html>
  &header;

    <h2>Contents</h2>
    <ul>
      <li><a href="#overview">Project Overview</a></li>
      <li><a href="#using">Using KSE</a></li>
      <li><a href="#further.reading">Further Reading</a></li>
      <li><a href="#status.kernel">Project Status</a></li>
    </ul>

    <a id="overview" name="overview"></a>
    <h2>Overview</h2>

    <p>Kernel Scheduler Entities (KSE), is a kernel-supported threading
      system similar in design to Scheduler Activations [Anderson, et. al.]. It
      strikes a balance between user-level (1:N) and kernel-level (1:1)
      threading models, giving most of the advantages of both, and
      few of the disadvantages of either.</p>

    <p>There are two halves of this project: kernel support and user
      support. The kernel support consists of modifications to the
      FreeBSD scheduler; The user half is a &posix; threads implementation
      which takes advantage of the extra facilities the kernel provides.</p>

    <p>The goal is to replace the current user threading system provided by
      the libc_r library, and the <tt>-pthread</tt> gcc option, with a new
      libpthread library which will be linked with the <tt>-lpthread</tt>
      gcc option.</p>

    <a name="using"></a>
    <h2>Using KSE</h2>

    <p>All KSE development is being done in 5.0-CURRENT. No special
    kernel configuration options are required to build a kernel with
    the KSE-related changes (the changes are inextricable from the
    FreeBSD scheduler).</p>

    <p>In order to use KSE in an application, you need to link it against
    libpthread; this is straightforward. In the application's makefile(s),
    change the <tt>-pthread</tt> compiler switch or <tt>-lc_r</tt> link
    option to <tt>-lpthread</tt> and relink. Alternatively, you can use
    <tt>/etc/libmap.conf</tt> to map libc_r to libpthread (see
    <tt>libmap.conf(5)</tt>).</p>

    <a name="further.reading"></a>
    <h2>Further Reading</h2>
    <p>
    <ul>
      <li><a href="http://www.aims.net.au/chris/kse/">
       Kernel-Scheduled Entities for FreeBSD</a>, by Jason Evans. 
        (Slightly out of date).
      </li>
      <li><a href="http://www.FreeBSD.org/cgi/man.cgi?query=kse&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+5.0-current&amp;format=html">KSE man page</a>
      </li>
      <li><a href="http://people.FreeBSD.org/~deischen/docs/Scheduler.pdf">
       Scheduler Activations</a>, by Anderson, et al. 
      </li>
    </ul> 

    <a name="status.kernel"></a>
    <a name="status"></a>
    <h2>Project Status</h2>

    <p>Following is an incomplete general list of tasks:</p>

    <table class="tblbasic">
      <tr>
	<th> Module </th>
	<th> Task </th>
	<th> Responsible </th>
	<th> Last updated </th>
	<th> Status </th>
      </tr>

      <tr>
      	<td> libpthread </td>
	<td> Write kse(2) man page documenting new system calls. </td>
	<td> &a.archie; </td>
	<td> 10 September 2002 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread </td>
	<td> Repo-copy the libpthread library from libc_r. </td>
	<td> cvs meister </td>
	<td> 16 September 2002 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread </td>
	<td> Use KSE to schedule processes. </td>
	<td> &a.mini; </td>
	<td> 30 October 2002 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread </td>
	<td> Schedule an idle context when appropriate. </td>
	<td> &a.mini; </td>
	<td> 2 November 2002 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread </td>
	<td> Deliver signals to threads. </td>
	<td> &a.deischen; &a.davidxu; </td>
	<td> 28 June 2003 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread </td>
	<td> Locking for SMP. </td>
	<td> &a.deischen; </td>
	<td> 3 May 2003 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> kernel </td>
	<td> Locking for SMP. </td>
	<td> &a.davidxu; </td>
	<td> 3 May 2003 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread </td>
	<td> Launch multiple KSEs (one per CPU). </td>
	<td> &a.davidxu; </td>
	<td> 3 May 2003 </td>
	<td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread, kernel </td>
        <td> Implement alpha machine-dependent functions. </td>
        <td> &a.marcel; </td>
        <td> 30 Aug 2003 </td>
        <td> &status.wip; </td>
      </tr>

      <tr>
      	<td> libpthread, kernel </td>
        <td> Implement amd64 machine-dependent functions. </td>
        <td> &a.davidxu; &a.deischen; </td>
        <td> 30 Aug 2003 </td>
        <td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread, kernel </td>
        <td> Implement i386 machine-dependent functions. </td>
        <td> &a.davidxu; &a.deischen; </td>
        <td> 30 Aug 2003 </td>
        <td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread, kernel </td>
        <td> Implement ia64 machine-dependent functions. </td>
        <td> &a.marcel; </td>
        <td> 30 Aug 2003 </td>
        <td> &status.done; </td>
      </tr>

      <tr>
      	<td> libpthread, kernel </td>
        <td> Implement sparc64 machine-dependent functions. </td>
        <td> &a.jake; </td>
        <td> 30 Aug 2003 </td>
        <td> &status.wip; </td>
      </tr>

      <tr>
	<td> kernel </td>
        <td> Implement KSE-specific signaling. </td>
        <td> &a.davidxu; </td>
        <td> 28 June 2003 </td>
        <td> &status.done; </td>
      </tr>

      <tr>
	<td> libpthread </td>
        <td> Implement scope system threads. </td>
        <td> &a.deischen; </td>
        <td> 3 May 2003 </td>
        <td> &status.done; </td>
      </tr>

      <tr>
	<td> kernel </td>
        <td> Efficient scope system threads (no upcalls when they block). </td>
        <td> &a.davidxu; </td>
        <td> 30 Aug 2003 </td>
        <td> &status.done; </td>
      </tr>

<!--
      <tr>
	<td> &nbsp; </td>
        <td>  </td>
        <td> &nbsp; </td>
        <td> D M 2002 </td>
        <td> &status.new; </td>
      </tr>

-->
    </table>

  &footer;
  </body>
</html>
