From owner-freebsd-questions Mon Sep 28 17:24:32 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA03262 for freebsd-questions-outgoing; Mon, 28 Sep 1998 17:24:32 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from VMS.UCI.KUN.NL (vms.uci.kun.nl [131.174.64.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA03250 for ; Mon, 28 Sep 1998 17:24:19 -0700 (PDT) (envelope-from K.Staring@UCI.KUN.NL) Received: from uci.kun.nl (ops4.uci.kun.nl) by VMS.UCI.KUN.NL (PMDF V5.1-10 #8798) with ESMTP id <01J2D26627I8000P4D@VMS.UCI.KUN.NL> for questions@freebsd.org; Tue, 29 Sep 1998 02:24:06 +0200 (MET-DST) Date: Tue, 29 Sep 1998 03:24:04 +0200 From: Purrcat Subject: shared mem between parent & child To: questions@FreeBSD.ORG Reply-to: K.Staring@UCI.KUN.NL Message-id: <361036B3.FCE6DA8F@uci.kun.nl> Organization: Universitary Center for Informationprovision MIME-version: 1.0 X-Mailer: Mozilla 4.03 [nl] (Win95; I) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, Is there any way that I can share an int between a parent process and some child processes? I'm writing a program which must do about this: the children (created by a fork of course) increase a shared integer variable when they're busy, and when they're not busy anymore, decrease the shared integer with 1. The parent makes some non-educated guesses about this; when all children are busy, the parent forks some more to create some leeway.. I think I can do this with a shared variable (if this kind of thing exists anyway).. If there's no such thing as a 'shared variable', could it be done in another way (like stdin and stdout or something?) thanx for the repy if you should decide to.... -- Khamba Staring "Windhose NT can be run by any idiot, and it usually is too..." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message