[Click] C++ vs the kernel

Eddie Kohler kohler at cs.ucla.edu
Tue Jul 24 16:05:50 EDT 2007


> I think if you use a "feature" of C++ that would result in a program 
> termination you would get a crash in the kernel mode.  Hopefully Eddie 
> can shed some light on this as I have never experimented with such 
> scenarios (for obvious reasons).
...

Click code is compiled with -fno-exceptions.  So if you try to use 
exceptions I would hope the compiler would complain.

>> The following comment was made on the LKML thread: "Inside the kernel
>> you need to be very careful about HOW you allocate membory depending on
>> what type of context you're in (interrupt vs userland primarily; plus
>> certain types of I/O processing have extra requirements) Since so much
>> extra care is required I think that anything that makes
>> allocation/deallocation more automatic is really asking for subtle
>> bugs."

Obviously one can overload operator new() with arguments that provide 
info about interrupt context.

I'm sure there are bugs re: allocation in Click.  However Click almost 
always runs in non-interrupt context; and should not allocate memory in 
interrupt context.

Eddie


>>> As long as you don't use C++ libs and use data structures 
>>> (strings,lists, etc) implemented by Click there should be no issues.
>> Yeah, a colleague referred me to these after my last post. The thing I
>> don't understand here is why the same thing could not have been
>> accomplished using a custom allocator for the standard STL containers?
>> I'm sure there's a good reason, but at first glance I can't think of
>> what it is.
> 
> Possibly could have been extra headaches during linking.



> 
> Roman
> 
>>
>>> Userspace elements are easier to debug too :)  No change to make an oops.
>> Of course, which is why I'd like to stick to userspace if possible (at
>> least for now).
>>
>> Is the reason that 'KernelTap' and 'KernelTun' exist to provide a way
>> for a user-space application to directly manage a network interface? Is
>> this the intended way for user-space applications to be active without
>> being in the kernel?
>>
>> I'll admit, Eddie Kohler's thesis is certainly informative, but it's
>> already 6-7 years old. I often think to myself while I'm reading it "I'm
>> wondering if this is still true", or if something important has happened
>> since that is completely unmentioned in the thesis.
>>
>> Thanks again,
>> Adam
>>
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list