• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..30-Mar-2022-

Makefile.inH A D30-Mar-2022752 4123

READMEH A D30-Mar-20223.2 KiB6349

prucpu.cH A D30-Mar-202211.3 KiB425272

prucv.cH A D30-Mar-202219 KiB680443

prulock.cH A D30-Mar-202212.4 KiB458285

prustack.cH A D30-Mar-20224.7 KiB176105

pruthr.cH A D30-Mar-202257.4 KiB1,9431,321

README

1NSPR 2.0 evolution
2------------------
3
4
5Phase 1- today
6
7Currently (Oct 10, 1996) NSPR 2.0 has two modes.  Either _PR_NTHREAD
8is defined, in which case the PR_CreateThread() call always creates a
9native kernel thread, or _PR_NTHREAD is not defined and PR_CreateThread()
10always creates user level threads within the single, original process.  This
11source code is reflected in two directories, nspr20/pr/src/threads/native, and
12nspr20/pr/src/threads/user.  Although the PR_CreateThread() function has
13a paramter to specify the "scope" of a thread, this parameter is not yet
14used- except on solaris where it uses it to specify bound vs unbound threads.
15
16Phase 2 - next week
17
18The next step is to provide a combination of user and native threads.  The
19idea, of course, is to have some small number of native threads and each of
20those threads be able to run user level threads.  The number of native
21threads created will most likely be proportional to the number of CPUs in
22the system.  For this reason, the specific set of native threads which are
23used to run the user-level threads will be called "CPU" threads.
24
25The user level threads which will be run on the CPU threads are able to
26run on any of the CPU threads available, and over the course of a user-level
27thread's lifetime, it may drift from one CPU thread to another.  All
28user-level threads will compete for processing time via a single run queue.
29
30Creation of a CPU thread will be primarily controlled by NSPR itself or by
31the user running a function PR_Concurrency().  The details of PR_Concurrency()
32have not yet been worked out; but the idea is that the user can specify to
33NSPR how many CPU threads are desired.
34
35In this system, user-level threads are created by using PR_CreateThread() and
36specifying the PR_LOCAL_SCOPE option.  LOCAL_SCOPE indicates that the thread
37will be under the control of the "local" scheduler.  Creating threads with
38GLOBAL_SCOPE, on the other hand will create a thread which is under the
39control of the system's scheduler.  In otherwords, this creates a native thread
40which is not a CPU thread; it runs a single thread task and never has more
41than one task to run.  LOCAL_SCOPE is much like creating a Solaris unbound
42thread, while GLOBAL_SCOPE is similar to creating a Solaris bound thread.
43
44To implement this architecture, the source code will still maintain the "user"
45and "native" directories which is has today.  However a third directory
46"combined" will also exist.  To compile a version of NSPR which only creates
47native threads, the user can define _PR_NTHREAD.  For exclusive user-level
48threads, do not define _PR_NTHREAD.  To get the combined threads, define
49_PR_NTHREAD and _PR_USE_CPUS.
50
51
52Phase 3 - later than next week
53
54The goal is to eliminate the 3 directories.  Once these three models are in
55place, the remaining work will be to eliminate the native and user thread
56directories for all platforms, so that the entire thread model is contained
57within what is today called the "combined" model.  This new and glorious
58source code will attempt to make the "combined" model on any platforms which
59provide the necessary underlying native threading, but will also be
60capable of using exclusive user-level threads on systems which don't have
61native threads.
62
63