Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp296281rdb; Sun, 14 Jan 2024 18:21:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEb+NHS5eMxMwELegs4aWDYPYqKdb8AO5NF0G+tBpniyJzfM/Q0EgWxa+AsansAbxk3nDnp X-Received: by 2002:ac8:4e4b:0:b0:429:f43d:6e55 with SMTP id e11-20020ac84e4b000000b00429f43d6e55mr709044qtw.30.1705285280013; Sun, 14 Jan 2024 18:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705285280; cv=none; d=google.com; s=arc-20160816; b=H6t3NgPIIPwf4FAZX8R5EyA02+Iz5lnkIC8bEbAj4/pRbkXetVcrxfSV/YCYWUUKzc qsVd/6rptTnxXhyTZVzzI1WerSDQCfU1uIvnmQtTviAeFJgv+tLP48XILXs3fGssPXjV fmRpn+Ma370fmw99KmAla/fuMrWgPMrrM2naYzRhhLhAGK+TeZf813NfO7UcD+eAxPJR rW65fimvX6TeD/7Ia656lnnv3ewxwPL3i9i8mqALSIfen0tH8TK4kIuAsvH4RdQbht7w Tr1Di1MEPu1VffK3aCe+c832k31y75Ip4kFhkTDnO4YmuqRZyvDBY4UHPH0QmW73FhkC neFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=f301jTlzmXgt/BHSNbW6U8sczL1QEs2MM14C4viJ3F4=; fh=kI+Y+9q0GGqQwC7ftc0br2s/bLq+mmzRSrqjGLXtT2w=; b=wNDdAzvYlxkk3CPw7OobKFdQ8FKkGfoKnUCvZAm1bD0wbNuDrx/mGNUb/mrqg9kB4B buG/p/2hT+aFqBMJnqvGImaJBQ6Cep2QtRLmSJ1ag1xDb06eSA3HIk3VHh183U75qvQ0 IPIs2NHaK4GZz4/Y6WPWloO4l38XJZrwSZVECE6Hg7vb7U07NDtR0z0nxglRvhAnjavW ace9hoHeHGNxrxZyfp7lMNH3xh/eL6wVNnFTpDBkOotHIoCwaIsFF04LsykbyWfiqy/f MXJDB9yf1VwkPSSU2FZ3dlQV/vL1wmg/PuTJQssovhtaU/wy3q5uqsfW6uBfEylP8bz1 cC9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m16-20020a05622a055000b0042988ff2287si7187388qtx.737.2024.01.14.18.21.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 18:21:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C14881C20929 for ; Mon, 15 Jan 2024 02:21:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4312C20F7; Mon, 15 Jan 2024 02:21:08 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id 2E51C1FAA for ; Mon, 15 Jan 2024 02:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netrider.rowland.org Received: (qmail 706546 invoked by uid 1000); 14 Jan 2024 21:20:59 -0500 Date: Sun, 14 Jan 2024 21:20:59 -0500 From: Alan Stern 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 Subject: Re: Why does Linux not implement pthread_suspend() and pthread_resume()? Message-ID: <5d1b969d-6c0a-4077-87ee-e41ab164fa3b@rowland.harvard.edu> References: <0219492d-3971-f8e0-8b46-22d442a2d442.ref@yahoo.de> <0219492d-3971-f8e0-8b46-22d442a2d442@yahoo.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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