freebsd-dev/lib/libc_r/uthread
John Birrell 58a7cc5d1b [ The author's description... ]
o Runnable threads are now maintained in priority queues.  The
    implementation requires two things:

      1.) The priority queues must be protected during insertion
          and removal of threads.  Since the kernel scheduler
          must modify the priority queues, a spinlock for
          protection cannot be used.   The functions
          _thread_kern_sched_defer() and _thread_kern_sched_undefer()
          were added to {un}defer kernel scheduler activation.

      2.) A thread (active) priority change can be performed only
          when the thread is removed from the priority queue.  The
          implementation uses a threads active priority when
          inserting it into the queue.

    A by-product is that thread switches are much faster.  A
    separate queue is used for waiting and/or blocked threads,
    and it is searched at most 2 times in the kernel scheduler
    when there are active threads.  It should be possible to
    reduce this to once by combining polling of threads waiting
    on I/O with the loop that looks for timed out threads and
    the minimum timeout value.

  o Functions to defer kernel scheduler activation were added.  These
    are _thread_kern_sched_defer() and _thread_kern_sched_undefer()
    and may be called recursively.  These routines do not block the
    scheduling signal, but latch its occurrence.  The signal handler
    will not call the kernel scheduler when the running thread has
    deferred scheduling, but it will be called when running thread
    undefers scheduling.

  o Added support for _POSIX_THREAD_PRIORITY_SCHEDULING.  All the
    POSIX routines required by this should now be implemented.
    One note, SCHED_OTHER, SCHED_FIFO, and SCHED_RR are required
    to be defined by including pthread.h.  These defines are currently
    in sched.h.  I modified pthread.h to include sched.h but don't
    know if this is the proper thing to do.

  o Added support for priority protection and inheritence mutexes.
    This allows definition of _POSIX_THREAD_PRIO_PROTECT and
    _POSIX_THREAD_PRIO_INHERIT.

  o Added additional error checks required by POSIX for mutexes and
    condition variables.

  o Provided a wrapper for sigpending which is marked as a hidden
    syscall.

  o Added a non-portable function as a debugging aid to allow an
    application to monitor thread context switches.  An application
    can install a routine that gets called everytime a thread
    (explicitly created by the application) gets context switched.
    The routine gets passed the pthread IDs of the threads that are
    being switched in and out.

Submitted by: Dan Eischen <eischen@vigrid.com>

Changes by me:

  o Added a PS_SPINBLOCK state to deal with the priority inversion
    problem most often (I think) seen by threads calling malloc/free/realloc.

  o Dispatch signals to the running thread directly rather than at a
    context switch to avoid the situation where the switch never occurs.
