Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, If I define a new variable in kernel (e.g. sched.c) codes, I want a user space thread (pthread) can read the value of this variable. What is the best ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2014
    Posts
    4

    user space pthread application read a variable changed by kernel


    Hi,

    If I define a new variable in kernel (e.g. sched.c) codes,
    I want a user space thread (pthread) can read the value of this variable.

    What is the best way (faster and low overhead) to implement it,
    either creating a new /proc file or defining some system calls?


    Thanks,

    Jeff

  2. #2
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,293
    Without knowing what you are planning on doing I'd say using the proc filesystem is easier. Changes to the kernel require you to recompile it and reboot to see the changes. That includes adding a system call. On the other hand you can write to the proc filesystem using an lkm which can be dynamically loaded.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •