Re: User-level threads and preemption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 23, 2002 at 06:51:42AM +0530, Sridhar N wrote:
> On Monday 22 April 2002 05:02 am,  Erik Mouw wrote:
> > > 	If one userspace thread is doing a system call and is pre-empted, can
> > > the process execute another of its own thread  that also executes a
> > > system call ?
> >
> > Sure, why not? Threads and processes are almost the same on linux, so
> > if a process can be preempted, a thread can also be preempted.
> 
> Sorry, i suppose i didn't say it right.  I wasn't talking about the threads
> that you create using a system call ( eg. clone() ), but i was referring to
> user-space libs ( like pthread,etc, )

AFAIK pthread DOES call clone. Most of the libraries does, because it's
easier and more reliable. The pure user-space thread libraries are often
cooperative, so they can't. When they preempt (using a signal), the
signal delivery is either delayed after the syscall returns, or the
syscall is failed (with ERESTARTSYS) andautomatically restarted IF the
handler returns with return. However I don't know the actual stack
layout so I'm not sure it will work if you switch the stacks (it seems
everything is done on user-mode stack, so it should).

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux