From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a52626a9019b830 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Received: by 10.224.27.14 with SMTP id g14mr3854761qac.1.1347091700119; Sat, 08 Sep 2012 01:08:20 -0700 (PDT) Received: by 10.236.201.134 with SMTP id b6mr1271510yho.15.1347091700099; Sat, 08 Sep 2012 01:08:20 -0700 (PDT) Path: da15ni1572qab.0!nntp.google.com!b19no50987qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 8 Sep 2012 01:08:19 -0700 (PDT) In-Reply-To: <3b3a796d-50e0-4304-9f8d-295fb2ed0e82@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=46.195.16.161; posting-account=3_reEwoAAAC163IAIrx427KYmwahFuh9 NNTP-Posting-Host: 46.195.16.161 References: <3b3a796d-50e0-4304-9f8d-295fb2ed0e82@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <777c2c71-c12b-446e-8683-c9f92a3355c6@googlegroups.com> Subject: Re: Help writing first daemon From: =?ISO-8859-1?Q?bj=F6rn_lundin?= Injection-Date: Sat, 08 Sep 2012 08:08:20 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-09-08T01:08:19-07:00 List-Id: Den l=F6rdagen den 8:e september 2012 kl. 00:05:52 UTC+2 skrev Patrick: > Hi Everyone >=20 > I am setting out to write my first daemon. There seems to be a lot of opt= ions for inter-process communication on posix systems. I am planning on des= igning a scientific instrument control server that will control ports, like= the serial port, based on signals it is sent. It will also collect data fr= om instruments and store the data(I was thinking in a postgresql database). >=20 This fits the description of the system I work on nicely, but it is delaing with material handling equipment though. But=20 middleware <-> I/O process <-> device=20 is the same.=20 > Does FIFO/names pipes sound reasonable for this sort of thing? I am conce= rned that with many commands acting on the daemon there will be too much ov= erhead with these commands creating file handlers. >=20 we use named pipes on Linux and shared memory/semaphores on AIX Windows has something like memory mapped files. I did the pipes implementation, and it actually works on posix ystem, and w= ith small adjustemens on windows too. Every process/daemon started has an enviremonet variable PROCESS_NAME -=20 withch also is the name of the pipe. This makes it easy for the sending pro= cess to find the pipe it wants > I am also going to control instruments over Ethernet anyways so would inv= esting time in socket >programming solve two problems by making it a socket= based server? Once the socket is set up by the >daemon, the smaller "satel= lite" commands would not need as much overhead to connect to a port as >the= y would to create a file handler, would they? Sockets works basically the same for posix/windows. There is a socket binding bundled with gnat.=20 There is AdaSockets. This is an eays way, and since you already know that you will use sockets, the choise would be easy. Let the children (if manny) connect to the parent, and there is only 1 port= to remember. > Lastly, this will be done in Ada where ever possible,=20 >is there an Ada oriented way to do this sort of thing? Perhaps the distributed annex? But I would find it easier to use socket directly -- Bj=F6rn Lundin