Q

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 first published in May 2004

    Dig deeper on Linux management and configuration

    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.

    0 comments

    Oldest 

    Forgot Password?

    No problem! Submit your e-mail address below. We'll send you an email containing your password.

    Your password has been sent to:

    -ADS BY GOOGLE

    SearchDataCenter

    SearchServerVirtualization

    SearchCloudComputing

    SearchEnterpriseDesktop

    Close