This is a discussion on Unix PIDS on AIX within the AIX Operating System forums, part of the Unix Operating Systems category; --> I'm currently porting a large 'C' application from a Sequent platform (Dynix 4.4.7) to IBM AIX 5.2. The application ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm currently porting a large 'C' application from a Sequent platform (Dynix 4.4.7) to IBM AIX 5.2. The application maintains a 30000 entry array which is used to store the status of pid processes running on the system. The states of these processes change depending on the activity of the process. However the AIX system uses pids in the range 1 to ~4000000000. Clearly I can't maintain such a large array in my system and need to find some way of managing the problem. The question I have is can the AIX kernel be configured so that it will generate pids only in the range 1 to 30000 and therefore function in a similar way to most other Unix systems. I have aked a number of people about this even some from IBM and have not yet had a satisfactory answer. I'm hoping someone here can provide a definitive answer. thanks |
| |||
| In article <5f345ea8.0401190627.43959786@posting.google.com >, Vince Clarke <vincentfclarke@ntlworld.com> wrote: > I'm currently porting a large 'C' application from a Sequent platform > (Dynix 4.4.7) to IBM AIX 5.2. > > The application maintains a 30000 entry array which is used to store > the status of pid processes running on the system. The states of these > processes change depending on the activity of the process. However the > AIX system uses pids in the range 1 to ~4000000000. Clearly I can't > maintain such a large array in my system and need to find some way of > managing the problem. Why not? 0 to 4.2 billion can be represented as a single unsigned 32-bit integer as a 'long' in C... I don't know the size of the array members, but the process ID for 30,000 entries would be one 32-bit longword which would occupy about 117KB of RAM alone, which doesn't seem bad. Even if a single array member was about 30 bytes total times 30,000, that's still only 3.5 MB of RAM total... You don't need to have it as array[pid]; it would be far more memory efficient to maintain it as a singly or doubly-linked list, which isn't hard or slow to traverse, especially if structured via binary tree insert, traversal, or delete functions. -Dan |
| ||||
| Dan Foster wrote: > You don't need to have it as array[pid]; it would be far more memory > efficient to maintain it as a singly or doubly-linked list, which isn't > hard or slow to traverse, especially if structured via binary tree insert, > traversal, or delete functions. > > -Dan Indeed. Sounds like the orignal design (assuming 30,000 at most, and using fix-sized arrary) is bad. Vince Clarke wrote: > The question I have is can the AIX kernel be configured so that it > will generate pids only in the range 1 to 30000 and therefore function > in a similar way to most other Unix systems. I have aked a number of > people about this even some from IBM and have not yet had a > satisfactory answer. I'm hoping someone here can provide a definitive > answer. The answer is no. |