From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 4 00:07:25 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0762016A41C for ; Sat, 4 Jun 2005 00:07:25 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9951243D1F for ; Sat, 4 Jun 2005 00:07:24 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.4/8.13.4/NETPLEX) with ESMTP id j5407NdB018562; Fri, 3 Jun 2005 20:07:23 -0400 (EDT) Date: Fri, 3 Jun 2005 20:07:23 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Aziz Kezzou In-Reply-To: <3727392705060316555071c4ad@mail.gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: freebsd-hackers Subject: Re: Fork mystries.... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2005 00:07:25 -0000 On Fri, 3 Jun 2005, Aziz Kezzou wrote: > Hi all, > It's probably not the right mailing list to ask but I am really > surprised about global variable sharing in a multithreaded C > application. If I remember well my multithreading course global > variables are shared between threads, right ? Uhh, fork() creates a process, not a thread. The child is a _copy_ of the parent; they do not share address space. See the man page for fork. If you want really want threads, use threads (see man page for pthread). -- DE