[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[altq 1118] Re: Floating point operations
Nicolas Christin wrote:
> > You are not allowed to use floating-point operations in the kernel.
> > It is a design decision; the kernel code can be written without
> > floating-point and the overhead isn't justified.
>
> That's what I thought, but I wanted to be sure. Is that true for
> all *BSD OS's?
There are 2 different flavors to support floating-points in the
kernel.
(1) FPU support: the overhead of storing/restoring the FPU state
is prohibitive. I believe no OS supports it.
(2) compiling the kernel without FPU support (-msoft-float for gcc)
and linking the FPU emulation library.
This should work for any OS.
Still, it's the best practice not to use floating-points inside the
kernel.
> > So, you have to use other methods (e.g., fixed-point).
>
> Yes, that's exactly what I did for my queuing scheme. As an aside,
> for everyone interested, I think the HFSC code in ALTQ is quite
> educational in that respect. HFSC is a very theoretical scheduler, yet,
> the code processes everything with u_int64_t's... (and scaling).
> Pretty nice.
Thanks. I agree that the HFSC code is the best reference for
translating theory into implementation.
-Kenjiro