From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4943 invoked by alias); 14 Feb 2008 11:00:09 -0000 Received: (qmail 4935 invoked by uid 22791); 14 Feb 2008 11:00:08 -0000 X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (83.160.170.119) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 14 Feb 2008 10:59:51 +0000 Received: from dijkstra.wildebeest.org ([192.168.1.29]) by gnu.wildebeest.org with esmtp (Exim 4.63) (envelope-from ) id 1JPboi-0002E8-2X; Thu, 14 Feb 2008 11:59:48 +0100 Subject: Re: "int pid" replaced with ProcessIdentifier From: Mark Wielaard To: Andrew Cagney Cc: frysk In-Reply-To: <47AB291E.4010004@redhat.com> References: <47AB291E.4010004@redhat.com> Content-Type: text/plain Date: Thu, 14 Feb 2008 11:00:00 -0000 Message-Id: <1202986787.3365.29.camel@dijkstra.wildebeest.org> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-1.fc8) Content-Transfer-Encoding: 7bit X-Spam-Score: -4.3 (----) X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2008-q1/txt/msg00069.txt.bz2 Hi Andrew, On Thu, 2008-02-07 at 10:51 -0500, Andrew Cagney wrote: > I've pushed a low-level change so that frysk.sys's process code uses a > ProcessIdentifier object instead of "int pid"s; there is one > ProcessIdentifier per "pid". The change is slowly working its way > through frysk.proc.live; it won't be taken further. > > The motivation is simple, while "int pid" looks small and efficient; it > turns out that the code using it really needed an object (leaking > something like <>) to either log or hash the pid. > With a proper object both of these cases can be greatly simplified. I looked of some of the changes here and it looks somewhat inefficient, and very verbose, because it basically replaces everything that already has a pid int with a call to ProcessIdentifierFactory.create(pid). A lot of these int pids seems to come from Proc.getPid(), which in turn is a wrapper for ProcId.hashCode() where the hashCode() of a ProcId is indeed the int representation of the pid of the Proc. So why not just use ProcId as process identifier for a Proc since that is already bound to a Proc object? Or the other way around and do away with ProcId and use ProcessIdentifier instead of ProcId. It seems confusing to now have 3 ways to identify a process int pid, ProcId and ProcessIdentifier (4 if you also count TaskId since I saw also code like ProcessIdentifierFactory.create(this.process.getMainTask().getTid())). Cheers, Mark