1999-03-23 05:07:56 +00:00
..
Makefile.inc [ The author's description... ] 1999-03-23 05:07:56 +00:00
pthread_private.h [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_accept.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_attr_destroy.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_attr_getdetachstate.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_attr_getinheritsched.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_getschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_getschedpolicy.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_getscope.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_getstackaddr.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_attr_getstacksize.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_attr_init.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_attr_setcreatesuspend_np.c Submitted by: John Birrell <cimaxp1!jb@werple.net.au> 1996-08-20 08:22:01 +00:00
uthread_attr_setdetachstate.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_attr_setinheritsched.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_setprio.c Submitted by: John Birrell <cimaxp1!jb@werple.net.au> 1996-08-20 08:22:01 +00:00
uthread_attr_setschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_setschedpolicy.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_setscope.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_attr_setstackaddr.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_attr_setstacksize.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_autoinit.cc Added a new module "uthread_autoinit.cc". This is a small C++ module. 1996-02-17 02:19:37 +00:00
uthread_bind.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_clean.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
uthread_close.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_cond.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_condattr_destroy.c Modify the return values to comply with POSIX. Previously these 1997-11-25 01:29:16 +00:00
uthread_condattr_init.c Modify the return values to comply with POSIX. Previously these 1997-11-25 01:29:16 +00:00
uthread_connect.c Add missing initialization of the length variable passed to 1998-08-12 20:29:29 +00:00
uthread_create.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_detach.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_dup2.c Don't lock newfd if it is not opened. 1998-09-13 12:48:47 +00:00
uthread_dup.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_equal.c Reviewed by: julian 1996-01-22 00:23:58 +00:00
uthread_execve.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_exit.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_fchmod.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_fchown.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_fcntl.c Removed unused variables. 1998-09-07 21:55:01 +00:00
uthread_fd.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_file.c Fixed bug, caused threads to wait for locks which nobody hold. 1998-09-09 16:50:33 +00:00
uthread_find_thread.c Move the cleanup code that frees memory allocated for a dead thread from 1998-09-30 06:36:56 +00:00
uthread_flock.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_fork.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_fstat.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_fstatfs.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_fsync.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_gc.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_getdirentries.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_getpeername.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_getprio.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_getschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_getsockname.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_getsockopt.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_info.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_init.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_ioctl.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_join.c Add the missing {} that caused the function to return ESRCH if it 1998-06-25 00:04:21 +00:00
uthread_kern.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_kill.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_listen.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_mattr_init.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_mattr_kind_np.c Add support for pthread_mutexattr_settype(). As a side effect of 1998-11-28 23:52:58 +00:00
uthread_multi_np.c Submitted by: John Birrell <cimaxp1!jb@werple.net.au> 1996-08-20 08:22:01 +00:00
uthread_mutex_prioceiling.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_mutex_protocol.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_mutex.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_mutexattr_destroy.c Modify the return values to comply with POSIX. Previously these 1997-11-25 01:29:16 +00:00
uthread_nanosleep.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_once.c Reviewed by: julian 1996-01-22 00:23:58 +00:00
uthread_open.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_pipe.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_priority_queue.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_queue.c Reviewed by: julian 1996-01-22 00:23:58 +00:00
uthread_read.c Check the access mode in the flags before waiting on a read or a write 1998-06-10 22:28:45 +00:00
uthread_readv.c Check the access mode in the flags before waiting on a read or a write 1998-06-10 22:28:45 +00:00
uthread_recvfrom.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_recvmsg.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_resume_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_rwlock.c Removed some variable initializations which were unnecessary and divergent 1998-09-07 21:07:59 +00:00
uthread_rwlockattr.c -Wall clean. 1998-09-07 19:23:55 +00:00
uthread_select.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_self.c Reviewed by: julian 1996-01-22 00:23:58 +00:00
uthread_sendmsg.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_sendto.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_seterrno.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_setprio.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_setschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_setsockopt.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_shutdown.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
uthread_sig.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_sigaction.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_sigblock.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_sigmask.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_signal.c Don't automatically restart syscalls for the signals that the thread 1998-08-26 20:55:31 +00:00
uthread_sigpending.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_sigprocmask.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_sigsetmask.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_sigsuspend.c Implementation of an additional state called SIGWAIT (with the previous 1998-09-30 06:27:31 +00:00
uthread_sigwait.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_single_np.c Submitted by: John Birrell <cimaxp1!jb@werple.net.au> 1996-08-20 08:22:01 +00:00
uthread_socket.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_socketpair.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_spec.c NULL a pointer after it is freed to avoid trying to free it again. 1998-09-30 06:24:57 +00:00
uthread_spinlock.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_suspend_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_switch_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
uthread_vfork.c In libc_r, rename vfork syscall to _thread_sys_vfork and make vfork an alias 1998-09-12 22:03:20 +00:00
uthread_wait4.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
uthread_write.c Removed unused variables. 1998-09-07 21:55:01 +00:00
uthread_writev.c If a short write, only loop if no error. 1998-06-14 09:36:14 +00:00
uthread_yield.c Add sched_yield() witch is the draft 10 equivalent of pthread_yield() 1998-03-08 02:37:27 +00:00