Problem solve Get help with specific problems with your technologies, process and projects.

Synchronizing kernel threads

Two questions:

  • One: How do you achieve synchronization between kernel threads that access common structure(s)?

  • Two: Can we assign a kernel thread to run on a selected processor on SMP machines?

  • Whoa, kernel programming questions. I haven't spent much time hacking threads in the kernel source, so I'm not the right expert. My understanding is that even the 2.6 kernel does not support genuine real-time scheduling yet. Real time scheduling allows a single thread to grip onto a CPU and not be interrupted, ever. So the answer to your second question is NO if you're trying to grip a CPU permanently. Of course, since you have the source, anything is in theory possible -- it might be too much effort to justify, though.

    To synchronise two kernel threads, just use any synchronisation technique, like a semaphore and/or signal. A crude solution if one of your threads is time-dependant and you have multiple CPUs is to use a spinlock to keep one thread busy until circumstances change. That solution is bad for user-level performance, though.

    This was last published in May 2004

    Dig Deeper on Linux servers



    Find more PRO+ content and other member only offers, here.

    Have a question for an expert?

    Please add a title for your question

    Get answers from a TechTarget expert on whatever's puzzling you.

    You will be able to add details on the next page.

    Start the conversation

    Send me notifications when other members comment.

    By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

    Please create a username to comment.