(OT) Threads

Where can I get information about threads? I have seen on this list that
you use them for keeping isolated both program code and sound code, etc.
All I know -or think I know- about threads is that they are the replacement
for the old fork() system call.

Alberto

Alberto Luaces wrote:

Where can I get information about threads? I have seen on this list that
you use them for keeping isolated both program code and sound code, etc.
All I know -or think I know- about threads is that they are the replacement
for the old fork() system call.

Alberto

Threads basically allow multiple parts of the same program to execute
simultaneously, while sharing the same global variables, file handles,
etc. In a sense, a thread is an asynchronous procedure call.
They’re really pretty simple - you just have to make sure that two
threads don’t try to access the same data at once. That’s the purpose of
semaphores.
The fork() call actually splits the program into two separate programs
with separate global variables.

I don’t know of any online resources for threads. O’Reilly publishes a
good book about the POSIX threads (pthreads) API. I’m sure you could
find some useful information on the web.

-John

“John R. Hall” wrote:

Where can I get information about threads? I have seen on this
list that you use them for keeping isolated both program code
and sound code, etc. All I know -or think I know- about threads
is that they are the replacement for the old fork() system call.

The fork() call actually splits the program into two separate programs
with separate global variables.

Simple explanation for the fork()-knowing people: threads share their
memory, forked processes don’t.–
“World domination. Fast.” – Linus Torvalds

The fork() call actually splits the program into two separate programs
with separate global variables.

Simple explanation for the fork()-knowing people: threads share their
memory, forked processes don’t.

And if you really want your head to spin, try “man 2 clone” on Linux =)

(Linux’s threading model is extremely flexible; with the clone interface you
can choose whether or not to share memory, file descriptors, pid…)

Dan

Dan Maas wrote:

Simple explanation for the fork()-knowing people: threads share their
memory, forked processes don’t.

And if you really want your head to spin, try “man 2 clone” on Linux =)

(Linux’s threading model is extremely flexible; with the clone interface you
can choose whether or not to share memory, file descriptors, pid…)

I used clone when there was no man-page and pthread was being updated to
use it. ;-)–
/* you are not expected to understand this */
– from the UNIX V6 kernel source