How to get tid of kernel threads?

This is a discussion on How to get tid of kernel threads? within the C Programming forums, part of the General Programming Boards category; Hi, when I make a new program it gets a certain process id(PID), I can get this using getpid(). Then ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    47

    How to get tid of kernel threads?

    Hi, when I make a new program it gets a certain process id(PID), I can get this using getpid().

    Then I create a thread which have a thread ID, inside the process, a TID., I can get this also, pthread_self() and also the TID is returned when a thread is created.

    BUT, when the scheduler is scheduling it schedules threads, kernel threads. How do I get this TID? that is the kernel thread ID of the threads I create in my process? How to get it?


    I'm working in Solaris and Linux.

    thanks
    /Micke

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What do you need it for?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    47
    What to do a user-space scheduler. That is I will have one daemon that other programs can register their threads to for scheduling.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Doesn't that really mean that you will have to "keep" all the threads yourself, or are you planning to use some sort of "suspend_thread()", "unsuspend_thread()" mechanism, and to do that you need the actual internal thread ID?

    Perhaps you can find some information inside the pthreads library itself?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Oct 2007
    Posts
    47
    No, the threads will register to this daemon and then this daemon will change their priorities based upon the algorithm of choice. The daemon itself will have the highest priority and sleep at given intervals letting other threads run.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 10-17-2008, 11:28 AM
  2. Parallelism
    By cerin in forum Tech Board
    Replies: 17
    Last Post: 06-01-2007, 11:14 PM
  3. CreateThread ?!
    By Devil Panther in forum Windows Programming
    Replies: 13
    Last Post: 11-15-2005, 09:55 AM
  4. problem with win32 threads
    By pdmarshall in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2004, 02:39 PM
  5. Block and wake up certain threads
    By Spark in forum C Programming
    Replies: 9
    Last Post: 06-01-2002, 03:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21