Re: Any resources about threading problems?

2005-03-05 Thread Mike Hearn
On Fri, 04 Mar 2005 08:52:44 -0800, Bill Medland wrote:
> OK.  So I've spent over a week mulling over all this and I think I am 
> beginning to see the light, but I find our  description confusing, primarily 
> due to confusion over terminology.  I'd like to tighten it up and so I would 
> appreciate it if someone who knows this stuff can confirm I have understood 
> it correctly.
> 
> The source of a lot of my confusion is terminology.
> 
> pthread (or occasionally Pthread) is more normally used as a short name for 
> the Pthreads section of the POSIX standard, and is therefore a specification, 
> not an implementation.  We frequently use it to mean both the specification 
> and any implementation that correctly implements the specification (such as 
> the NPTL and not Linuxthreads)

We use it to mean that Wine is calling into libpthread for its threading
services. Because both NPTL and LinuxThreads provide the libpthread API,
they are both considered to be "pthread" implementations, even though Wine
can only actually use one of them (NPTL).

> kthread has many meanings.  It is sometimes a short name for a kernel
> thread (an object in the kernel).  Sometimes it refers to a simple
> threading package with a very non-pthreads api, used in various computer
> science classes around the world.  I still don't understand what it
> means in our documentation, but I presume it means LinuxThreads, LWP or
> any other threading implementation that does not correctly implement the
> pthread api.

It means we implement threading based on the underlying kernel thread
primitives (clone on linux), eg without the help of libpthread.
 
> We talk about overriding the native pthreads library.  Do we always
> override it or is it only wine-kthread that overrides it?  

Only wine-kthread overrides it. Wine-pthread uses the systems native
libpthread implementation.

> My understanding is that if the underlying pthreads implementation
> correctly implements pthreads then it is not overridden; we only
> override it if the pthreads implementation is incorrect (e.g. if the
> implementation is Linuxthreads), and it only does so for the wine
> processes.
> 
> Is that all correct?

Yes, pretty much.

> (Then there's the whole question of when pthreads means the pthreads
> specification, when it means the Linuxthreads implementation and when it
> means the NPTL implementation.  If I have the above correct then I can
> patch up 8.1.5.3 and people can review the patch)

In this context, "pthreads" refers to any implementation of the libpthread
API, even LinuxThreads. Feel free to make it clearer though ...

thanks -mike




Re: Any resources about threading problems?

2005-03-04 Thread Bill Medland
On February 23, 2005 10:41 am, Mike Hearn wrote:
> On Wed, 23 Feb 2005 09:30:50 -0800, Bill Medland wrote:
> > Does anyone know any site or book or something with a decent discussion
> > about the problems of the different threading models and their
> > implementations?
>
> That'd be the developers guide ;)

Yes, it looks like it is on the way to becoming a canonical reference

>
> > In the Developer's Guide in section 8.3 there are references to "the
> > threading chapter".  Is this a section that has not yet been written?
>
> It was written, and then the developer guide was reorganised and a ton of
> content was moved around. It's now under "NTDLL", which IMHO isn't very
> intuitive but I didn't reorganise it so I would say that :)
>
> http://winehq.com/site/docs/wine-devel/c2749#NTDLL
>
> > As I understand it we (in the pthreads version) "override the native
> > pthreads library".  What does this mean?
>
> It's explained at the above URL.
>
> thanks -mike

OK.  So I've spent over a week mulling over all this and I think I am 
beginning to see the light, but I find our  description confusing, primarily 
due to confusion over terminology.  I'd like to tighten it up and so I would 
appreciate it if someone who knows this stuff can confirm I have understood 
it correctly.

The source of a lot of my confusion is terminology.

pthread (or occasionally Pthread) is more normally used as a short name for 
the Pthreads section of the POSIX standard, and is therefore a specification, 
not an implementation.  We frequently use it to mean both the specification 
and any implementation that correctly implements the specification (such as 
the NPTL and not Linuxthreads)

kthread has many meanings.  It is sometimes a short name for a kernel thread 
(an object in the kernel).  Sometimes it refers to a simple threading package 
with a very non-pthreads api, used in various computer science classes around 
the world.  I still don't understand what it means in our documentation, but 
I presume it means LinuxThreads, LWP or any other threading implementation 
that does not correctly implement the pthread api.

NPTL (Native POSIX Thread Library for Linux) is an implementation of the 
pthread interface for the Linux operating system.  It is the replacement for 
Linuxthreads and is designed so that it can conform to the standard, 
especially in areas where Linuxthreads does not.

Linuxthreads is "a simple clone()-based implementation of Posix threads for 
Linux".  However, being simple, it fails to conforn to the standard in 
several areas.  Major packages have worked around these failures in the past.

LWP is (for us) the lightweight process library, a library handling 
multithreading primarily on SunOS, through its own api.  This is not actually 
relevant to our high-level description.

We talk about overriding the native pthreads library.  Do we always override 
it or is it only wine-kthread that overrides it?  My understanding is that if 
the underlying pthreads implementation correctly implements pthreads then it 
is not overridden; we only override it if the pthreads implementation is 
incorrect (e.g. if the implementation is Linuxthreads), and it only does so 
for the wine processes.

Is that all correct?

(Then there's the whole question of when pthreads means the pthreads 
specification, when it means the Linuxthreads implementation and when it 
means the NPTL implementation.  If I have the above correct then I can patch 
up 8.1.5.3 and people can review the patch)

-- 
Bill Medland
mailto:[EMAIL PROTECTED]
http://webhome.idirect.com/~kbmed




Re: Any resources about threading problems?

2005-02-23 Thread Mike Hearn
On Wed, 23 Feb 2005 09:30:50 -0800, Bill Medland wrote:
> Does anyone know any site or book or something with a decent discussion about 
> the problems of the different threading models and their implementations?

That'd be the developers guide ;)
 
> In the Developer's Guide in section 8.3 there are references to "the 
> threading 
> chapter".  Is this a section that has not yet been written?

It was written, and then the developer guide was reorganised and a ton of
content was moved around. It's now under "NTDLL", which IMHO isn't very
intuitive but I didn't reorganise it so I would say that :)

http://winehq.com/site/docs/wine-devel/c2749#NTDLL

> As I understand it we (in the pthreads version) "override the native
> pthreads library".  What does this mean?

It's explained at the above URL.

thanks -mike




Any resources about threading problems?

2005-02-23 Thread Bill Medland
Does anyone know any site or book or something with a decent discussion about 
the problems of the different threading models and their implementations?

In the Developer's Guide in section 8.3 there are references to "the threading 
chapter".  Is this a section that has not yet been written?

As I understand it we (in the pthreads version) "override the native pthreads 
library".  What does this mean?

I am trying to research the issues associated with threading so that I 
understand the complications.  The fact that Linux has two models and that 
Wine, FreeDCE and Samba (that I know of) seem to have found it necessary to 
bypass/hack/modify/override them indicates to me that there is something to 
understand.

-- 
Bill Medland
mailto:[EMAIL PROTECTED]
http://webhome.idirect.com/~kbmed