From owner-freebsd-hackers Mon Nov 23 00:45:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA16269 for freebsd-hackers-outgoing; Mon, 23 Nov 1998 00:45:38 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from faber.elte.hu (faber.elte.hu [157.181.78.1]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id AAA16264 for ; Mon, 23 Nov 1998 00:45:31 -0800 (PST) (envelope-from DBECK@ludens.elte.hu) Received: from ludens.elte.hu by ludens.elte.hu (MX V4.2 VAX) with SMTP; Mon, 23 Nov 1998 09:41:11 +0100 Date: Mon, 23 Nov 1998 09:40:46 +0000 From: David Beck To: Terry Lambert CC: tlambert@primenet.com, freebsd-hackers@FreeBSD.ORG Subject: Re: SYSV Semaphores & mmap problems In-Reply-To: <199811210335.UAA09506@usr08.primenet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 21 Nov 1998, Terry Lambert wrote: > Date: Sat, 21 NOV 1998 03:35:51 +0000 (GMT) > From: Terry Lambert > To: David Beck > Cc: tlambert@primenet.com, freebsd-hackers@FreeBSD.ORG > Subject: Re: SYSV Semaphores & mmap problems > > > > > 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. > Thank you. The sysv semaphore seems fairly slow on other systems, anyway. Do you know is fcnt faster ? Regards, David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message