Hi there guys,

    I need some help in regards with thread programming on Linux. At the moment I am 
working on a scheduler which uses a number of kernel threads running on a quad 
processor system. Now I am using the clone() call to create these kernel threads  
since I require that each thread shares the same working space (if there is a 
different call please tell me about it !!!). My problem is that I need to discern 
between each kernel thread. Is there a way how to know which thread is which, yet 
still not calling a kernel function to obtain the pid (I cannot afford the long wait 
to enter the kernel since the pid would be needed quite often, also it would entail a 
semaphore block to obtain it). I was told that in the SunOS system, kernel threads 
which share the same memory (LWPs) have a section for private memory. I am under the 
impression that this does not exist on the Linux system. I hope I am wrong since it 
would be an easy task for each thread to store an identifier of itself in here.

I need each kernel thread to know itself (says its number) since I need it to store 
some information about its current state which would be different from other clone'd 
threads. I know that the real true personal resources a thread has is the processor it 
is working on, yet for several reasons I would prefer not to use one of the 
processor's registers to store an identifier. As a last resort I would consider it 
though. 

Is there maybe some one out there who can hint me on some programming trick which 
would allow me for each thread to have its personal data. I know that if after the 
clone each thread makes a malloc() call, the pointer returned would be different, yet 
how can I store it if they are using the same working space.

Hope someone can help

Thanks a lot

Joseph Cordina

-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/dmentre/smp-howto/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to