Re: User-level threads and preemption

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

 



Hi,

There can be 2 modes of user level threads. 1-1 mapping or N-1 mapping 
to the proc or LWP structure.
As far as we have 1-1 mapping we can have more than 1 thread running. 
If it is N-1 mapping then the scheduling of the thread will be done in
the userspace by the threads algorithms and all the threads will 
timeslice to use the same process structure. Now if one thread has 
slept in the kernel and cannot be timesliced then the other threads may 
starve but they have lots of workaround for the same.

Linux has 1-1 mapping i.e through the clone system call and hence safe 
for your scenario.

Thanks,
Sumit

----- Original Message -----
From: Jan Hudec <bulb@ucw.cz>
Date: Tuesday, April 23, 2002 2:39 pm
Subject: Re: User-level threads and preemption

> 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'seasier 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/
> 
> 
begin:vcard
n:Agarwal;Sumit
fn:Sumit Agarwal
tel;cell:+919845205210
tel;fax:+91-80-5732696
tel;home:+919845205210
tel;work:+91-805732296 / 93 extn. 5243
url:www.wipro.com
org:Wipro Technologies;SIDC, Embedded and Internet Division
adr:;;Wipro Technologies, Chamundi Complex, No.26, Hosur Main Road, Bommanahalli;Bangalore;Karnataka;560068;INDIA
version:2.1
email;internet:sumit.agarwal@wipro.com
title:Senior Software Engineer
end:vcard


**************************Disclaimer************************************
Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.
********************************************************************

[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