Linux Power Management development
 help / color / mirror / Atom feed
* Re: Why does Linux not implement pthread_suspend() and pthread_resume()?
       [not found] ` <0219492d-3971-f8e0-8b46-22d442a2d442@yahoo.de>
@ 2024-01-14 14:10   ` Bagas Sanjaya
  2024-01-15  2:20     ` Alan Stern
  0 siblings, 1 reply; 2+ messages in thread
From: Bagas Sanjaya @ 2024-01-14 14:10 UTC (permalink / raw)
  To: Dr. Henning Kopp, Linux Kernel Mailing List,
	Linux Power Management
  Cc: Ulf Hansson, Rafael J . Wysocki, Greg Kroah-Hartman, Viresh Kumar,
	Thomas Gleixner, Alan Stern, Ingo Molnar

[-- Attachment #1: Type: text/plain, Size: 1553 bytes --]

[also Cc: linux-pm people]

On Sun, Jan 14, 2024 at 12:20:04PM +0100, Dr. Henning Kopp wrote:
> Hi everyone,
> 
> I have a question regarding pthreads. In particular, I was wondering why
> there is no way to suspend and resume a thread in Linux.
> 
> In Windows, there is SuspendThread() and ResumeThread() from
> processthreadsapi.h. However in Linux, there does not seem to be a similar
> function in pthread.h.
> 
> When researching this issue i found multiple ways to work around the
> inability of suspending a thread, such as using mutexes. But my question is
> why nobody bothered implementing suspending/resuming threads.
> 
> I found one answer on stackoverflow [1] that mentions that pthread_suspend
> and pthread_resume_np is in the "Unix specification", but not implemented in
> Linux. I tried to follow up on this hint and get access to the Posix spec,
> but i am not affiliated with a university anymore, so i was unable to
> download the spec.
> 
> I read "man 7 pthreads". It mentions that there are two Linux
> implementations of Posix threads, that differ in some details from the Posix
> spec. However, it does not mention suspending or resuming threads at all.

LinuxThreads and NPTL?

> 
> I hope this is the right mailing list for my question. If it is off-topic,
> please accept my apologies.
> 
> So my question is: What is the reason that Linux does not implement
> functions for suspending and resuming threads?
> 

Confused...

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Why does Linux not implement pthread_suspend() and pthread_resume()?
  2024-01-14 14:10   ` Why does Linux not implement pthread_suspend() and pthread_resume()? Bagas Sanjaya
@ 2024-01-15  2:20     ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2024-01-15  2:20 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Dr. Henning Kopp, Linux Kernel Mailing List,
	Linux Power Management, Ulf Hansson, Rafael J . Wysocki,
	Greg Kroah-Hartman, Viresh Kumar, Thomas Gleixner, Ingo Molnar

On Sun, Jan 14, 2024 at 09:10:29PM +0700, Bagas Sanjaya wrote:
> [also Cc: linux-pm people]
> 
> On Sun, Jan 14, 2024 at 12:20:04PM +0100, Dr. Henning Kopp wrote:
> > Hi everyone,
> > 
> > I have a question regarding pthreads. In particular, I was wondering why
> > there is no way to suspend and resume a thread in Linux.
> > 
> > In Windows, there is SuspendThread() and ResumeThread() from
> > processthreadsapi.h. However in Linux, there does not seem to be a similar
> > function in pthread.h.
> > 
> > When researching this issue i found multiple ways to work around the
> > inability of suspending a thread, such as using mutexes. But my question is
> > why nobody bothered implementing suspending/resuming threads.
> > 
> > I found one answer on stackoverflow [1] that mentions that pthread_suspend
> > and pthread_resume_np is in the "Unix specification", but not implemented in
> > Linux. I tried to follow up on this hint and get access to the Posix spec,
> > but i am not affiliated with a university anymore, so i was unable to
> > download the spec.
> > 
> > I read "man 7 pthreads". It mentions that there are two Linux
> > implementations of Posix threads, that differ in some details from the Posix
> > spec. However, it does not mention suspending or resuming threads at all.
> 
> LinuxThreads and NPTL?
> 
> > 
> > I hope this is the right mailing list for my question. If it is off-topic,
> > please accept my apologies.
> > 
> > So my question is: What is the reason that Linux does not implement
> > functions for suspending and resuming threads?
> > 
> 
> Confused...

These are indeed the wrong mailing lists (and people) for this question.  
These lists are dedicated to discussions about the Linux kernel.  But 
pthreads is a userspace library; it runs in user mode and is not part of 
the kernel at all.

The best approach would be to find the group responsible for writing and 
maintaining the Linux pthreads implementation (probably some subgroup 
of the people working on the GNU C library), and ask them.

Sorry I can't be of any more help.

Alan Stern


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-15  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0219492d-3971-f8e0-8b46-22d442a2d442.ref@yahoo.de>
     [not found] ` <0219492d-3971-f8e0-8b46-22d442a2d442@yahoo.de>
2024-01-14 14:10   ` Why does Linux not implement pthread_suspend() and pthread_resume()? Bagas Sanjaya
2024-01-15  2:20     ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox