Of course, I would only call getopt() once. My question was if we use TLS, 
would the memory use scale with the number of threads? Or would this memory for 
getopt() only be allocated on getopt() calls?

Yes and yes, but the memory use might be as small as a single pointer.  Per task data would be better and exists now in the OS, but we would have to implement some internal OS api's that libc could use to access it.

Another thing to consider is that the current per-task-data is protected and can only be accessed in supervisor mode.  That is not a problem for the FLAT build but might add complication to the PROTECTED build (or at least more system call overhead).

KERNEL build mode does not need per-task data at all.  It would be better if the data could just be kept in globals for KERNEL build, just as with Linux.


Reply via email to