Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I want to do some floating point operations in the Linux Scheduler/Kernel. Is it possible to do so because I read somewhere it doesn't work. Please Suggest. Thanks...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    10

    Floating Point Operations in the Scheduler/Kernel Code


    Hi all,

    I want to do some floating point operations in the Linux Scheduler/Kernel. Is it possible to do so because I read somewhere it doesn't work.

    Please Suggest.

    Thanks

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,574
    From another forum site:
    Quote Originally Posted by Gilad Ben-Yossef
    Iím afraid you are out of luck- floating point operations are not supported inside the Linux kernel mode, although of course they are supported in user space programs runinning on Linux.

    One of the main reasons for this lack of support is that it enables the Linux kernel to not need to save and restore the floating point unit registers on each system call and back, which in turns enables a faster context switch.

    What this means is that even if you overcome this warning (which is basically there to help detect erronous use of floating point in kernel code) and even though you have an FPU, using FPU instructions in the kernel will trash the user space programs FPU registers.

    And, adding the required code in the scheduler to do save the FPU registers will make all the system call slower, so it will actually slow down your user programs.

    I recommend thinking about a way to deligate the operations which require floating point operations to user space.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Feb 2010
    Posts
    10
    Hi all,

    Just wanted to know that if I want to use abs() function of C in Linux Kernel, what files do I need to include.
    Is it linux/stdlib.h or something else?

    Waiting for your replies.

    Thank You

  4. #4
    Just Joined!
    Join Date
    Jul 2009
    Posts
    49

    abs()...

    Can be found in "kernel.h". Don't be including /usr/include files into the kernel. Please acquaint yourself with the kernel API before starting to wildly include user space files into your kernel space code.

    Have a look around the kernel source "Documentation" directory and perhaps give a try at generating the kernel api docs. It's not difficult and will give you some straight answers.

    Cheers!!

Posting Permissions

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