From owner-freebsd-hackers Fri Nov 20 19:36:33 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA03024 for freebsd-hackers-outgoing; Fri, 20 Nov 1998 19:36:33 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp04.primenet.com (smtp04.primenet.com [206.165.6.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA03019 for ; Fri, 20 Nov 1998 19:36:31 -0800 (PST) (envelope-from tlambert@usr08.primenet.com) Received: (from daemon@localhost) by smtp04.primenet.com (8.8.8/8.8.8) id UAA22320; Fri, 20 Nov 1998 20:36:01 -0700 (MST) Received: from usr08.primenet.com(206.165.6.208) via SMTP by smtp04.primenet.com, id smtpd022267; Fri Nov 20 20:35:57 1998 Received: (from tlambert@localhost) by usr08.primenet.com (8.8.5/8.8.5) id UAA09506; Fri, 20 Nov 1998 20:35:51 -0700 (MST) From: Terry Lambert Message-Id: <199811210335.UAA09506@usr08.primenet.com> Subject: Re: SYSV Semaphores & mmap problems To: DBECK@ludens.elte.hu (David Beck) Date: Sat, 21 Nov 1998 03:35:51 +0000 (GMT) Cc: tlambert@primenet.com, freebsd-hackers@FreeBSD.ORG In-Reply-To: from "David Beck" at Nov 20, 98 10:00:31 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > I ran into two problems with FreeBSD: > > > 1., If I create a program with a few threads and then I block > > > one thread with a SYSV semaphore, then it blocks all threads. > > > Any ideas ? > > > > Use a mutex instead. SYSV semaphores are not process reentrant > > (they're semaphores). Neither are pthreads mutexes, but at > > least you will only block threads wanting the mutex instead of > > all threads. > > Yep. The problem is to control access to a shared memory segment > between unrelated processes and in the same time the server process > actually is a multithreaded process. Use fcntl(2) based locks. Preferrably against an mmap'ed file as the shared memory region instead of a SYSV shared memory region, to avoid using up kernel virtual address space. Alternately, someone need to write a non-blocking version of the system call and implement call conversion in a (new) libipc_r. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message