Книга: Programming with POSIX® Threads

Сноски из книги

· #1

A barrier is a simple synchronization mechanism that blocks each thread until a certain number has reached the barrier; then all threads are unblocked. Barriers can be used, for example, to keep any thread from executing a parallel region of code until all threads are ready to execute the region. Section 7.1.1 describes barriers in more detail, and demonstrates the construction of a simple barrier package.

· #2

UNIX systems support "nonblocking I/O," but this is not the same thing as asynchronous I/O. Nonblocking I/O allows the program to defer issuing an I/O operation until it can complete without blocking, but asynchronous I/O can proceed while the program does something else.

· #3

Contact the IEEE at l-800-678-IEEE. 9945-l:1996InfonnatiDnTechnology-PortabteOpera-ting System Interface (POSIX)—Part 1: System Application: Program Interface (API) [C Language], ISBN 1-55937-573-6, order number SH94352.

· #4

That is, unfortunately, not what the standard says. This is one of the problems with formal standards — they say what they say, not what they were intended to say. Somehow, an error crept ln, and the sentence specifying that "the implementation clears the thread-specific data value before calling the destructor" was deleted. Nobody noticed, and the standard was approved with the error. So the standard says (by omission) that if you want to write a portable application using thread-speciflc data, that will not hang on thread termination, you must call pthread_setspecific within your destructor function to change the value to NULL. This would be silly, and any serious implementation of Pthreads will violate the standard in this respect. Of course, the standard will be fixed, probably by the 1003. ln amendment (assorted corrections to 1003. 1c-1995). but that will take a while.

· #5

The DCE threads user-mode scheduler can usually be ported to new operating systems in a few days, involving primarily new assembly language for the register context switching routines. We use the motto "Some Assembly Required."

· #6

The algorithm (and most of the code) for susp.c was developed by a coworker of mine, Brian Silver. The code shown here is a simplified version for demonstration purposes.

· #7

I always like to define magic numbers using hexadecimal constants that can be pronounced as English words. For barriers, I invented my own restaurant called the "DB cafe," or, in C syntax, Oxdbcafe. Many interesting (or at least mildly amusing) English words can be spelled using only the letters a through f. There are even more possibilities if you allow the digit 1 to stand in for the letter 1. and the digit 0 to stand in for the letter o. (Whether you like the results will depend a lot on the typeface in which you commonly read your code.)

· #8

For historical reasons, the function is called cma_debug. Should you find yourself stuck with DCE threads code, try calling it, and enter the help command for a list of additional commands.

· #9

My daughter had this figured out by the time she was three — when she wanted to race, she told me ahead of time whether my job was to win or lose. There's really no point to leaving these important things to chance!

· #10

Digital UNIX and Solaris both (incorrectly) place the definition in <pthread.h>. The UNIX 98 brand will require that they be fixed.

· #11

DCE threads implemented fast mutexes much like the definition of XSH5 normal mutexes, with no error checking. This was not, however, specification of intent.

----

Оглавление книги


Генерация: 0.094. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз