From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751939AbZHZQWr (ORCPT ); Wed, 26 Aug 2009 12:22:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751796AbZHZQWq (ORCPT ); Wed, 26 Aug 2009 12:22:46 -0400 Received: from gate.lvk.cs.msu.su ([158.250.17.1]:49313 "EHLO lvk.cs.msu.su" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742AbZHZQWp (ORCPT ); Wed, 26 Aug 2009 12:22:45 -0400 X-Greylist: delayed 1234 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 Aug 2009 12:22:45 EDT From: "Nikita V. Youshchenko" To: linux-kernel@vger.kernel.org Subject: Suspend one thread and resume another in one system call ? Date: Wed, 26 Aug 2009 20:02:05 +0400 User-Agent: KMail/1.9.9 Cc: Stas Bezzubtsev MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908262002.06209@zigzag.lvk.cs.msu.su> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. Consider a situation when: - there is a set of threads, - only one of those should be allowed to work at a time, - there are "switch moments" when one thread should suspend, and other (known) resume. "Classic" solutions like have each thread sleeping on a semaphore, and making switch operation "sem_post(next_sem); sem_wait(my_sem)" cause two syscalls per switch. Could anyone suggest a solution with only one kernel entry per switch - running thread enters kernel and is de-scheduled, new thread resumes and leaves kernel? Nikita P.S. Since there are other threads in the same application working in the parallel with the mentioned "exclusive set", user-space solutions like libpth are not interesting.