Can we control the maximum values of Process ID's and Thread ID's in Qnx Neutrino 7.x OS?

78 Views Asked by At

What are the maximum possible values for Process ID and Thread ID's in QNX. Is there a way to configure the maximum Process ID and Thread ID limits in the QNX Neutrino 7.x OS? I'm trying to figure out how much flexible it is. Thanks.

1

There are 1 best solutions below

0
zakuarbor On

DISCLAIMER: I have no access to QNX

Based on the documentation, gettid() and getpid() which retrieves to tid and pid respectively returns an int. So we can infer the max TID and PID is at most the highest value of int (look at limits.h since it differs depending on your architecture) but it can very well be less than that. Keep in mind that tid are unique and system wide from my understanding. pid_t is also something we could look at which is defined as int32 (i.e. sys/target_nto.h from what I could find on a public github).

In addition, there are default limits to how many threads a process can have which can be retrieved or set with rlimit (getrlimit, setrlimit, prlimit) by setting RLIMIT_NTHR. You can also dictate the limit on how many processes can be spawned (RLIMIT_NPROC). If you are executing a process via commandline, maybe on utility might be something interesting to look at

According to the documentation, each process can only have 32767 threads and only 4094 processes can be active at any time. Though I do not know how many processes can actually be created.

On another note, you can control threads in a process such as setting its limit using thread pools by setting the thread pool attribute maximum and setting other attributes like lo_water to something. I don't have QNX nor have I fiddled around thread pools but I thought I would mention it. There is an example in the documentation you could check out.

Also someone's answer: Maximum value of the PID in QNX