freebsd-nq/lib/libpthread/thread
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
thr_attr_destroy.c
thr_attr_getdetachstate.c
thr_attr_getinheritsched.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getschedpolicy.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getscope.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getstackaddr.c
thr_attr_getstacksize.c
thr_attr_init.c
thr_attr_setcreatesuspend_np.c
thr_attr_setdetachstate.c
thr_attr_setinheritsched.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setschedpolicy.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setscope.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setstackaddr.c
thr_attr_setstacksize.c
thr_clean.c
thr_close.c
thr_cond.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_condattr_destroy.c
thr_condattr_init.c
thr_create.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_detach.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_equal.c
thr_exit.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_fcntl.c Removed unused variables. 1998-09-07 21:55:01 +00:00
thr_find_thread.c Move the cleanup code that frees memory allocated for a dead thread from 1998-09-30 06:36:56 +00:00
thr_fork.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_fsync.c
thr_gc.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_getprio.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_getschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_info.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_init.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_join.c
thr_kern.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_kill.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mattr_init.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mattr_kind_np.c Add support for pthread_mutexattr_settype(). As a side effect of 1998-11-28 23:52:58 +00:00
thr_multi_np.c
thr_mutex_prioceiling.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mutex_protocol.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mutex.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mutexattr_destroy.c
thr_nanosleep.c
thr_once.c
thr_open.c
thr_priority_queue.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_private.h [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_read.c
thr_readv.c
thr_resume_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_rwlock.c Removed some variable initializations which were unnecessary and divergent 1998-09-07 21:07:59 +00:00
thr_rwlockattr.c -Wall clean. 1998-09-07 19:23:55 +00:00
thr_select.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_self.c
thr_seterrno.c
thr_setprio.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_setschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sig.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sigaction.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sigmask.c
thr_sigpending.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sigprocmask.c
thr_sigsuspend.c Implementation of an additional state called SIGWAIT (with the previous 1998-09-30 06:27:31 +00:00
thr_sigwait.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_single_np.c
thr_spec.c NULL a pointer after it is freed to avoid trying to free it again. 1998-09-30 06:24:57 +00:00
thr_spinlock.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_suspend_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_switch_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_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
thr_wait4.c
thr_write.c Removed unused variables. 1998-09-07 21:55:01 +00:00
thr_writev.c
thr_yield.c