On Tue, Jul 14, 2009 at 9:47 AM, Mulyadi Santosa
<[email protected]>wrote:

> Hi....
>
> On Tue, Jul 14, 2009 at 8:39 PM, Robert
> Parkhurst<[email protected]> wrote:
> > Why should it be avoided at all costs?
> >
> >
> > On Tue, Jul 14, 2009 at 3:12 AM, Mulyadi Santosa <
> [email protected]>
> > wrote:
> >>
> >> On Tue, Jul 14, 2009 at 11:25 AM, krushnaal pai<[email protected]>
> >> wrote:
> >> > can someone please send me a socket program written in kernel
> >> >
> >> > i want the server  and client modules
> >>
> >> Check http://kernelnewbies.org/Simple_UDP_Server
> >>
> >> Mind you, socket programming in kernel space isn't really recommended,
> >> in fact you should avoid it at all cost.
>
> First of all, please don't top post :)
>
> OK, here's my understanding:
>
> 1. Kernel developers tend to keep "mechanism" separate to "policy". In
> this case, kernel land is where you define "mechanism", while in user
> space you use this "mechanisms" into programs ("policy").
>
> When you write a program that uses sockets, it's better to put it into
> user space.
>
> 2. easier debugging. Errors in your code won't repeatedly yell "ooops"
> :) Virtual machines make it less scary, but you still need more
> complicated debugging, while in user space you have freedom (single
> step etc).
>
> 3. near zero code adaptation when new kernel version is released.
> IIRC, as stated by Greg KH, kernel ABI is likely unstable from version
> to version. In kernel space, you need to directly use kernel ABIs,
> thus if these ABIs change (let's say the prototype), your codes must
> change too. While in user space, you simply rely on provided functions
> of glibc
>
> of course, there is one pros almost everyone agree about implementing
> something in kernel space: speed. But again, with proper coding, user
> space code could almost match kernel space code. For example, when
> sendfile() syscall was introduced, daemon such as vsftpd could do very
> fast data transfer.
>
> Please CMIIW people...
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer
> blog: the-hydra.blogspot.com
>


Ah ok, thanks for the info!

Reply via email to