Changes to Threads between r0 and r1

'''Threads and Threading'''

Threads are a method of dividing a process or program so that different parts of it may execute (or may seem to execute) in parallel, while still sharing the same address space.

Threads are a useful technique for making an otherwise complicated procedure where disparate functions need to be performed without much (but usually with some) coordination.  For example, a many graphical user interface systems are threaded so that the process can handle the User Interface and the Primary Function Code in logically distinct units while still being able to have the two interface with each other through a simple interface (memory).

A parallel concept (but perhaps not obviously so) to threads is [Events].
----
'''Types of Threading'''
(blank line)
There are two types of threading: [Cooperative Threading] and [Preemptive Threading]

If you want [Cooperative], [Protothreads] is by far the most portable ([GNU Pth], for example, won't run under [win32]).

If you want [Preemptive], I'd go with POSIX Threads ([pthreads]), and use a wrapper (library, or, if you can -- a simple header) for places that don't support POSIX Threads (notably [Win32] without "Services for Unix" installed on the client).
----
'''More About Events'''
(blank line)
Doctor John Ousterhout (principal designer of the [Tcl] language) wrote a paper about [Events] called "Why Threads are a Bad Idea (for most purposes)" [http://home.pacbell.net/ouster/threads.pdf] [http://www.rkeene.org/projects/info/resources/threads/papers/threads.pdf]
----
'''Give Me an Example'''
(blank line)
The same program written using various threading techniques (the same style is used for clarity, even if it causes inefficiency (i.e., by not using pthread_join)):
   * [Cheap Threads]: http://www.rkeene.org/projects/info/resources/threads/test1-ct.c
   * [Libfiber]: http://www.rkeene.org/projects/info/resources/threads/test1-lf.c
   * [Protothreads]: http://www.rkeene.org/projects/info/resources/threads/test1-pt.c
   * [GNU Pth]: http://www.rkeene.org/projects/info/resources/threads/test1-pth.c
   * [PThreads]: http://www.rkeene.org/projects/info/resources/threads/test1-pthread.c
   * [PThreads] with [Win32] Wrapper support: http://www.rkeene.org/projects/info/resources/threads/test1-pthread-emul.c
----
[Win32] [Pthreads] information
   * http://world.std.com/~jmhart/opensource.htm [http://www.rkeene.org/projects/info/resources/threads/pthread-emul/opensource.htm]
----
Information about [Tcl and Threads]
----
[Jonathan Mayo] also wrote a simple threading system called [Orangetide's Tiny Threads]

Legend

     Only in r0
     Only in r1
     -->      Modified slightly between r0 and r1