linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn@gclements.plus.com>
To: "K. Anantha Kiran" <ananth@cse.iitk.ac.in>,
	linux-c-programming@vger.kernel.org
Subject: Re: kerel level threads
Date: Wed, 25 May 2005 12:57:28 +0100	[thread overview]
Message-ID: <17044.26664.197333.797165@gargle.gargle.HOWL> (raw)
In-Reply-To: <17044.26026.165790.767334@gargle.gargle.HOWL>


Glynn Clements wrote:

> >     Point me to appropiate group if this question doesnt fit here.
> >     Does pthread_create() create kernel level threads?
> >     I have created two threads A and B. Thread A was written to print 
> > some statement in an infinite loop, while Thread B was written to be 
> > blocked for some time(I have used sleep system call to block Thread B). 
> > If at all pthread_create() creates user level threads, Blocking of 
> > Thread B will also make Thread A to be blocked.  But  in my output, 
> > Thread A was continously printing even when Thread B was blocked.  My 
> > observation is that either both of the threads be Kernel level threads 
> > or pthread library has given wrapper functions for blocking calls(for 
> > example, sleep system call in our case) which stop all of the threads to 
> > be blocked.  I read in text books that pthread libray is for creating 
> > user level threads(threads about which kernel is not aware of).
> 
> libpthread creates kernel threads.

By which I mean that the kernel creates additional "tasks" using
clone(). The new tasks have their own kernel-level data (signal masks
etc) and are scheduled by the kernel.

There are threading libraries which don't require any support from the
kernel, but are implemented entirely in user-space. That isn't how the
pthread library is implemented.

On Linux, the term "kernel thread" can also refer to threads which
execute entirely within the kernel. The pthread library doesn't have
anything to do with those.

-- 
Glynn Clements <glynn@gclements.plus.com>

      reply	other threads:[~2005-05-25 11:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-24  3:47 Good book Ram S
2005-05-24  5:06 ` lk
2005-05-25  7:08 ` kerel level threads K. Anantha Kiran
2005-05-25  9:06   ` Steven Smith
2005-05-25 11:46   ` Glynn Clements
2005-05-25 11:57     ` Glynn Clements [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17044.26664.197333.797165@gargle.gargle.HOWL \
    --to=glynn@gclements.plus.com \
    --cc=ananth@cse.iitk.ac.in \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).