comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Protected hash map (efficient programming with a protected type)
Date: Thu, 16 Nov 2017 17:50:31 -0600
Date: 2017-11-16T17:50:31-06:00	[thread overview]
Message-ID: <oul887$npo$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: oukt7t$1ifn$1@gioia.aioe.org

"Victor Porton" <porton@narod.ru> wrote in message 
news:oukt7t$1ifn$1@gioia.aioe.org...
> Process_Descriptor record consists of a process ID (an integer), two file
> descriptors (for stdin and stdout). Process descriptors may also contain 
> two
> strings: program input string (formed before the program started) and
> program output string (which is appended every time we get some output 
> from
> the program). It may contain more data.

I'm not sure I understand. In every system that I've ever used, there can 
only be one set of process descriptor information for each process ID. That 
means the other data is secondary to the process ID, and the ID alone is 
sufficient to determine the other information.

Specifically, a running process (with a particular ID) has StdIn and StdOut 
file descriptors. But there never are two copies of the same process (with 
the same ID) with different StdIn and StdOut information; those necessarily 
have to be different processes with different IDs. (Perhaps something could 
change the StdIn or StdOut file descriptors, but you wouldn't keep the old 
ones in such a case.)

Thus, I'd index the map using the process ID (which is typically a small 
integer), and use that to retrieve the other information as needed. If the 
process ID is destroyed, one needs a mechanism to remove it (and thus the 
other information) from the map. But that can be implemented with just a 
normal Delete (assuming the Map is implemented with one of the Ada 
Containers).

                                              Randy.



  parent reply	other threads:[~2017-11-16 23:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 20:42 Protected hash map (efficient programming with a protected type) Victor Porton
2017-11-16 21:00 ` Victor Porton
2017-11-16 23:50 ` Randy Brukardt [this message]
2017-11-17  0:28   ` Victor Porton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox