Slashdot Mirror


NetBSD To Support Kernel Development In Lua Scripting

An anonymous reader writes "NetBSD 7.0 will support the Lua scripting language within its kernel for developing drivers and new sub-systems. A Lua scripting interpreter is being added to the NetBSD kernel along with a kernel API so developers can use this scripting language rather than C for developing new BSD kernel components. Expressed reasons for supporting a scripting language in a kernel were rapid application development, better configuration, and "modifying software written in C is hard for users." In a presentation it was said that Lua in the kernel will let users explore their system in an easy way."

311 comments

  1. Stupid by Anonymous Coward · · Score: 1, Insightful

    This is, quite possibly, the stupidest kernel feature that has ever been unleashed upon this poor planet.

    1. Re:Stupid by Anonymous Coward · · Score: 0

      I agree that's special ed level of stupid.

    2. Re:Stupid by Anonymous Coward · · Score: 0

      Why?

    3. Re:Stupid by Anonymous Coward · · Score: 0

      Because Lua can run in userspace just fine.

    4. Re:Stupid by Anonymous Coward · · Score: 0

      So?

    5. Re:Stupid by Anonymous Coward · · Score: 0

      Yes, this rates right up there with monolithic kernels (ducks for cover in case Linus is around) :-)

    6. Re:Stupid by Anonymous Coward · · Score: 0

      So adding features that can help devs and can be compiled out of the main stream releases is a bad thing?

    7. Re:Stupid by dalias · · Score: 4, Interesting

      It is potentially stupid, but the reason is much more subtle than most people realize. For all its limitations and headache, C does have one key feature that makes it suitable for kernel programming where most other languages are not: the concept of well-defined storage durations and reserving storage for an object. I really question whether Lua code running as part of the kernel can be made robust under out-of-memory conditions which a kernel must be able to survive.

    8. Re:Stupid by Anonymous Coward · · Score: 0

      For all its limitations and headache, C does have one key feature that makes it suitable for kernel programming where most other languages are not: the concept of well-defined storage durations and reserving storage for an object.

      And yet it is so useless without the concept of destructors. The language your searching is C++, not C. Check out the wonders of "RAII".

    9. Re:Stupid by shutdown+-p+now · · Score: 1

      There are many other languages that have well-defined object lifetime semantics - the most obvious way to get that is to use some form of reference counting. Now, the standard Lua interpreter actually uses a mark & sweep GC, but they might change that.

    10. Re:Stupid by Anonymous Coward · · Score: 2, Insightful

      No, if you understand how Lua glues C code together, this is brilliant.

    11. Re:Stupid by Anonymous Coward · · Score: 0

      Lua reports an error in this case. There's one path for this.

      C code has a path for every place an alloc can fail. Forgetting typically means an instant NULL dereference in kernel space = panic.

      Which one do you think needs to be "made robust", again?

    12. Re:Stupid by unixisc · · Score: 1

      You don't run something in kernel unless it needs to run at high priority or w/ special privilege levels. You try to minimize what goes in the kernel, and only move things there if they are incredibly slow in userspace. Which, given current CPUs, is not likely to be the problem.

    13. Re:Stupid by Stalks · · Score: 1

      So? The language used doesn't determine what is written for? Even the summary says "for drivers". RTFA.

    14. Re:Stupid by Anonymous Coward · · Score: 0

      LOL. You have obviously NO idea how memory management works at kernel level.

    15. Re:Stupid by aaron552 · · Score: 2

      And yet it is so useless without the concept of destructors.

      s/useless/cumbersome

      --
      I had a sig once. It was lost in the great storm of '09.
    16. Re:Stupid by zakeria · · Score: 1

      What? have you any idea how many interpreters and the like 'glue' C code together, just about all of them and many do it better such as JavaScript. Not to mention that JavaScript or ECMAScript is utilized my millions.

    17. Re:Stupid by K.+S.+Kyosuke · · Score: 1

      and only move things there if they are incredibly slow in userspace

      No, you move things into the kernel if they need direct access to kernel address space or to hardware.

      --
      Ezekiel 23:20
    18. Re:Stupid by K.+S.+Kyosuke · · Score: 2

      What? have you any idea how many interpreters and the like 'glue' C code together, just about all of them and many do it better such as JavaScript.

      Hahaha. Lua was *designed* to do just that. BTW, take a look at how LuaJIT extends what Lua already provides. You can directly manipulate C structures from LuaJIT - define new structure types *at runtime*, malloc them, fill them in, pass them arround, whatever you need to do with them.

      Not to mention that JavaScript or ECMAScript is utilized my millions.

      Lua is a MUCH better language than ECMAScript. Just consider issue number one: variable scoping. Lua: Essentially derived from the Scheme LET for or the functional languages (ML family style LET). Javascript: horrible hack, variable bound anywhere in the function has scope extending to the region before its initialization.

      Lua also doesn't need to have use FP arithmetics, it uses it by default but you can switch to integers. JS requires FP, and at least the Linux kernel doesn't allow FP inside. Or at least it didn't when I checked the last time, whatever the reasons were (faster context switches, perhaps? I really don't remember...) Overall, as far as embedding is concerned, it's definitely much more developer-friendly than any mainstream JS implementation I'm aware of.

      --
      Ezekiel 23:20
    19. Re:Stupid by Pseudonym · · Score: 1

      ECMAScript is a pretty good language for manipulating DOM-like object models and light data processing, but it's terrible for gluing C functions together.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    20. Re:Stupid by ByOhTek · · Score: 1

      That's actually the logic behind a microkernel, and it ignores performance. That's why a large number of microkernels have slowly bloated into hybrid kernels.

      And current CPUs don't fix the issue, because we are doing more with that power now. We aren't using the same amount of computational power as we did 10 years ago, and just have more power.

      Of course, unless that scripting language gets compiled (even JIT compiled) I'm not sure the performance improvement will be that great... or even exist. Personally, I think the issue isn't that BSD is dead,so much as the the NetBSD developers are using enough hard-core drugs that they should be.

      --
      Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
    21. Re:Stupid by ByOhTek · · Score: 1

      So does Python, C#, Java, Perl, C++, BASH...

      --
      Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
    22. Re:Stupid by unixisc · · Score: 1

      I would think that current CPUs do fix the issue. Previously, when there were only uniprocessing CPUs, it wasn't difficult to write applications to demand more out of it. But once CPUs went multi-core, it was far more difficult. As anybody who's studied Computer Architecture Performance, the performance of a system doesn't linearly grow w/ more CPUs, and in fact, after a certain number of them, any performance improvements flatten out. Reason being that there is a limit to the amount of instruction level parallelism that can be squeezed out of the software running it.

      So in the above scenario, the kernel could easily run on one of the cores (except maybe for task scheduling, which may require the other cores to get their prioritized tasks from the scheduler) and the Lua script could run in userspace on another of the cores. I just don't see why there would be a performance impact. How many OS services or applications need to run on multiple cores, unless they are well threaded to begin with?

  2. April? by Anonymous Coward · · Score: 0

    Surely they are joking, right?

    1. Re:April? by kthreadd · · Score: 1

      No.

  3. users? by gTsiros · · Score: 5, Insightful

    "modifying software written in C is hard for users."

    i thought *users* had no business writing device drivers?

    of course if they had said "modifying software written in C is hard for programmers." it would gather a fierce shitstorm.

    --
    Looking for people to chat about multicopters, coding, music. skype: gtsiros
    1. Re:users? by TheRealMindChild · · Score: 4, Interesting

      It seems crazy, but this may not be as braindead as it seems. For instance, a keyboard driver. You just need a read key state->have a look up table to the keycodes function, then pass it on. This is redundant, few lines of code with very little difference between most other drivers. You may not want to write your graphic drivers in it, but not every driver needs bare metal functionality

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    2. Re:users? by KiloByte · · Score: 4, Funny

      So let's invent a sandboxed layer that can interface with the kernel, but can't do damage to it? Also, make the API stable, unlike innards of the kernel. Let's call this novel idea "userspace" or such.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    3. Re:users? by Mindcontrolled · · Score: 4, Insightful

      The moment you even expect that users should, could, would or even remotely in their most maddened fever dreams WOULD WANT to modify the kernel, you lost it.

      --
      Ubi solitudinem faciunt, pacem appellant.
    4. Re:users? by Jane+Q.+Public · · Score: 3, Interesting

      "It seems crazy, but this may not be as braindead as it seems."

      I think that is very much a matter of opinion. And my opinion is: it *IS* just exactly as braindead as it seems.

      Just what we need: "modern" software bloat in the kernel. [sarcasm] Thanks, but no thanks.

      I have right here a program that is more than 45 times the size of the entire hard drive from one of our office computers back in 1994... and that hard drive had a full install of that year's Microsoft Office, plus WordPerfect and Lotus 1-2-3, with lots of room to spare for files.

      Sure... that was '94. But is there REALLY call for programs that large, and by the way slow? And that is by no means the largest application I have on my machine right now. It's on the larger side but I have some many times as big.

    5. Re:users? by MacTO · · Score: 5, Insightful

      Keep in mind that NetBSD users are quite different from Windows/Macintosh/Linux users (at least on average).

      "Hard" may also be a reference to the implementation, rather than the language. Interpreted languages tend to bypass the compile and link part of the development process. This means that interpreted languages are easier to develop with and compiled languages are hard to develop with (at least in some respects). I'd also comment on the arcane nature of C, but I haven't used lua so I don't know if it is any better.

    6. Re:users? by Lodragandraoidh · · Score: 4, Interesting

      Interesting - failure of user space in this way is exactly why we have zero-days.

      I would like to see this happen - but several things make it improbable:

      1. Von Neuman architecture. As long as data and instructions exist in the same space - poorly written apps will allow abuse of it.

      2. Complexity of current software. The more complex the software, the more likely a bug will exist in it that allows #1. Given how programmers stitch together preexisting modules without understanding what is being done on the underlying system - I only expect that to continue expanding.

      It should be instructive that Java was supposed to be that sandboxed layer...and it has so many zero-days it looks like swiss cheese.

      Now - how would we avoid that and make an unhackable userspace?

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
    7. Re:users? by Anonymous Coward · · Score: 1

      Lua is 12k lines of C code, comments included. Once compiled it weights like 200KB.

    8. Re:users? by Anonymous Coward · · Score: 0

      So, they chose Lua to make it easier for users? Because apparenly more people know Lua than C?

      I don't think I've actually ever seen anything written in Lua.

    9. Re:users? by Anonymous Coward · · Score: 0

      What, you haven't played a video game in the past 15 years?

    10. Re:users? by gTsiros · · Score: 1

      the stalker game series: all game scripting and i think even the ai of npcs is in lua.

      --
      Looking for people to chat about multicopters, coding, music. skype: gtsiros
    11. Re:users? by Anonymous Coward · · Score: 5, Funny

      I only have 640 KB you insensitive clod!

    12. Re:users? by jbolden · · Score: 4, Interesting

      i thought *users* had no business writing device drivers?

      My non programmer wife wrote a custom device driver in AppleScript, not even knowing what a device driver is. Those sorts of languages can be amazing empowering to end users, and yes there are reasons that end users might want a custom device driver if it is easy enough to accomplish. Though this makes more sense for OSX than NetBSD, I doubt there are many if any non programmers who use NetBSD.

      I had to write a custom device driver for Windows once to get something more like a Unix ethernet driver i.e. bypass some normally quite excellent parts of the Windows networking stack. I was doing software not hardware so I guess I'd consider myself an end user. And that was a pain in the ass.

    13. Re:users? by jbolden · · Score: 1

      Lua is specifically designed to be an easy embeddedable scripting language when one needs a light scripting language but not a full featured programming language. Luas are way way easier.

    14. Re:users? by Anonymous Coward · · Score: 1

      For instance, a keyboard driver. You just need a read key state->have a look up table to the keycodes function, then pass it on.

      Sounds like a few tens of lines of C code. But no, let's bring in a whole new language interpreter AND write a few lines of code in the other language.

      Scripting languages are fantastic for some things. Kernel or driver development is not one of them. Low level things need to be as efficient as possible - even the keyboard driver. Imagine you're playing a FPS using the keyboard and suddenly the game freezes for an instant for garbage collection when you press a key. ;-)

    15. Re:users? by Natales · · Score: 2

      One possible answer to your point is to use Parallax OS or a similar concept. I find very appealing the self-contained nature of FCAPS to an individual core.

      Interestingly, they leverage Bare Metal OS and the coding is done mostly in Assembly (although C is possible). I think the fattening of all kernels is making these kind of projects look more interesting.

    16. Re:users? by Anonymous Coward · · Score: 0

      I'm not suggesting this is why they're doing it, but I'd try getting some of my more esoteric stuff to work if I could do it in... well... anything but C.

    17. Re:users? by aliquis · · Score: 3, Funny

      The moment you even expect that users should, could, would or even remotely in their most maddened fever dreams WOULD WANT to modify the kernel, you lost it.

      Though it's NetBSD users. Not Apple iPad users.

    18. Re:users? by rubycodez · · Score: 1, Insightful

      go fuck yourself. I'm and Linux and BSD user, I've taken grad courses in kernel architecture of Minix, System V, BSD, VMS. I've modified the kernel of many OS. Not everyone is a windows wuss.

    19. Re:users? by Anonymous Coward · · Score: 0

      if NetBSD users are so different from windows users (or linux users for that matter - what a laugh) why would they need lua? It's funny how you imply that bsd users are "special" yet still unable to write C and in need of a crutch like lua.

    20. Re:users? by kriston · · Score: 2

      Lua is all over the Logitech Squeezebox by SlimDevices. It's Tcl for the new generation.

      --

      Kriston

    21. Re:users? by WindBourne · · Score: 3, Interesting

      Exactly. Think about all of the devices out there that are simple ones. I know that my in-laws have BP cuff with USB. I have thought about writting a driver for it, but it just seems like a lot of work for a minimal amount of info. Now, if there is something simple, then this could be useful. In addition, I have been thinking that batteries interface should be standardized. It does not matter wether it is a laptop battery, or a UPS. They accomplish the same thing and the same programs should control them. Simple as that.

      --
      I prefer the "u" in honour as it seems to be missing these days.
    22. Re:users? by smittyoneeach · · Score: 0

      My non programmer wife wrote a custom device driver in AppleScript

      Read: pie recipe.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    23. Re:users? by Anonymous Coward · · Score: 0

      Then you're a developer you fucking idiot. Not a user.

    24. Re:users? by Anonymous Coward · · Score: 0

      Look out boys we have a bad ass over here!

    25. Re:users? by rubycodez · · Score: 1

      oh? I also work on my car, home electronics & wiring, carpentry and even plumbing at times. so by your logic I'm an auto manufacturer, fabrication facility, housing contractor.....??

    26. Re:users? by Lord+Kano · · Score: 1

      oh? I also work on my car, home electronics & wiring, carpentry and even plumbing at times. so by your logic I'm an auto manufacturer, fabrication facility, housing contractor.....??

      Then, think of yourself as a power user. Most "regular" user don't code fixes on their own computers, change their own oil, wire their own outlets, fix their own steps or their own plumbing.

      I do those things too, but you understand that most people don't.

      LK

      --
      "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
    27. Re:users? by jones_supa · · Score: 2

      oh? I also work on my car, home electronics & wiring, carpentry and even plumbing at times. so by your logic I'm an auto manufacturer, fabrication facility, housing contractor.....??

      Yes. In that case you are an amateur auto manufacturer, fabrication facility and housing contractor.

    28. Re:users? by shutdown+-p+now · · Score: 1

      Lua is a full-featured programming language, though - more so than many other common embedded languages, and on par with Python. Semantically it's actually somewhat similar to JavaScript , except without all the shitty design decisions.

    29. Re:users? by dwye · · Score: 1

      Lua is 12k lines of C code, comments included. Once compiled it weights like 200KB.

      How much of that is empty (at least at the start) table space?

    30. Re:users? by pantherace · · Score: 2

      See?

      It's good for everyone!

    31. Re:users? by Dahamma · · Score: 1

      Exactly. Which is probably why "dumbing down" driver writing for "users" who can't handle C is so useless...

    32. Re:users? by Anonymous Coward · · Score: 0

      You're right. The fact that you just said "windows wuss" means you really aren't a developer, you are a poseur. OSs are OSs and Windows is as useful as any. And a real porn star doesn't need to measure his dick.

    33. Re:users? by Dahamma · · Score: 2

      It is a really simple syntax and reasonably efficient interpreter, and metatables allow a surprising amount of OO design and easy C integration. One complaint is I wish they hadn't made it so minimal as to combine hashes and arrays into one type. I kind of wonder if that's going to be a pain when writing more traditional C-ish driver-type code in this project.

    34. Re:users? by Dahamma · · Score: 1

      Eh, if you want a *big* example, how about a significant amount of both the client and server code for World of Warcraft?

    35. Re:users? by epyT-R · · Score: 1

      The last thing modern computing needs is yet another useless layer that adds even more lag between input and display. the C code is small and simple as it is. keyboards are relatively simple devices that benefit from low latency, so the last thing I'd want is to have my keyboard driver run through a useless intepreter that eats cycles unnecessarily. It wont protect me from bad code whether it's C or lua, so what's the point? Either way the system will panic..

    36. Re:users? by epyT-R · · Score: 1

      explains why the game is/was a hog..

    37. Re:users? by Anonymous Coward · · Score: 0

      The sizes quoted here are disk space, not RAM. A base Lua instance 3-5KB of RAM.

    38. Re:users? by jvillain · · Score: 1

      My take is if you are having a hard time learning C how are you ever going to understand the kernel? But as long as Linus's Linux kernel tree doesn't do this I wish these guys the best.

    39. Re:users? by Anonymous Coward · · Score: 0

      amateur auto *mechanic*, not manufacturer.

      the other two examples are similarly corrected.

    40. Re:users? by DMiax · · Score: 2

      It won't be hard: tables are implemented with a hash and an array part, so if you only use it as an array they will be efficiently stored. You may find weird to think of 1-based arrays, but it has never been a problem in my experience, since there is no pointer arithmetics to be done in Lua. Plus it's really convenient to develop something in Lua first to get it right, then move the code to C starting from the low level functions once it is stable.

    41. Re:users? by Anonymous Coward · · Score: 0

      These are not the images you're looking for:
      Your search - transcription foot pedal - did not match any image results.

    42. Re:users? by thetoadwarrior · · Score: 1

      Possibly. I assume it would be a cost issue for you but people do build their own cars. They might not make their own windshield but a lot of manufacturers probably don't either.

    43. Re:users? by thetoadwarrior · · Score: 1

      Netbsd is a big gaming platform after all.

    44. Re:users? by jbolden · · Score: 2

      I don't think that it is really true. I think Lua could evolve to be as strong in applications programming as Python but they choose to fill different niches and so the languages evolved along different paths.

      Lua uses automatic coercion in all instances which makes programs faster to write and harder to maintain.
      Python has a very well defined OO structure.
      Lua doesn't have the huge libraries of functionality Python does
      Lua's lack of high performance arrays
      Lua's lack of unicode is a big problem for applications programming

    45. Re:users? by Anonymous Coward · · Score: 0

      It seems crazy, but this may not be as braindead as it seems. For instance, a keyboard driver. You just need a read key state->have a look up table to the keycodes function, then pass it on. This is redundant, few lines of code with very little difference between most other drivers. You may not want to write your graphic drivers in it, but not every driver needs bare metal functionality

      Not to mention that it will be easier and faster to write and deploy zero day exploits, when the payload can be scripted in LUA!

      Win-Win.

    46. Re:users? by maxwell+demon · · Score: 2

      Interestingly, the x86 architecture (since the 286) allows to separate code and data on the user level, it's just that operating systems don't make use of that (I don't know whether this is still true for the x86-64 architecture; given that it wasn't used on x86, they might have removed that possibility).

      Of course at the fundamental level, you don't want to do that, because you would take away the possibility to compile programs.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    47. Re:users? by Anonymous Coward · · Score: 0

      Interesting - failure of user space in this way is exactly why we have zero-days.

      Operating system kernels are no less vulnerable to attacks than user-space applications. I believe attackers don't usually attack the kernel because plenty of easier-to-exploit user-space applications exist with vulnerabilities in them.

      I would like to see this happen - but several things make it improbable:

      1. Von Neuman architecture. As long as data and instructions exist in the same space - poorly written apps will allow abuse of it.

      Machines with separate code and data memories may be more difficult to exploit, but exploitation is still possible. This paper describes one such attack.

      2. Complexity of current software. The more complex the software, the more likely a bug will exist in it that allows #1. Given how programmers stitch together preexisting modules without understanding what is being done on the underlying system - I only expect that to continue expanding.

      It should be instructive that Java was supposed to be that sandboxed layer...and it has so many zero-days it looks like swiss cheese.

      Now - how would we avoid that and make an unhackable userspace?

      For memory safety errors (buffer overflows and their ilk), there are a number of solutions to the problem coming out of the research community. Control-flow integrity looks extremely promising with less than 10% overhead on average (although the number of programs tested is still too small). Other techniques can handle non-control data attacks, but they incur more overhead. I think the question going forward is how can we reduce the overhead of automated defenses, and which set of defenses give us the right performance/protection tradeoff.

      For a list of papers on the subject, you might want to check out my memory safety menagerie.

    48. Re:users? by rubycodez · · Score: 1

      just a tinkerer. that's what this article is about, a tool for tinkerers

    49. Re:users? by aaron552 · · Score: 1

      Of course at the fundamental level, you don't want to do that, because you would take away the possibility to compile programs.

      Why not? Compilation is just converting data into more data that is afterward executed as code. It would make JIT a lot harder, if not impossible, however.

      --
      I had a sig once. It was lost in the great storm of '09.
    50. Re:users? by ultranova · · Score: 2

      Just what we need: "modern" software bloat in the kernel. [sarcasm] Thanks, but no thanks.

      A monolithic kernel will inevitably get bloated over time as more features and drivers are added. This is a bad thing because any malfunction in any component has the potential to mess up the entire running kernel. Using a scripting language for less performance-intensive parts is an attempt to mitigate this risk. Whether it's a good idea remains to be seen.

      I have right here a program that is more than 45 times the size of the entire hard drive from one of our office computers back in 1994... and that hard drive had a full install of that year's Microsoft Office, plus WordPerfect and Lotus 1-2-3, with lots of room to spare for files.

      How much disk space does this unnamed program take in proportion to your current disk versus the space taken by any of those programs in the disk you had back then? What does it do?

      Sure... that was '94. But is there REALLY call for programs that large, and by the way slow?

      You seem to believe so, since you have it installed. The rest of us couldn't possibly judge an unspecified program.

      However, I for one remember well the computers and programs of that era. Maybe you should revert back to DOS/Windows 3.1 and associated programs for a week or so? That should refresh your memory on why all the "bloat" was added.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    51. Re:users? by Anonymous Coward · · Score: 0

      > but not every driver needs bare metal functionality
      yes, they do, otherwise they don't belong in the kernel.

    52. Re:users? by Anonymous Coward · · Score: 0

      > failure of user space in this way is exactly why we have zero-days
      we have zero-days because of bugs. how does moving buggy code to kernel space prevent exploits?

    53. Re:users? by Anonymous Coward · · Score: 0

      i suppose someone is pining for the days of Lisp machines ...

    54. Re:users? by mic0e · · Score: 1

      Given that Linux is running by Linus, you can bet that will never happen. Just look at how he utterly rejects the idea of using even C++, even for userspace tools: http://article.gmane.org/gmane.comp.version-control.git/57918

    55. Re:users? by Anonymous Coward · · Score: 0

      You must be the tard that cant do any of these things for himself.
      Hows all those tool bars in your browser. how many you got a dozen.

    56. Re:users? by Anonymous Coward · · Score: 0

      Did you ever coded a win98 vxd ?
      If not, you are the wusss ;)

    57. Re:users? by shutdown+-p+now · · Score: 1

      Lua uses automatic coercion in all instances which makes programs faster to write and harder to maintain.

      This one's arguable. PHP also uses automatic coercion, for example, and so does Perl - and those two are widely considered to be general-purpose application programming languages. At least Lua's coercions are much more sane than PHP ones...

      Python has a very well defined OO structure.

      Lua gives the more flexible approach of providing associative arrays as the most generic data structure, and letting users build on that - with some syntactic sugar for method calls. But you can create an OO system on top of that that is just as expressive as Python, and people have done so.

      Lua doesn't have the huge libraries of functionality Python does

      That's really the only thing that sets it apart as an embeddable extension language. Of course, libraries are not quite the same thing as language, and they can always be provided. Core JS does not really have rich libraries, but look at what it gets in e.g. WinRT apps...

      Lua's lack of high performance arrays

      Can be easily provided via an extension library, analogous to JS byte arrays.

      Lua's lack of unicode is a big problem for applications programming

      The stock interpreter is 8-bit clean, so you can easily pass UTF-8 around. Standard string functions don't always handle it right (although on Unix it depends on locale, same as in C), but, as you've already noted, the standard library is meager enough that it usually gets replaced anyway - and the replacement may offer fully Unicode-aware string functions.

      Also, it used to be very simple to change the various C types that Lua uses in its config header. I don't recall if that included the basic character type, but I suspect it did - and then you can change it to wchar_t or whatever (but, of course, you'd still need the functions).

      Anyway, my point was that Lua as a language is not really all that different from many other dynamically typed languages that are today used quite successfully for applications programming. Its feature set is not overwhelming, but it's quite sufficiently rich, having e.g. true first-class function literals and closures - and it gives you enough basic building blocks to build the rest on top of that. However, because it was always intended to be used as an embedded language, the implementation of it is geared more towards that aspect, and there's the lack of functionality in the standard library etc.

      Which, to be honest, is a pity. To me, Lua is JavaScript done right. I wish we could ditch the horrible hack of the latter, and replace it with nice clean Lua syntax and semantics.

    58. Re:users? by Dahamma · · Score: 1

      Yeah - that's exactly what I was talking about :)

      And sort of to your other point - the whole concept of using a loosely typed, dynamic programming language just seems a bit scary in a driver in that sometimes trivial errors are hard to detect until runtime. Though I guess at least the worst that can happen (assuming there are no bugs in the interpreter) is an exception that can be caught - as long as whoever is writing the code actually does proper error handling...

    59. Re:users? by Anonymous Coward · · Score: 0

      You're the only retard here.

      "Amateur" doesn't mean "Cannot do anything".

    60. Re:users? by gidoca · · Score: 1

      You can already write your USB driver in Lua (or most other popular language out there) if you want to, completely in userspace: http://www.libusb.org/#Bindings. No need for it to be in the kernel.

    61. Re:users? by Anonymous Coward · · Score: 0

      First, I do think most of Java's security issues are related to feature-creep. If they had focused on simplicity and formal correctness proofs, they would have succeeded. Instead they got an orgasm each time they could add things like reflection, RMI and the like.

      Secondly, bounds checking and smart pointers are definitely not that expensive ( about 10 to 20% overhead). Also, optimizing compilers could reduce the strength of most checking code where it matters (e.g. most for-loops working on arrays need just one check instead of one per iteration).

      Finally, governments could put their smartest people on the problem and fund Correctness Proofs for compilers and VMs. I just think they don't want too much security (cyberwar etc) and they don't want to interfere with the buddies at Dollarsoft Inc, who can pay these nice bribes. Also, there is hexagramm software Ltd who have a nice business in selling expensive firewalls and doing other things "to help their struggling" nation. To kill scientists in opposing countries.

    62. Re:users? by NitWit005 · · Score: 1

      The Lua idea doesn't seem to be about making something "unhackable", just easier to code and harder to mess up. If you directly interact with the kernel, you're going to have a way to cause issues for the user of the system.

    63. Re:users? by Anonymous Coward · · Score: 0

      oh? I also work on my car, home electronics & wiring, carpentry and even plumbing at times. so by your logic I'm an auto manufacturer, fabrication facility, housing contractor.....??

      Yes. In that case you are an amateur auto manufacturer, fabrication facility and housing contractor.

      A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects!

    64. Re:users? by Jane+Q.+Public · · Score: 1

      "How much disk space does this unnamed program take in proportion to your current disk versus the space taken by any of those programs in the disk you had back then? What does it do?"

      That's moving the goalposts. I was referring to how bloated they've become in relation to the actual functionality they provide. (Sure... Office does more than it did then. But very much more? No. Yet the programs are many, many times the size they used to be.) You, on the other hand, are saying "Well, you have a larger hard disk, so it doesn't matter." Those are two very different things. And it does matter, because it strongly affects performance, and lessens the value of that larger hard drive, not to mention my limited RAM.

      And you say "unnamed" in a way that makes you seem skeptical. Here are a few of my apps, with how many times each is larger than that old hard drive (rounded down to the integer portion): iPhoto: 14x, GnuCash: 18x, Bible Glo: 18x, iTunes: 32x, Gimp: 28x, Chrome browser: 55x, VMware Fusion: 77x, Autodesk Inventor: 163x, Xcode: 354x.

      "You seem to believe so, since you have it installed. The rest of us couldn't possibly judge an unspecified program."

      No, that doesn't follow at all. I have them installed because I am resigned (for now) to putting up with this horrendous software bloat, but that doesn't mean I have call to appreciate it. As I have pointed out, there are definite downsides to it, including reduced performance, and reduced value of my HDD and RAM. And I have specified a number of them for you now, so you don't have that objection anymore. /.

      According to Microsoft themselves, a current install of Office Standard takes up 300 times the size of that entire office hard drive. Yet, even though it didn't even remotely fill that hard drive, Office today is not even a world away from offering anything like 300 times the functionality that it did then.

      (I used as an example a typical, middle-of-the-road hard drive from a PC in use in business offices of the time: 10MB. Not new computers just coming out... but typical of what was actually being actively used, maybe 2-3 years old. New computers in '94 didn't usually have 10MB, they were likely to have more like 40MB. But the ones already in use typically were smaller: 10-20MB. And I can say that with some authority because I was systems manager for a large office and had to maintain over 80 computers.)

      And I don't need my memory refreshed, thank you very much. 300 times as large, but not even remotely near 300 times the functionality. If you compare the programs head-to-head, probably not really even twice the functionality. My point is made.

    65. Re:users? by Jane+Q.+Public · · Score: 1

      "I only have 640 KB you insensitive clod!"

      So, having more RAM today is an excuse for using it all up? We can so we should? Is that it?

      I use a computer sometimes that has more than 6,250 times that much memory... yet I frequently run into memory limitations on that machine, in the course of my work.

      You think that's a good thing? It's not. It's absolutely ridiculous.

    66. Re:users? by Jane+Q.+Public · · Score: 1

      "Lua is 12k lines of C code, comments included. Once compiled it weights like 200KB."

      The issue (at least the one I was referring to) isn't the size or performance of the Lua interpreter. It's the size and performance of the scripts that will eventually be used.

    67. Re:users? by Anonymous Coward · · Score: 0

      10 mb of hard disk in 1994? Your remembering that time differently then me. My first PC was a 1995 IBM Aptiva with a 133 MHz Pentium, 16 Mb of RAM, and an at the time staggering 1.6 gb hard disk. Running then brand new Windows 95. Mind you, this was high end. Most of my friends had 486s with half as much RAM.

  4. Performance by Anonymous Coward · · Score: 5, Informative

    Won't that kill performance?

    I mean that's the reason we still write kernels in C. Every cycle counts..

    1. Re:Performance by Marxdot · · Score: 0

      That's not the reason we write kernels in C.

    2. Re: Performance by Anonymous Coward · · Score: 0

      Enlighten me. What's the reason?

    3. Re:Performance by Anonymous Coward · · Score: 0

      Then I await a kernel written in javascript!

    4. Re: Performance by Anonymous Coward · · Score: 0, Interesting

      Because it is a powerful and realtively easy to read and write language. Plus, it has a good compiler with a lot of optimization routines to squeeze performance out. In more modern times, it also has a fair bit of momentum as that is what they were written in in the past.

    5. Re: Performance by Anonymous Coward · · Score: 5, Funny

      So we use it for performance. Ok I get it now.

    6. Re:Performance by DarwinSurvivor · · Score: 4, Informative

      Pfff, writing Linux kernels in Javascript is so last century. Nowadays we RUN kernels in Javascript!

    7. Re: Performance by Anonymous Coward · · Score: 1

      In my opinion one of the best reasons is it produces good, straightforward machine code. Other languages make it too easy to write allocation-heavy code, or large code size. These things are bad for a kernel.

    8. Re:Performance by Anonymous Coward · · Score: 2

      Lua is the fastest available scripting language for the task that NetBSD needs it for. It compiles to a byte code, is designed for efficiency and most importantly has excellent hooks for C integration. I have to commend the NetBSD team for their decision - hopefully it will be very successful and lead to a similar implementation in Linux.

    9. Re:Performance by Anonymous Coward · · Score: 3, Informative

      Lua is designed to be a embedded companion language to C. You still use C where it makes sense (i.e. pointer manipulation/performance). You use Lua for expressing higher level logic more easily. Lua is very fast. Writing the same higher level logic in raw C might not be any faster because you have to build up all the infrastructure that Lua has already provided and optimized like associative arrays.

    10. Re: Performance by larry+bagina · · Score: 3, Insightful

      I believe the word you're looking for is "performance".

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    11. Re: Performance by Anonymous Coward · · Score: 1

      Powerful is not the same as fast.

      C can mingle with memory in ways that other higher-level languages can't.

      It's also ubiquitous; almost every device that exists supports some version of C.

      It's also fast, but it's not the main reason (assembly is faster).

    12. Re:Performance by Anonymous Coward · · Score: 1

      Perl compiles to byte code and has hooks for C integration. It's probably not as fast, but more than ten people actually know how to use Perl. :)

    13. Re:Performance by Anonymous Coward · · Score: 1

      Does this count?
      http://linux.slashdot.org/story/11/10/08/1340253/linux-in-javascript-with-persistent-storage

    14. Re:Performance by stenvar · · Score: 4, Informative

      Kernel code is like lots of other code: a lot of it is executed rarely and not performance critical. There's setup code, occasional permissions checking, etc.

      In addition, this is not to replace plain C modules (although it may be useful for prototyping), it's for complex and dynamic configurability.

      Right now, there are two ways of handling that. One is to invent complex configuration files and data structures, sometimes even little interpreters. The kernel is full of those. They are error prone, complicated, and require a lot of effort to maintain. The other is to put complex decision making into user-space, but that involves context switches and other overhead. It also means lots of special-purpose and redundant code, and lots of documentation and complexity. The kernel uses both of those strategies extensively, one reason why it's so big.

      Putting Lua+LuaJIT in the kernel is likely faster than either of those approaches, while at the same time also being easier to maintain and document.

    15. Re: Performance by Anonymous Coward · · Score: 3, Interesting

      True. Assembly can be faster than C. In the same way it can be more powerful than C.

      Bottom line is C provides a solution for the complexity of large scale development, without sacrificing the performance, while at the same times still let's the developer be in complete control of his code and data structures.

    16. Re: Performance by Anonymous Coward · · Score: 2, Interesting

      Not really. It's more subtle than that. Straightforward machine code and more explicit code can help performance, or it can hurt. For example, function pointers are slower than inlinable c++ templates or a JIT that can inline across library boundaries or based on observed call frequencies at runtime (all of these at the cost of memory usage). It's not nearly as simple or binary as you're suggesting.

    17. Re:Performance by synthespian · · Score: 1

      I'm not sure, but there might be non-C system code in OS X (Objective-C) and Windows (C++, C#). In FreeBSD, there's Forth in the bootloader (does that count?).

      I think you meant: Linux developers only use C for system programming.

      --
      Main difference between the BSD license and the GPL license: one is from California and the other is from Massachusetts
    18. Re: Performance by Anonymous Coward · · Score: 0

      By the way "powerful" is not unambiguous characterisation. C++ is powerful. Assembly is powerful. Perl is as well. So is LUA.

    19. Re: Performance by Anonymous Coward · · Score: 0

      You are right in the essence of your reply.

      But comparing function pointers to inlinable templates is unfair. If anything you should compare them to virtual functions.

    20. Re:Performance by Bill_the_Engineer · · Score: 0

      Yes but this is NetBSD so the performance degradation wouldn't be noticed anyway.

      --
      These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
    21. Re:Performance by Anonymous Coward · · Score: 0

      Perl isn't even remotely close to as fast or as efficient as Lua and Perl implementations are far, far more complex. Perl is deprecated, deal with it.

    22. Re: Performance by Anonymous Coward · · Score: 3, Insightful

      Multiple execution units, long pipelines and modern caching makes it hard for assembly to be faster than C. The human brain can not visualize the pipeline like a compiler can.

    23. Re:Performance by aliquis · · Score: 1

      Lua is also used by World of Warcraft, "which got more users than Linux" ;), JK :)

      Anyway, point being I think more than 10 people know how to use it :)

    24. Re: Performance by Anonymous Coward · · Score: 0

      Function pointers and virtual functions are pretty much the same thing at the object code level, though. is that worth comparing?

      I think my comparison is fair for a lot of uses, though. See qsort or bsearch in libc, then compare with STL equivalents.

    25. Re:Performance by rubycodez · · Score: 1

      Perl is dying, Larry killed it.

    26. Re: Performance by Anonymous Coward · · Score: 0

      Thats exactly what people that can't program in assembly think.

      They are wrong.

    27. Re:Performance by 10101001+10101001 · · Score: 4, Insightful

      Kernel code is like lots of other code: a lot of it is executed rarely and not performance critical. There's setup code, occasional permissions checking, etc.

      A lot of it is executed rarely because at least half the code is drivers and one usually doesn't have but one sound card, one (or two) network card, etc vs the hundreds of sound card drivers, hundreds of network card drivers, etc. Further, a major point of the kernel is that it, by design, isn't supposed to be executed a lot because most CPU time should be devoted to user space programs. So, to that end, you could say it's not "performance critical". But, that's more in line with the point that precisely because kernels are generally developed so well, they rarely have "performance critical" code. Once you start throwing scripting into it, I think that goes out the window.

      In addition, this is not to replace plain C modules (although it may be useful for prototyping), it's for complex and dynamic configurability.

      To this, I could see some benefit. But, honestly, I'd feel it safe and saner if it were a language that was reducible to a FSA. The point that "Dangerous code can be disabled at the byte-code level (prevention of endless loop DoS etc)" in the slide really only works in that context, anyways. In any case, Lua is nothing of the sort.

      Right now, there are two ways of handling that. One is to invent complex configuration files and data structures, sometimes even little interpreters. The kernel is full of those. They are error prone, complicated, and require a lot of effort to maintain.

      Which is an argument for making a good, universal FSA language. It won't remove the being error prone or complicated because that's the nature of the beast and papering over it with a Turing complete language is no sort of answer. But having them all share the same language makes sense from a maintenance standpoint. For example, the BPF was repurposed for syscall filtering--a little admission that I'm not sure entirely where BPF stands language wise although I don't think it's turing complete--which could probably be refactored into a more general filtering language which could be refactored into an even more generic FSA language which could likely be used to refactor a lot of other code.

      The other is to put complex decision making into user-space, but that involves context switches and other overhead. It also means lots of special-purpose and redundant code, and lots of documentation and complexity. The kernel uses both of those strategies extensively, one reason why it's so big.

      Generally speaking, context switches aren't a big deal in most OSs/kernels today. Yes, certainly having context switches means an extra overhead and stuffing some code or even all code in the kernel would certainly speed it up. And certainly if a lot more code moved into user space would be measurably slower. But kernel design today seems to try to have a balance between the two, especially with considerations of stability and security. The fact is, lots of code is special-purpose because it's for specific hardware. And code being redundant is more a function of maintaining multiple trees--which admittedly having a single kernel allows a lot of unity--but there's no reason that out-of-kernel-space means out-of-the-kernel-source if the code is still rather kernel specific.

      After all, the whole point is precisely that a lot of potential kernel code is "executed rarely and not performance critical" yet remaining outside kernel memory gives the system greater protection and hence speeds up development and generally makes the code easier to maintain. Documentation is a wholly separate beast, in any case, and that's more a point of maintainers or distributors demanding good documentation before code is accepted.

      Putting Lua+LuaJIT in the kernel is likely faster than either of th

      --
      Eurohacker European paranoia, gun rights, and h
    28. Re:Performance by WindBourne · · Score: 1

      If the scripting language generates C code, then not a big deal. And if it is for SLOW devices, then a simple scripting language will work for it as well.

      --
      I prefer the "u" in honour as it seems to be missing these days.
    29. Re:Performance by jythie · · Score: 1

      Actually Lua is pretty efficient (and restricted), which is one of the reasons it has become so popular for use in soft real time environments.

      True it is not going to be as efficient as C, but when we get to device drivers we are not necessarily talking 'every cycle counts' anymore and other considerations start to factor in.

    30. Re: Performance by jythie · · Score: 1

      To a significant degree, community, tradition, and domain knowledge. Kernels are generally written in C, so kernel and driver developers learn the language well and get used to using it in such an environment. If you want to do such development getting help from the community will generally come back in terms of C. This is not to say that the technological reasons are either good or myth, but things like community knowledge/support, examples, tools, APIs, etc, are non trivial factors.

    31. Re: Performance by jythie · · Score: 1

      On modern desktop and server chips? I disagree. There are places where assembly is still manageable, but such processors are too unpredictable to really take advantage of such things easily.

    32. Re: Performance by smittyoneeach · · Score: 2

      *BSD is dying. Perl6 is dying. If they'd just implemented a Perl6 interpreter in the NetBSD kernel, they could have immanentized the eschaton.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    33. Re:Performance by Anonymous Coward · · Score: 0

      It's more accurate to say that Linux developers only use C for Kernel programming, since System programming is more of a userspace-into-kernel thing and you can use whatever you want for that as long as it wraps the C libraries at some point.

    34. Re: Performance by GreyWolf3000 · · Score: 1

      Pointers are pretty essential to a kernel.

      --
      Slashdot: Where people pretend to be twice as smart as they really are by behaving like children.
    35. Re: Performance by tibit · · Score: 1

      On microcontrollers -- sure as heck I can beat any compiler in assembly, without using anything but paper and pencil, and an assembler (eventually). On a modern Intel core? Yeah, but it'll take me 10x longer than on a microcontroller, and I may need to use tools like cachegrind to check my work in progress.

      --
      A successful API design takes a mixture of software design and pedagogy.
    36. Re: Performance by Anonymous Coward · · Score: 0

      There was also some talk about CPU rearranging things in Herb Sutter's latest presentation. If you love low-level optimization, be sure to check that out.

    37. Re:Performance by Anonymous Coward · · Score: 0

      Perl is dying, Larry killed it.

      NetBSD confirms it. By their choice of scripting language, that is.

    38. Re:Performance by epyT-R · · Score: 1

      No thanks.. there're enough reasons already why today's software responds to input like a dying carcass on blazing fast hardware, especially compared with 15 years ago.. adding pointless latency in the kernel just to support lazy programmers who don't want to learn the proper tools for the job is a bad idea.

    39. Re:Performance by Anonymous Coward · · Score: 1

      Lua is designed to be a embedded companion language to C. You still use C where it makes sense (i.e. pointer manipulation/performance). You use Lua for expressing higher level logic more easily. Lua is very fast. Writing the same higher level logic in raw C might not be any faster because you have to build up all the infrastructure that Lua has already provided and optimized like associative arrays.

      Actually, Lua uses the intersection of ANSI C and C++. So it's also a companion to C++. It's embedded in a lot of C and C++ code including several operating systems and window managers. See Where Lua Is Used.

    40. Re: Performance by robthebloke · · Score: 1

      Thats exactly what people that can't program in assembly think. They are wrong.

      And yet every time I see some moron claim to be an ASM guru, I constantly see the same braindead mistakes. "Lookz, I've opteemized thees function call to make full use of XMM0 to XMM15". Brilliant. So you've basically halved the performance by disabling hyper-threading? Well done! These are the same kind of deluded idiots who still believe inlining code is an optimisation.

    41. Re: Performance by Kessler · · Score: 2

      Actually, the human brain can do it quite a bit better. This is just a myth people have embraced to justify never using assembly. The only real difficulty for humans is on Intel architectures where you have to deal with the machine conversion of legacy CISC instructions to the actual microinstructions executed by the processor core. On a proper RISC machine, I've yet to see a compiler that can out optimize a human.

      If you want a valid arguments against assembly try portability or programmer productivity.

    42. Re: Performance by Anonymous Coward · · Score: 0

      Pascal has pointers, too. Actually HP's MPE OS was written in some sort of Pascal.

      It's a shame they killed MPE. They had an extremely loyal user base because it worked like a breeze and was rock-solid. You could easily serve 10000 terminals with a large HP3000 machine running MPE.

      http://en.wikipedia.org/wiki/HP_Multi-Programming_Executive

      If you are an American and want to cry today, read this:

      http://3000newswire.blogs.com/3000_newswire/news_outta_hp/

    43. Re: Performance by maxwell+demon · · Score: 1

      The human brain can not visualize the pipeline like a compiler can.

      I seriously doubt the compiler can visualize anything. Actually, it would be a very inefficient way of compiling, given that computers are not that good in interpreting images.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    44. Re:Performance by stenvar · · Score: 1

      A lot of it is executed rarely because at least half the code is drivers

      And a lot of the non-driver code is executed rarely too.

      But, that's more in line with the point that precisely because kernels are generally developed so well, they rarely have "performance critical" code.

      The term "performance critical code" doesn't refer to "slow code" and is unrelated to how "well developed" a system is, it refers to sections of code that have a large impact on the overall performance of the system.

      And odds are good that having Lua+LuaJIT outside the kernel space yet in the kernel source would have virtually all the benefits and nearly none of the drawbacks.

      It has the disadvantages I mentioned: you get context switch overhead, and, more importantly, someone needs to actually define and support all the necessary interfaces for interacting with the kernel. It also only works once there can be user-space processes. Built-in Lua could help a great deal with getting a kernel off the ground, help with boot issues, etc.

      But, honestly, I'd feel it safe and saner if it were a language that was reducible to a FSA.

      Well, nice, but lots of other people disagree, there is no such tool, and nobody has shown that that is sufficient. Many kernels have been written in dynamic languages (Lisp, Smalltalk, others) or managed languages (C#, Modula-3), etc. So, having a Turing-equivalent managed language with dynamic typing and garbage collection in the kernel has ample precedent. In addition, the NetBSD developers thought it was a good idea. But Lua+LuaJIT gives easy kernel configurability and extensibility at near native speeds in maybe 300kb. You're welcome to try and come up with something better. I doubt that you can within the foreseeable future.

      Rationalizations like yours is why people don't bother doing this or much else innovative for Linux anymore. Linus comment on what new functionality came in 3.0 was "NOTHING. Absolutely nothing." And it shows. As a long-time UNIX (and I mean UNIX) hacker, I find Linux has turned into a ridiculous Rube Goldberg contraption, of workarounds on top of patches, much of it meant to stick to a design and design constraints that were relevant in the 1970's.

    45. Re:Performance by Anonymous Coward · · Score: 0

      There is no Objective-C in the OS X system code, however the driver framework is based on a subset of C++.

  5. long overdue by stenvar · · Score: 4, Interesting

    This is a good thing, and it's long overdue. Linux should do the same.

    It's actually pretty easy to get Lua running in the kernel and call kernel APIs; but to make it really useful, it needs additional kernel hooks and callbacks, and that requires cooperation from the core kernel developers.

    1. Re:long overdue by Anonymous Coward · · Score: 3, Interesting

      Exactly.

      With certain algorithms I have LuaJIT code that runs faster than the best C code I can create (I'm speaking with 25+ years of C experience here).

    2. Re:long overdue by Anonymous Coward · · Score: 0, Troll

      Sounds like you fail at programming in general, including algorithm selection, if what you say is true.

    3. Re:long overdue by Anonymous Coward · · Score: 0

      Yes, if i had a choice between JS and Lua to script Lua would win in this case. Lua is lightweight and extensible enough to get the job done.

      Class in lua:
      Account = class(function(acc,balance)
      acc.balance = balance
      end)

      Class in js:
      function MyClass(){
      }
      MyClass.prototype.aFunction(){
      }

      That's not to say one is better than the other however the lua example is way more "C" wrapper friendly. Of course using all sorts of JS libraries you get tons of help with things like that. I would prefer CoffeeScript kernel support than plain JS if it had to run in JS. I could easily see on NetBSD something like node.js server-side code written with this new Lua support- I'm interested at looking at some benchmarks now.

    4. Re:long overdue by Anonymous Coward · · Score: 1

      Sounds like you fail at understanding the tradeoffs between being locked into static code determined at compile time for vs. code that can be dynamically optimized at runtime based on things like available hardware and current invariants.

    5. Re:long overdue by Anonymous Coward · · Score: 3, Interesting

      LuaJIT can be seriously fast. But usually when C is slow, it's some compiler flag, or perhaps a bunch of unpredictable branches or random access pattern in the inner loop.

      Pretty often the LuaJIT trace machine code generated is similar to what you'd get from gcc. That's how good it is.

    6. Re:long overdue by tibit · · Score: 0

      Lua by itself is pretty abysmal, performance wise and IMHO, but LuaJIT is perhaps the best thing since sliced bread. I've been playing with the recent 2.0 release on ARM, and it looks like I may quite comfortably write a big chunk of an industrial process controller in Lua. Now that's something. No more messing with IEC PLC programming languages that are still stuck in the 80s.

      --
      A successful API design takes a mixture of software design and pedagogy.
    7. Re:long overdue by tibit · · Score: 1

      Especially that the trace is equivalent to gcc profile-guided optimizations. It can rock your world.

      --
      A successful API design takes a mixture of software design and pedagogy.
    8. Re:long overdue by stenvar · · Score: 2

      I don't know what you mean by "pretty abysmal, performance wise". Lua is one of the fastest scripting languages around, even without LuaJIT.

    9. Re:long overdue by Anonymous Coward · · Score: 1

      Linux should do the same.

      There is a similar project for Linux. See ljsyscall.

    10. Re:long overdue by sourcerror · · Score: 2

      I would be happier if the major window managers supported Lua. I'm not sure I would want to mess with device drivers.

    11. Re:long overdue by synthespian · · Score: 0

      Sounds like you are unaware of the algorithm benchmarks regarding Lua's register-based JIT.

      Sounds like you are unaware that heavy-players in the video game industry *all* mix & match Lua and C++ for their engines.

      Wow! You must know something we don't! Why don't you get a job in a big software house in the games industry and tell them how *wrong* they all are?

      --
      Main difference between the BSD license and the GPL license: one is from California and the other is from Massachusetts
    12. Re:long overdue by stenvar · · Score: 3, Insightful

      It's not mainly for messing with device drivers (although it may be useful for that too).

      It's mainly useful for all the stuff that people right now create /proc devices, ioctls, and user-level kernel-related daemons for. Those mechanisms are both slow and complicated. With Lua in the kernel, a lot of that stuff can be handled much more easily, without the overhead of context switches and with much less code.

      It probably won't replace all the bloated configuration stuff that already exists, but at least when writing new device drivers and new functionality, developers could save a lot of time and effort.

    13. Re:long overdue by flimflammer · · Score: 1

      Sounds like you are an idiot.

    14. Re:long overdue by Anonymous Coward · · Score: 0

      Care to provide some examples?

    15. Re:long overdue by AuMatar · · Score: 3, Insightful

      They use Lua for the non-performance effecting parts of games. They'd never consider using it in the graphics code, which is the bottleneck.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    16. Re:long overdue by Anonymous Coward · · Score: 0

      Which is exactly the problem with this idea in a nutshell. The low-level driver code is the same place where you're going to run into a bottleneck using something like Lua, yet the people who are proponents of the idea seem to plug their ears and hum loudly any time you mention it, or the potential security issues...

    17. Re:long overdue by Anonymous Coward · · Score: 0

      Lua by itself is pretty abysmal, performance wise and IMHO,

      This is very wrong. Standard Lua, without LuaJIT, is one of the fastest widely used scripting languages out there, by a long shot. It blows Python / Ruby / etc out of the water.

      For serious number-crunching loops, etc, LuaJIT can be even faster (on par with optimized C in a few cases), but in many applications LuaJIT doesn't actually speed things up much, and you're probably better off using standard Lua (LuaJIT has some problems of its own, such as reduced memory space due to a somewhat suboptimal nan-encoding design)

    18. Re:long overdue by jythie · · Score: 1

      Years ago yes, but increasingly, as it has proven itself, Lua has made it deeper and deeper into the code and is increasingly being used in time constrained sections.

    19. Re:long overdue by samkass · · Score: 2

      They use Lua for the non-performance effecting parts of games. They'd never consider using it in the graphics code, which is the bottleneck.

      Does World of Warcraft lay out its entire UI with LUA? Then render the actual 3D graphics with C/C++? Isn't that exactly like what we're talking about here for drivers-- high-level control in LUA and the heavy lifting in C?

      --
      E pluribus unum
    20. Re:long overdue by shutdown+-p+now · · Score: 1

      A lot of low-level driver code is not actually performance-critical. Sure, you don't want to be writing video or audio drivers in this thing, but for something that just needs to send a bunch of commands over USB, why not?

    21. Re:long overdue by shutdown+-p+now · · Score: 1

      Lua is one of the fastest bytecode interpreted scripting languages around. Which is a pretty low bar when you compare to even mediocre JIT VMs, not even to mention precompiled code.

    22. Re:long overdue by tibit · · Score: 1

      But I'm not comparing it to scripting languages -- I'm comparing it to other things that are in use in a particular application domain. In industrial process control, there's generally no distinction between a scripting vs. non-scripting language. Everything is written in the same environment, and the languages all translate to same byte code that is then either run on a bytecode VM or compiled to native code. If you want to get rid of that, you can't just get rid of a small part of it -- it's not worth it. Either you keep using the existing environment, or you replace it wholesale with Lua. With LuaJit, I see performance that generally makes the codesys mess redundant.

      --
      A successful API design takes a mixture of software design and pedagogy.
    23. Re:long overdue by tibit · · Score: 1

      Legacy codesys-based industrial PLCs, where I evaluated LuaJit as a replacement, have arrays limited to 64 kbytes in size, even when targeting 32 bit Intel platforms. Whatever limitations LuaJIT has, save for 2.0 teething pains, are not even on my horizon :)

      --
      A successful API design takes a mixture of software design and pedagogy.
    24. Re:long overdue by macshit · · Score: 1

      Lua by itself is pretty abysmal, performance wise and IMHO

      This is wrong. The standard Lua implementation is one of the fastest widely used scripting languages out there, by a long shot. It blows python, ruby, etc, out of the water.

      LuaJIT can be even faster (sometimes on par with optimized C), particularly number-crunching loops, but in many cases, it doesn't really offer much speedup over standard Lua. [and of course LuaJIT has some drawbacks compared to normal Lua, like increased complex, reduced portability (if you rely on LuaJIT specific features), and a smaller maximum memory limit due to details of its nan-encoded object representation.]

      --
      We live, as we dream -- alone....
    25. Re:long overdue by DMiax · · Score: 1

      If you compare the bytecode interpreter to other bytecode interpreters, Lua is one of the fastest. If you compare the JIT compiler to other JIT compilers, Lua is one of the fastest, i.e. at the level of the best Javascript compilers (the most used and optimized scripting language around). What is your point?

    26. Re:long overdue by Anonymous Coward · · Score: 0

      We use it wherever it makes sense. Graphics code is not "the bottleneck". There are no non-performance effecting [sic] parts of games. Nor is there a clear delineation between graphics code and non-graphics code. Plenty of games use Lua in "the graphics code". And LuaJIT is really really fast, by the way, did anyone mention that? Oh yeah, that's the subject of this thread. ... but you did construct a syntactically correct couple of sentences.

    27. Re:long overdue by robthebloke · · Score: 1

      Sounds like you are unaware that heavy-players in the video game industry *all* mix & match Lua and C++ for their engines.

      And every single game team that has used lua extensively, soon ends up regretting it. I've yet to see a single game actually ship using a vanilla version of lua. Without exception, every dev studio I've seen has been forced to make extensive modifications to the garbage collector. Hell, I've even seen some games ship using scripts that are not allowed to create anything on the lua stack at all. one example that sticks out: We had 8 x Vector3, 8 x Matrix, 8 x quaternion, all as static objects within a lua state machine. All scripts had to use one of those pre-defined vars. All of that to avoid the complete idiocy of the language for real time purposes. Although it's often quoted as being good for real time applications, that's actually very wide of the mark. I cartainly won't be making the mistake of using lua in a game engine ever again.....

    28. Re:long overdue by robthebloke · · Score: 1

      Lua by itself is pretty abysmal, performance wise

      So far, this is the truest statement anyone has made in this thread.

    29. Re:long overdue by Anonymous Coward · · Score: 0

      I would be happier if the major window managers supported Lua. I'm not sure I would want to mess with device drivers.

      Not the major window managers yet, but it's used in Awesome WM (a good part of the WM is written in Lua and it uses Lua for config files), Ion WM has been extensible and configurable with Lua since v. 2.0.; ditto for its fork, Notion. And the wmii WM can be extended with wmii-lua.

    30. Re:long overdue by robthebloke · · Score: 1

      Lua is one of the fastest scripting languages around

      However it has wildly varing performance characteristics between sucessive runs of exactly the same byte code. Sometimes it's super fast, other times you'll see a +200ms spike in execution time for absolutely no reason what so ever. For real time purposes, it's a very painful language to work with.

    31. Re:long overdue by maxwell+demon · · Score: 1

      Then render the actual 3D graphics with C/C++?

      I would have guessed that they render the actual 3D graphics with Direct3D or OpenGL on the graphics card.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    32. Re:long overdue by stenvar · · Score: 1

      Either you keep using the existing environment, or you replace it wholesale with Lua. With LuaJit, I see performance that generally makes the codesys mess redundant.

      Maybe in "industrial process control" you can afford to throw out everything and start over. But Linux has tens of thousands of kernel developers and billions of deployed devices: C needs to stay. However, once a tool like Lua were in the kernel, one could incrementally migrate functionality to it and reduce kernel bloat. And long time experience with kernels written in dynamic languages shows that you need a small core of routines written in a C-like language. You might as well keep C for that, instead of inventing something completely new.

    33. Re:long overdue by stenvar · · Score: 1

      The spike is probably due to garbage collection. And you're right that that can be a problem for real-time applications. But the Linux kernel isn't real-time anyway, and for most uses of Lua in the kernel, this wouldn't matter.

      I would expect that, over time, people would change the Lua interpreter for kernel use (it's small and simple), which might include adding a real-time garbage collector.

    34. Re:long overdue by Anonymous Coward · · Score: 0

      but then why Lua? FORTH would be a so much more obvious choice and it guarantees that the users know what they are doing.

    35. Re:long overdue by Anonymous Coward · · Score: 0

      The settings and control part of both driver would not take a performance hit by using lua but they would be easier to read maintain and augment.

    36. Re:long overdue by ultranova · · Score: 1

      Sure, you don't want to be writing video or audio drivers in this thing, but for something that just needs to send a bunch of commands over USB, why not?

      From what I've understood, the current bottlenecks in FOSS video drivers have to do with shader compilers, which seems exactly the kind of situation where trading some execution speed for development speed would be reasonable. And really, that's to be expected: since the whole point of a video driver is to offload work to the graphics card, it would be strange if its own execution speed on the CPU would be particularly relevant.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    37. Re:long overdue by shutdown+-p+now · · Score: 1

      The post to which I replied ended with "... even without LuaJIT". My point is that Lua bytecode interpreter may be the fastest in its class, but its performance is nevertheless abysmal compared to C or even Java, just like any other bytecode interpreter.

    38. Re:long overdue by Anonymous Coward · · Score: 0

      You sound like those Java shills "memory is not scarce, anyway". Yes, Linux is not hard-realtime capable, but it is highly responsive because they have no GC crap in the kernel. It's called "Soft Realtime".

    39. Re:long overdue by stenvar · · Score: 1

      I wouldn't call Lua performance without a JIT "abysmal" compared to C or Java. In terms of runtime on inner loops, it's usually about 5-10x slower, which is pretty good for an interpreter. But that is only one performance measure. Once data structures and libraries get into the picture, any speed advantage of C/Java quickly disappears because those are native in Lua anyway. And even plain Lua beats both equivalent C and Java code on code size and code complexity by 1-2 orders of magnitude, and that often has a big effect on overall performance of a system as well.

      And Lua in the kernel isn't trying to replace C, it is trying to complement it. And it's a good complement, because Lua (or Lua+LuaJIT) is tiny, but would allow the kernel to become much smaller and simpler by throwing out a lot of code that C just isn't very good at.

    40. Re:long overdue by tibit · · Score: 1

      That's true of course.

      --
      A successful API design takes a mixture of software design and pedagogy.
  6. April First came early this year.... by Anonymous Coward · · Score: 0

    Apparently the groundhog is really off his game :D

  7. Wow, I bet the performance will be fabulous by Anonymous Coward · · Score: 0

    And it gives me great confidence to install kernel components from developers who aren't able to master C.

  8. What, it's april already? by Anonymous Coward · · Score: 0

    On the one hand, well, wanting to reach out to "users" is purdy nice and all that, yanno. On the other hand, the consequences of running lua with kernel privileges, written by people not good enough to grok C pointers? I think they've gone off their rocker.

    Then again, weird stuff's been done before in this realm. I recall something about SCSI drivers written in perl, until they got around to redo it in C. So hey, innovation and all that, let's give them a chance. We'll see if this stands. Though I do suspect it'll go down in flames before not all that long.

    1. Re:What, it's april already? by synthespian · · Score: 1

      Apparently, a lot of people in the software business have trouble with pointers. That includes Linux, and its many, many security breaches and flaws in its history. Of course, I'm not calling people stupid. I'm simply stating what is widely known. Safe programming is hard. Pointers are error-prone. People who deny that are either superbly arrogant or ignorant of the many serious events in the software industry. If you can avoid unsafe code by using a safer language, than you ought to. You don't seem to have read this bit: "No access to kernel memory, -functions but through predefined binding."

      Your assuming NetBSD developers are morons shows how ignorant you are. Have you ever even looked at *BSD system code?!

      --
      Main difference between the BSD license and the GPL license: one is from California and the other is from Massachusetts
  9. Fucking LOL. by Anonymous Coward · · Score: 1, Funny

    Why LUA? Why not implement BASIC while you're at it?

    This is one of the most retarded ideas I have ever heard. I'm sorry, but kernel level stuff should be kept as close to the machine hardware as possible, and that means using C or assembly. Deal with it. If you can't be bothered to learn C like a real goddam programmer, then you have no fucking business sticking your head in something as complicated as an operating system kernel.

    I swear to god, this mentality of "let's appease everyone, including the idiots who aren't smart enough to figure it out as it is right now" needs to stop. If you can't grasp C, then kernels are off limits to you. Either you lack the ambition to learn C, or you're too stupid to comprehend it- in which case you're going to be useless drifting around the kernel source code anyways.

    So what the hell is wrong with saying "no, sorry, you're too stupid to understand this"?

    1. Re:Fucking LOL. by Anonymous Coward · · Score: 3, Funny

      Linus?

    2. Re:Fucking LOL. by Anonymous Coward · · Score: 0

      Your view is completely outdated - we're not coding in the 80's any more. Clearly you have no experience with Lua as a language either... or touched any kernel code for that matter. Perhaps you should educate yourself on the subject you're commenting on instead of making backward statements that do nothing more than expose your inexperience.

    3. Re:Fucking LOL. by Anonymous Coward · · Score: 0

      Your medication. Take it now.

    4. Re:Fucking LOL. by Anonymous Coward · · Score: 0

      Hey, don't poke fun until you've tried it. After all, I love their LOGO interface for the kernel. I've spent many an hour making that turtle submit to my will.

    5. Re:Fucking LOL. by jbolden · · Score: 1

      Why LUA? Why not implement BASIC while you're at it?

      You meant that sarcastically but you do realize in the CP/M and early PC days BASICs were implemented in hardware!

    6. Re:Fucking LOL. by MichaelSmith · · Score: 1

      BASICs were implemented in hardware!

      WTF? My 6502 system had BASIC in the ROM, not the CPU.

    7. Re:Fucking LOL. by Anonymous Coward · · Score: 0

      that's not true. basic being stored in rom != "implemented in hardware".
      if it were, then i could say that linux is "implemented in hardware."

    8. Re:Fucking LOL. by Anonymous Coward · · Score: 0

      BASICs were implemented in hardware!

      WTF? My 6502 system had BASIC in the ROM, not the CPU.

      Obviously jbolden doesn't grasp the difference between "hardware" and "software burned into a ROM" (somewhat the original definition of "firmware", although flash drives and the like blur that distinction).

    9. Re:Fucking LOL. by Anonymous Coward · · Score: 0

      Nothing.

      No, sorry, you're too stupid to understand this.

      See?

      kernel level stuff should be kept as close to the machine hardware as possible

      Should? What does "should" mean? You are characterizing your own model of what the kernel is. That model is incorrect - look it up if you don't believe me. Nowhere in Operating Systems: 945th Edition does it mention this is an essential feature of kernel software. So, you are saying "kernels needs to follow my incorrect internal model of what kernels are". No. They don't.

    10. Re:Fucking LOL. by robthebloke · · Score: 1

      Google "The complete spectrum ROM disassembly", turn to page 84, now explain to me what the Z80 machine code starting at memory address 0x1A48 is for.... (or just read the book, and it will tell you).

    11. Re:Fucking LOL. by Blaskowicz · · Score: 1

      Lol, the C language is just BASIC with pointers. == vs =, and string handling functions moved to a separate library.

    12. Re:Fucking LOL. by jbolden · · Score: 1

      That's what I meant. Rewriting the NetBSD kernel in Lua would be the analogy to having BASIC in the CPU.

    13. Re:Fucking LOL. by Anonymous Coward · · Score: 0

      Are you... are you the person responsible for all these people calling the computer "the CPU"? If so, I'd like to have you assassinated.

    14. Re:Fucking LOL. by jbolden · · Score: 1

      Nope that predates me that goes back to the days of analog computers. Processing units were parts of a computer where calculations took place. Other parts of the computer might be systems that for example wrote tape to greenbar or the parts that handled input from remote terminal units.

      A central processing unit comes from the digital age. It was the unit that contained all the transistor boards that made up the processing unit. Additional processing units might exist in other system but the central one was expensive.

      Once you had microprocessing most systems had a single chip responsible for program execution and that took on the name "CPU". Other people continued to refer to the entire box containing the processing transistors as the CPU.

      ____

      And I have no idea what this has to do with me.

    15. Re:Fucking LOL. by ultranova · · Score: 1

      kernel level stuff should be kept as close to the machine hardware as possible,

      Why? How much time does the CPU spend running kernel code vs. user code? 1%? If it slows to half speed, and takes 2% instead, is that actually detectable?

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

  10. Great idea. by Meshugga · · Score: 5, Interesting

    I honestly think that this is a great idea. It's a novel approach to extending a kernel, especially considering NetBSD doesn't have that big of a market share and expressly focusses on supporting as many platforms as possible. Prototyping new features or certain drivers in a portable scripting language may give them a leg up in the functionality aspect of the race.

    Also, LUA is super fast, small, easy to learn, concise and the C API/embedding it is straight forward.

    You may knock it all you want, "because kernel land is C land", but after all bias being said and flamed, this may turn out to be a really fun, interesting and possibly very useful idea.

    1. Re:Great idea. by Anonymous Coward · · Score: 0

      BTW SUN did about the same thing with Forth, where the OS called the pseudo-Firmware. ... ??? OpenProm ???

      MFG, omb

    2. Re:Great idea. by WindBourne · · Score: 1

      Exactly. For SLOW items, or brand new items, this might be a way to have a QUICK interface developed. And if a code generator simply kicks out c-code that is compiled in, then it may work for even medium speed items.

      --
      I prefer the "u" in honour as it seems to be missing these days.
  11. My P4 by Anonymous Coward · · Score: 1

    I have an old P4 with 512MB and FreeBSD with no desktop: I do everything from a terminal - old school. It runs wonderfully.

    I would really hate to install a package that uses this Lua to extend the kernal (and god knows what security issues that will bring up!) and have that system slow down to the point where I can't use it.

    See folks, I keep my hardware until the wheels fall of and then some. There's very little of MY old hardware polluting third world countries and I'm cheap - this buying the latest and greatest thing is just a waste of money.

    If *BSD turns into something that I can't use on old hardware anymore, I'll be really sad.

    1. Re:My P4 by jones_supa · · Score: 2

      That sounds quite cool, but how can you cope with only the terminal?

    2. Re:My P4 by MacTO · · Score: 3, Interesting

      It depends upon what he needs the computer for. If it is a server, then there is no need for a GUI. Even with respect to application software, there are a multitude of options out there. Writing can be done in text editors, then processed with TeX or troff (for formatted output to a printer, when necessary). There are a multitude of email clients and several web browsers. I've never really tried it, but you can even do graphical design with languages like PostScript and POV. Media? Again, you have access to many audio players. It's much more gimmicky in nature, but you can even play videos on text consoles.

    3. Re:My P4 by MacTO · · Score: 2

      And, of course, very few development tools actually depend upon a GUI.

    4. Re:My P4 by Osgeld · · Score: 1

      oh no not a P4, that thing is like stone age!

      seriously though I often use lua on a 90Mhz pentium1 8 meg laptop for various test's where I may need to log data once an hour for 3 months and I dont want to waste a real computer

      its faster than qbasic, its hardly noticeable against a poorly written compiled program, its not even terrible to a decently written compiled program. lua is a pretty darn fast interpreted language, and since its all bound to C on the backend anyway its easy to rapid develop with lua and strip it away later

    5. Re:My P4 by Anonymous Coward · · Score: 0

      Lua is small and efficient and worked well in commercial video games way back even before your P4 existed.

      Lua's code base is tiny (less than 20k lines) and thus is easily audit-able for bugs and security issues. And Lua scripts cannot access anything that the C host program does not give them explicit access to. Due to sheer lines of code and complexity, chances are any security issues will be in the kernel itself, not Lua.

      Memory exploits (used as common attack vectors) are often caused by programmers making mistakes. Using Lua may reduce those mistakes since any sensible scripting binding should insulate scripters from dealing directly with pointers.

    6. Re:My P4 by jones_supa · · Score: 1

      How does the video playback work? By outputting to a frame buffer? Is it smooth?

    7. Re:My P4 by jythie · · Score: 1

      Actually, if it is done right, the Lua module would probably provide a better security barrier then regular kernel modules. The interpreter is also pretty small, and lua is pretty compact/efficient. It is unlikely that this capability would tip your system from 'fine' to 'slow'.

    8. Re:My P4 by larry+bagina · · Score: 1

      AAlib. Also see Text-Mode doom

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    9. Re:My P4 by jones_supa · · Score: 1

      *Facepalm*

    10. Re:My P4 by robthebloke · · Score: 1

      lua is a pretty darn fast interpreted language, and since its all bound to C on the backend anyway its easy to rapid develop with lua and strip it away later

      Until the garbage collector kicks in, and then you start can start crying. Squirrell is a much better choice imho.

    11. Re:My P4 by Anonymous Coward · · Score: 0

      mplayer -vo caca thingy.mp4

      or -vo aa, they're slightly different, can't remember how so...

  12. Re:The Truth About Adobe and The US by Anonymous Coward · · Score: 0

    Adobe had a lot more to do with the human rights abuses of the last decade than most people realize

    I agree, celebrities are dressing like tramps these days for the paparazzi sites.

  13. Does this mean... by Anonymous Coward · · Score: 1

    ...there will finally be something Perl CAN'T do?

  14. Uhm... by noobermin · · Score: 1

    Okay, sure. But...why Lua? :/

    1. Re:Uhm... by Fuzzums · · Score: 1

      Indeed. What is wrong with java script?

      --
      Privacy is terrorism.
    2. Re:Uhm... by Anonymous Coward · · Score: 0

      Lua was designed to be embedded in C applications. Javascript was not designed to be embedded at all (hence no standardized C-API in Javascript). Lua is among the fastest of scripting languages. Javascript tends to be among the slowest. (And every time they manage to speed up Javascript with JIT, LuaJIT blows it away again.)

    3. Re:Uhm... by Anonymous Coward · · Score: 0

      There's nothing wrong with Javascript, there's just that Lua already has this: http://www.luajit.org/ext_ffi.html

    4. Re:Uhm... by Pinhedd · · Score: 1

      LUA is an extremely fast scripting language that was designed to be embedded in C.

      It can probably be used to handle the non-realtime components of the kernel quite easily

    5. Re:Uhm... by Pinhedd · · Score: 1

      There's nothing wrong with Javascript

      Very funny

    6. Re:Uhm... by shutdown+-p+now · · Score: 1

      Because it's written entirely in portable ANSI C, very small, and very fast?

    7. Re:Uhm... by tibit · · Score: 1

      Because it's a language that's not really good for anything. It's widely used because there are no alternatives, not because it's particularly good. It wasn't really designed by people who had solid foundations of programming language design, and it wasn't designed to solve the particular problems that the web is facing in the long term. It has been kludged to work. Just look at how much effort it takes to efficiently JIT that thing. Lua's JIT is almost trivial in comparison, yet produces very decent code.

      --
      A successful API design takes a mixture of software design and pedagogy.
    8. Re:Uhm... by seebs · · Score: 1

      Fast, simple, portable, good licensing terms, specifically designed to be easily embedded, more than one implementation available.

      --
      My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/
    9. Re:Uhm... by Anonymous Coward · · Score: 0

      What is wrong with java script?

      What isn't?

    10. Re:Uhm... by Anonymous Coward · · Score: 0

      The bad parts.

  15. Am I blind? by Anonymous Coward · · Score: 1

    For I cannot see any actual purpose for doing this. Just because you can run Lua script in the kernel does not mean that you SHOULD. And also, I could really not give a rat's ass that some script kiddie finds kernels too hard to mess with. (Awwww, poor widdle script kiddie...) There's a reason even I don't muck around in the kernel, and I do software dev in C and C++ amongst other compiled and scripted languages...

    Please do NOT bring this type of feature into the Linux kernel.

    1. Re:Am I blind? by Anonymous Coward · · Score: 0

      Please do NOT bring this type of feature into the Linux kernel.

      Dramatic music...

  16. Is there a shark jumping contest going on? by Anonymous Coward · · Score: 0

    This looks like a symptom of Zawinkski's Law: http://catb.org/jargon/html/Z/Zawinskis-Law.html

  17. This is cool already, but with RUMP, OMG by Anonymous Coward · · Score: 2, Insightful

    This is awesome. What is old is new again. Lisp machines were some of the most beloved equipment for os and ai hackers because of the ability to get to the underbelly easily. This is no different. Making the operating system more approachable makes doing operating systems research easier. This is a great idea.

    Besides, it's a natural extension of the RUMP kernel paradigm. If you can run a netbsd kernel, as part of a userspace process on linux, then it only makes sense to be able to talk to these 'kernels' under the hood easily. THIS IS WAY FRIGGING COOL.

  18. Natural Selection 2 by Anonymous Coward · · Score: 0

    After playing Natural Selection 2 on the Spark engine, I'm not at all surprised more projects are taking up LUA.

    NS2 is 95% LUA and runs incredibly fast for what its doing.

  19. Modifying C? by Osgeld · · Score: 1

    I dont know what packages are going to be bound with this, but in many cases your right back in C adding bindings for lua. Thats one of the good points about lua, is that it can be tied to anything, but the bare bones basic lua is not too much more complicated than a batch file

  20. Why Lua? by Anonymous Coward · · Score: 0

    From TFA:

    Rather than Lua, other language possibilities were Python and Java. Python is not difficult to integrate with C but has problems with being a huge library, memory consumption, and difficult object mapping. Java is easy to write but also poses problems with object mapping and memory might be an issue, but it's worked out before for driver development.

    1. Re:Why Lua? by flimflammer · · Score: 1

      Because Lua suffers from none of those shortcomings.

  21. Tags by Areyoukiddingme · · Score: 5, Funny

    Surely this article deserves the whatcouldpossiblygowrong tag more than any other this year. And possibly last year too...

  22. A positive development by Anonymous Coward · · Score: 0

    This is excellent imho because I will now be able to code NETBSD kernal extensions so I can run a Beowulf cluster of naked and petrified hot grits on my Natalie Portmen! All the while you people are complaining about the inefficiencies of using LUA in a kernal, you are forgetting about the thousands of people who have died from a terrorist attack! GET SOME PRIORITIES!

    1. Re:A positive development by Anonymous Coward · · Score: 0

      Um, they're dead. We're not.

    2. Re:A positive development by Anonymous Coward · · Score: 0

      In Soviet Russia, the kernel develops you!

    3. Re:A positive development by Anonymous Coward · · Score: 0

      For f***k's sake, let it go! These meme should have died long ago.

  23. Wikipedia (MediaWiki) is also deploying Lua by yurik · · Score: 2

    MediaWiki developers are almost ready for Lua scripting to be enabled for all Wikipedia and related sites, and It has already been deployed to http://mediawiki.org./ Lua was chosen mostly because of how easy it is to sandbox and limit memory consumption.

    http://www.mediawiki.org/wiki/Lua_scripting/Tutorial -- Introduction

    1. Re:Wikipedia (MediaWiki) is also deploying Lua by devent · · Score: 1

      MediaWiki is written in PHP. We should all include PHP in our kernels. PHP was chosen because of the easy of deployment, and popularity.

      http://php.net/ - Introduction

      --
      http://www.mueller-public.de - My site http://www.anr-institute.com/ - Advanced Natural Research Institute
    2. Re:Wikipedia (MediaWiki) is also deploying Lua by JDG1980 · · Score: 1

      MediaWiki developers are almost ready for Lua scripting to be enabled for all Wikipedia and related sites

      Anyone can edit Wikipedia. Allowing anonymous users to do active scripting on one of the Internet's top 10 most populat websites doesn't strike me as the best idea...

    3. Re:Wikipedia (MediaWiki) is also deploying Lua by Anonymous Coward · · Score: 0

      Anyone can edit Wikipedia, have their edits reviewed by someone with a specific bias on the subject, and then deleted.

      FTFY.

      In all seriousness, not anyone can edit Wikipedia. In fact it's getting so no one can. So ... not a big issue to allow scripting.

  24. Sorta interested in this... by seebs · · Score: 1

    I like to think I'm okay at C. I certainly don't generally find it particularly intimidating. I've written kernel code, though not much. I maintain a program that emulates root privileges by intercepting syscalls -- and which works on Linux and OS X. I'm basically clear on how this works.

    But when I do iOS/Android stuff, I have a pretty strong preference for Lua, because I don't always want to be thinking about pointers. And yes, LuaJIT is... plenty fast. The mere fact that it's a JIT implementation means that it can beat precompiled code for real use cases, and even when it doesn't, it's not as though it's particularly slow.

    Don't assume this is only of interest to people who think C is hard. C's by far the language I'm best in, and I still see plenty of appeal here.

    --
    My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/
    1. Re:Sorta interested in this... by AuMatar · · Score: 1

      You realize that in most of those higher level languages *everything* is a pointer. So you're not actually saving yourself anything except calls to delete. Most of the difficult parts of pointers you still need to worry about.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    2. Re:Sorta interested in this... by bussdriver · · Score: 1

      Me too and I'm not interested in learning Lua or more APIs. I think C is where it should remain; however, this could prove extremely useful for development, debugging and experimentation - especially for any kind of driver. I think it should be an option; although, it is likely many users would turn it on because of the number of drivers or features that would not have been ported to C yet. Eventually, things can be ported or even automatically translated to C code. For rapid and more stable development, I'm all for it; as a replacement for C I am not. Stability and security 1st. speed 2nd... but I do want speed eventually.

    3. Re:Sorta interested in this... by seebs · · Score: 1

      I have tried several times to figure out what on earth you are saying, and I've come up empty.

      In C, it is possible for me to allocate an object, fail to free it, and end up having leaked memory. It is also possible for me to retain a pointer to something that was freed, and get surprising behaviors from that. I can overrun buffers. Heck, I occasionally do, although it's usually pretty rare for me.

      None of these are possible in Lua.

      I am not sure what the "difficult parts of pointers" you're thinking of are, but I write a fair bit of Lua, I never worry about pointers in it, and I don't have any problems.

      --
      My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/
    4. Re:Sorta interested in this... by tibit · · Score: 1

      Huh? So obviously in those "higher level languages" you can trivially generate pointers that will let you overwrite your stack, or alias some variables the compiler presumes you'll not alias, or write past the end of the array (or before its beginning), etc? Because, you see, those are the problems that stuff in C and C++ runs into, never mind memory leaks and use of freed memory.

      --
      A successful API design takes a mixture of software design and pedagogy.
    5. Re:Sorta interested in this... by Anonymous Coward · · Score: 0

      I am not sure what the "difficult parts of pointers" you're thinking of are

      I think he's probably a terrible programmer who struggles to understand the most basic of basic concepts such as indirection. He probably also trembles in fear at the thought of recursion, and considers closures a black and esoteric thing wherein mortals were not meant to dabble.

      To such people, "the difficult parts of pointers" means things like "the fact that 'a = b; a.x = 2' might change 'b.x' as well".

      There are a lot of people like that around, people who somehow consider themselves programmers even though they have not the slightest ability to think in abstract terms. And between them they write 80-90% of the programs and websites you have to use every day. A cheerful thought.

    6. Re:Sorta interested in this... by K.+S.+Kyosuke · · Score: 1

      You realize that in most of those higher level languages *everything* is a pointer.

      Uhm, no. In Haskell, for example, everything is a mathematical value, and for the most of the time, you don't care how the runtime sorts things out.

      --
      Ezekiel 23:20
  25. Re:Stupid NOT by Anonymous Coward · · Score: 5, Interesting

    I don't know how much Unix/BSD/Linus code you have read or written, but I have been developing core code, Scheduler, MM and Drivers since 1980 and this is a great idea, long overdue.

    The Abstractions are now well understood and most code dos't need to be quick, but safe, putting PRE in kernels will clean up acres of cockamamie code now written in C, most of which just runs at boot time and is then freed. ... there are exceptions, you cant't have the garbage collector running whenever it likes, eg in the middle of an interrupt routine, but managed memory, not C, C++ scoping is the way to stop slow memory leaks.

    Put simply you are an idiot and dont know what you are talking about.

    MFG, omb

  26. WTF? by Anonymous Coward · · Score: 0

    I mean, seriously, WTFF? Come back and see me when your kernel also allows LISP and OO-COBOL. I could use a good laugh.

    1. Re:WTF? by rubycodez · · Score: 1

      you are pretty ignorant if you think COBOL or LISP compiled to assembly is slower than C code

    2. Re:WTF? by fionbio · · Score: 1

      There was very advanced and expensive Lisp OS once http://en.wikipedia.org/wiki/Genera_(operating_system)

    3. Re:WTF? by Anonymous Coward · · Score: 0

      Not necessarily ignorant, no mention at all was made of performance. I happen to agree with this sentiment simply because the mindset of a kernel programmer is far more likely to be found in someone who can understand C than it is in someone who cannot understand C and prefers COBOL or LISP.

      I'll note in passing that the Lua home page states "Several benchmarks show Lua as the fastest language in the realm of interpreted scripting languages" which isn't really aspiring to blow something like C out of the water.

      Don't get me wrong, there's a definite place for languages like this, especially if they can speed up the development process by providing higher level abstractions than C. I'm just not entirely convinced an OS kernel is the right place for such stuff.

    4. Re:WTF? by Anonymous Coward · · Score: 0

      LISP compiled to assembly is slower than C code. This is a general fact. There are good and bad C compilers and good and bad LISP compilers, and a good LISP compiler might beat the worst C compiler on very carefully tweaked LISP code, but the best C compiler and the best LISP compiler are not even comparable in performance for code written in natural idioms of each language. You are pretty ignorant if you think they are - it's a typical case of "received wisdom" which isn't even remotely true and which the merest effort at investigation would uncover as false.

  27. Re:users? Total Confusion, nonsense by Anonymous Coward · · Score: 0

    The B5000 produce in the 1970s had I/D spaces, and ran pseudo Algol machine code, emulated by hardware, they had zero-days too.

    Intel has had an execute permit bit in the page tables for 10 years, but both GCC and LLVM use thunks on the stack which is the prime space for ... PUT stuff on the stack and then EXECUTE it. Compilers, linkers and debuggers need to be able to alias code as data, think and reflect.

    MFG, omb

  28. I suggested this years ago for Linux by Theovon · · Score: 2

    With the BSD's, there no such thing as a tainted kernel. But with Linux, non-GPL drivers are actively discouraged. If they were to add scripting to the Linux kernel, it would actually make it easier to write proprietary drivers, so they'd never go for that. Forget the fact that it would make it a hell of a lot easier to sandbox drivers so they don't clobber other kernel memory. Forget the fact that code in a higher-level language is smaller; countless drivers would suffer no appreciable performance hit by being written in an interpreted language (especially Lua), so you'd have one small interpreter and many shrunken drivers, which would make the kernel memory footprint smaller. Forget the fact that mutually exclusive access to shared variables could be made implicit in a majority of cases, eliminating a whole class of bugs in one shot. No. We've got our precious GPL to protect. (Oh, and forget the fact that nVidia basically gets a free pass on this.)

    1. Re:I suggested this years ago for Linux by drinkypoo · · Score: 1

      With the BSD's, there no such thing as a tainted kernel. But with Linux, non-GPL drivers are actively discouraged. [...] (Oh, and forget the fact that nVidia basically gets a free pass on this.)

      Oddly, nvidia taints my kernel. Thank you, please try again.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    2. Re:I suggested this years ago for Linux by sourcerror · · Score: 1

      If they were to add scripting to the Linux kernel, it would actually make it easier to write proprietary drivers, so they'd never go for that.

      It's pretty hard to write something closed source in a scripting language. (And I don't mean the licensing here. )

    3. Re:I suggested this years ago for Linux by DNS-and-BIND · · Score: 1

      Gosh, go figure, freedom is more important than convenience.

      --
      Shutting down free speech with violence isn't fighting fascism. It IS fascism!
    4. Re:I suggested this years ago for Linux by devent · · Score: 1

      I never understood why non-GPL drivers are a good thing. If you really think that way, why not just use MacOSX or Windows?
      If it is for hardware, then just don't buy hardware that don't have Linux support. Usually, Linux supported hardware is also of better quality, because the vendor cares about customers.

      For example, the USB 3G modems. I only get one because Huawei have good Linux support. I do not miss that horrible mess what they have in Windows. In Linux it's just yet another network interface, and it just works. In Windows I need to install drivers, start a stupid application.

      Or Mp3 players or cameras. I would never buy a player or a camera that is not a USB-Mass-Storage. To think to need some vendor specific software just to access my music or pictures is like a nightmare.

      --
      http://www.mueller-public.de - My site http://www.anr-institute.com/ - Advanced Natural Research Institute
    5. Re:I suggested this years ago for Linux by Theovon · · Score: 1

      That's not the point. An interpreter in the kernel would also make GPL drivers easier to write.

    6. Re:I suggested this years ago for Linux by Theovon · · Score: 1

      Oh, I'm not saying they don't taint the kernel. It just seems like they're one of a few hardware vendors who release binary-only drivers, and this is basically just tolerated. Why is it tolerated?

    7. Re:I suggested this years ago for Linux by Theovon · · Score: 1

      Lua is compiled to a byte-code language that is sufficiently as obfuscated as x86 machine code as to make it "not hard" to write proprietary drivers. But my point was that putting an interpreter into the kernel would help make writing all kinds of drivers easier, including GPL drivers.

    8. Re:I suggested this years ago for Linux by Theovon · · Score: 1

      Yeah, and damn the advantages of making a whole load of GPL drivers smaller, more portable, and safer. No, we wouldn't want to make it harder for a driver bug to crash the kernel! This isn't about either freedom or convenience. This is about software engineering.

  29. DSL's are already in the BSD kernels by Fyzzler · · Score: 2

    There are multiple non-"C" DSL languages and virtual machines in the BSD kernels already and they have been there for over 20 years.

    Here is a prime example http://en.wikipedia.org/wiki/Berkeley_Packet_Filter

    Lua is a very clean, small, and relatively fast object oriented language. It is probably the best possible choice for a general purpose dynamic language to embed in a kernel.

    --
    I have one question. If the Japanese Ministry of Agriculture is not in charge of Gundam, then who is?
  30. Caen We Get by hduff · · Score: 1

    How about

    peek(xx)
    poke(xx)

    The best aprt of Commodore BASIC

    --
    "I believe in Karma. That means I can do bad things to people all day long and I assume they deserve it." : Dogbert
    1. Re:Caen We Get by tibit · · Score: 1

      Only because there was no API to achieve certain things. Only because of that. A built-in assembler and library calls to modify the stuff people usually peeked and poked for would remove 99% of peeks and pokes.

      --
      A successful API design takes a mixture of software design and pedagogy.
  31. Re:Stupid NOT by Anonymous Coward · · Score: 0

    Why not just expose a driver API to user-space? Why should an entire interpreter run on ring zero?

  32. We need DSLs and better APIs by Anonymous Coward · · Score: 0

    We need less kernel code...anything that makes writing kernel code harder is good as people will think twice about doing it, punt to user space and the result will be a more stable platform.

    Otherwise what I think kernels really need are DSLs to handle hardware and resource access patterns not new general purpose languages. With more or less everything hanging off a serial bus of one type or another these days there is huge opportunity to innovate.

    Have spent enough years thumbing thru the change history of kernels to see the same types of problem crop up again and again in system after system, driver after driver. Its a crying shame. What we need is better architecture and less compartmentalization to the extent duplication of effort is minimized. Syntatical musical chairs does shit if your goal is real progress.

  33. Userspace? by devent · · Score: 1

    I'm in no way a kernel expert, I done some C and C++ programming.
    But if you want to expose kernel API to scripting language, why you don't just expose those kernel API to userspace?

    Anything performance or memory critical should be still written in C, so just expose those API to user space and not only get the benefit that you can now use not only LUA but any other language, you get the benefits of separation between kernel and user space: security.

    Just expose those API to userspace and offer a libnetbsd.so so that for example, LUA, Python, Ruby, etc. can use the kernel API. Why would the Netbsd developers limit it to just LUA? Or are they planning to add more script engines in the kernel?

    --
    http://www.mueller-public.de - My site http://www.anr-institute.com/ - Advanced Natural Research Institute
    1. Re:Userspace? by Anonymous Coward · · Score: 0

      You have to be very careful what you allow into the kernel. What happens if some bozo script exhausts memory ? If there is a time-critical interrupt branching out into the scripting engine and then being bogged down by GC. It is not exactly easy. But they want to run it in kernel mode to get rid of the kernel->userspace->kernel context switch overhead.

    2. Re:Userspace? by Anonymous Coward · · Score: 0

      This is no different than some bozo C module that exhausts memory.

  34. Re:Stupid NOT by epyT-R · · Score: 0

    why waste cpu cycles on interpreters? they don't make things 'safer'.. if anything they make the entire code base more complex than it was before, with a massive performance hit as a 'bonus.'

    the last place I'd want one of these things is in a kernel, and I'd never consider a lua scripted device 'driver' as legitimate support for any hardware.

  35. Re:Stupid NOT by countach · · Score: 2

    But if it doesn't need to be quick, why is it in the kernel in the first place? I would have thought that if you are tempted to put a scripting language in the kernel, it's a pretty good indication that the division between kernel and non kernel is somehow wrong.

  36. Re:Stupid NOT by Anonymous Coward · · Score: 1

    That line of reasoning sounds like "All applications will be written in Python, therefor all applications will be written in Python. And since Python is not native code, it's a waste of CPU cycles. Therefor Python is a bad idea".

    "possibility exists" != "everyone will do it all the time".

    The lua features are for prototyping, playing around and just testing crazy ideas. Don't expect NetBSD to ship with any production drivers written in lua.

    I use Python to prototype, but I always release applications and libraries written in plain C. I don't see why the existence of a feature must imply that it's used everywhere?

  37. lua vs perl stats by cheekyboy · · Score: 2

    http://benchmarksgame.alioth.debian.org/u32/benchmark.php?test=all&lang=perl&lang2=lua

    In some tests, one is faster than the other, but by no more than 4x to 1/9th each way.

    At least they didnt choose ruby.

    --
    Liberty freedom are no1, not dicks in suits.
    1. Re:lua vs perl stats by Anonymous Coward · · Score: 0

      That's not LuaJIT.

    2. Re:lua vs perl stats by stenvar · · Score: 1

      The benchmarks on which "Perl is faster" are benchmarks where the problem is solved using Perl's regex library while running in interpreted Lua in Lua. That doesn't show you that "Perl is faster", it shows that Perl has a better regex library, a library you can trivially call from Lua as well.

      If those benchmarks show anything, it's how impressively fast the Lua interpreter is that it can actually even come in the ballpark of Perl's regex library.

  38. Relicense to incorporate into GPL code by Anonymous Coward · · Score: 0

    *BSD and MIT-licensed packages like Lua can be relicensed under GPL* if necessary. It causes some friction between FOSS teams when that is done (dear Theo is especially prone to blowing his top over it), but it's perfectly legal under the terms of these permissive licenses. It's what makes them permissive.

    After all, you can even incorporate BSD/MIT code into proprietary software and it's perfectly OK, so copying it into GPL code is relatively benign. That's the whole idea: no restrictions on how BSD/MIT code is used.

  39. Memory Safe Language OS by Anonymous Coward · · Score: 0

    Another approach to get rid of traditional OSes and their overhead to switch process contexts is to use a memory safe language for the OS and the applications. An "OS call" is then just an ordinary method call. Servers can run tightly integrated with the network stack to ensure minimal delay to process a request.

    You don't need Java or C# (and all their inefficiencies such as the GC and "allocate everything on heap") for that. Here is a (still somewhat prototypical) language of mine which attempts to marry memory-safety with C++ efficiency and soft-realtime-ness:

    http://sourceforge.net/projects/sappeurcompiler/

    Here is how to build "external" apps and run them safely (at the end of the document):

    http://sourceforge.net/p/sappeurcompiler/code-0/2/tree/trunk/doc/SAPPEUR.pdf?format=raw

    1. Re:Memory Safe Language OS by aaron552 · · Score: 1

      You don't need Java or C# (and all their inefficiencies such as the GC and "allocate everything on heap")

      I'm not sure that's entirely true. Primitive types in Java and value types (including structs) in C# are by-value. I may be showing my inexperience here, but why would you want to allocate a value type on the heap? And does it even matter, given that value types are passed on the stack anyway?

      --
      I had a sig once. It was lost in the great storm of '09.
    2. Re:Memory Safe Language OS by Anonymous Coward · · Score: 0

      When I need a temporary string of 50 bytes maximum size, I can allocate it on the stack (in C or C++) in something like 100ns. The destruction will take also just 100ns. Heap-memory will be significantly more expensive either immediately or deferred (GC). Plus heap-based allocation can easily lead to serious heap fragmentation. There was a reason they had a special mechanism for heap compaction in MacOS 9. It is still needed and the "fix" ("just buy a bigger machine") does not cut it.

      The same is with other temporary, fixed-size data such as vectors in numerical code. Stack allocation beats everything else by orders of magnitude.

      In C++ you create complex objects on stack as a matter of routine, while you generate massive processing load (on the GC) and also memory wastage in Java to perform the same thing.

  40. One More Memory Safe Language by Anonymous Coward · · Score: 0

    I'll use this opportunity to do the piper for my own language:

    http://sourceforge.net/p/sappeurcompiler/code-0/2/tree/trunk/

    http://sourceforge.net/p/sappeurcompiler/code-0/2/tree/trunk/doc/SAPPEUR.pdf?format=raw

    It is actually very unfortunate that people confuse "memory safe" with "needs GC", "must be inefficient, sluggish" and "will randomly freeze". It appears the Algol guys already had memory safety but much of it was forgotten because "Unix is free and it comes with a portable assembler called "C""

  41. Indeed by Anonymous Coward · · Score: 0

    Looks like a draw. Perl is excellent; something you can love.

  42. Muha by Anonymous Coward · · Score: 0

    With a tiny bit of googleing you will find lots of hashtable implementations for C.

    E.g. http://freecode.com/projects/libghthash

    I guess the main selling point of Lua is some sort of lazy-ass type system and memory safety. The latter greatly contributes to security, especially when novice or under Management Duress.

    Here's a language which does not force inefficiency on you, but is still memory safe:

    http://sourceforge.net/p/sappeurcompiler/code-0/2/tree/trunk/

  43. So by Anonymous Coward · · Score: 0

    ..they need a Memory Safe Language. They only know of crappy* ones (Java to Lua) so they use the least crappy one. They make no effort to build something like "memory safe C" ? Quite shoddy decision-making.

    Here's a memory safe C++ variant (conceptually, not literally !):

    http://sourceforge.net/p/sappeurcompiler/code-0/2/tree/trunk/

    * I consider it crappy if a C program launches in 10ms and less while the ordinary Java program needs 1000ms. And yeah, it matters dramatically in shell programming (that's what the really professional sysadmins do) where you like to launch programs by means of xargs probably 50 times per second. I consider it crappy if you cannot control memory/resource deallocation. I consider it crappy if ergonomics quality is killed by random freezes due to GC.

    1. Re:So by stenvar · · Score: 1

      They make no effort to build something like "memory safe C" ? Quite shoddy decision-making.

      There is no widely used, memory safe implementation of C or C++. Even if there were, building a memory safe language on top of C and C++ is itself shoddy decision making because those languages are completely unsuitable to the task.

      I consider it crappy if a C program launches in 10ms and less while the ordinary Java program needs 1000ms.

      The C program only launches quickly because all of its shared libraries are kept in memory by the kernel. If you loaded it from scratch, it would likely take much longer. C++ is even worse because its libraries are huge and bloated. Lua, in contrast, has a tiny memory footprint and tiny dependencies. By your own measure of "crappiness", it beats Java, C, and C++ hands down.

    2. Re:So by Anonymous Coward · · Score: 0

      Last time I checked nobody forced me to load lots of dlls with a C program. Unlike Java folks, C programmers do not use 1001 frameworks "because they are soo cool".

  44. Nice enhancement to... by gtirloni · · Score: 1

    their Lego port.

    --
    none
  45. Re:Stupid NOT by Atzanteol · · Score: 2

    Won't somebody think of the precious CPU cycles!

    --
    "Ignorance more frequently begets confidence than does knowledge"

    - Charles Darwin
  46. Muha by Anonymous Coward · · Score: 0

    The Portable Assembler is actually counter-productive when it comes to numerical code, because the compiler can only do lowest-level optimizations. Two pointers could point to the same or to overlapping memory, for example.
    FORTRAN is much older than C, much older than almost any programming language, but it still leads in scientific code ! The people in Illinois have devoted their lifes to doing thinks like reordering for-loops to get better memory/cache access patterns. Google for the work of a Mr Kuck and read his papers.

    So, I guess your claim is at least not entirely based on facts.

    Don't get me started on the horrible security issues in typical C code. Let just say "ping of death".

    The world would be a better place if we used much more Ada and Fortran. Or Sappeur (search it on sourceforge), my invention. Ok, take that with a grain of salt.

  47. True, but ... by Anonymous Coward · · Score: 0

    If we were to head in the direction of removing non-essential stuff from the kernel, soon enough we'd end up with a microkernel architecture, and dear Linus would burst a vein. That wouldn't do.

  48. Come On by Anonymous Coward · · Score: 1

    512MB is a massive amout of memory. I have personally run GUIs on 4MB. I ran an excellent HPUX/PA RISC workstation with just 128MB RAM. It had a very functional GUI (based on X11 and Motif) and it was indestructible without water.

    There was a time national police mainframes ran on 512 KILObytes. Boy, you are sitting in front of a supercomputer !

    I mean it very serious when I say that these days we are pissing away memory for essentially no tangible benefit.

  49. 1970s attitude towards users by decora · · Score: 1

    the entire point of the free software movement and the PC movement is that users should be able to do whatever the hell they want with their machine. they bought it.

  50. Re:Stupid NOT by cnettel · · Score: 2

    Process A calls kernel. That's okay, kernel-userspace transitions can be reasonably fast. Function called is actually implemented in userspace process B. Whoa, context switch. You can easily have a 100x slowdown in your kernelspace interpreter and still come out ahead compared to incurring that context switch. This all assuming that the driver will not do a lot of complicated processing. Rather, it will probably just need to check some basic data structures to identify whether the operation is currently allowed and maintain some shared state between processes. (Not) surprisingly enough, that's all there is to many drivers. I would even think that some file systems currently implemented in FUSE would be faster using a reasonably well-behaving "safe" kernel language.

  51. Oh Reallyz ? by Anonymous Coward · · Score: 0

    I just got a new colleague, fresh from uni, addicted to Perl. I am a long time user and dealer. Do you want to try it ? The first three questions are answered for free, you know. After that, my rate of 100$/hour applies, of course.

  52. And by Anonymous Coward · · Score: 0

    ..even better, you can have memory safe C++ generated for you. No GC crapola needed whatsoever:

    http://sourceforge.net/p/sappeurcompiler/code-0/2/tree/

  53. this might be a revolutionary development by Anonymous Coward · · Score: 0

    This single feature might allow in near future for custom appliance shops to use non-kernel-level developers to build purpose built systems/devices.

    It is important to note that NetBSD is an OS built to support large number of various CPU architectures

    Having a combination of flexible kernel, easier access to developer resources and tooling to support various CPUs -- might be the right mix of things to take purpose bulit OS to the next level

  54. sandboxed lua by stenvar · · Score: 2

    Lua interpreter instances are small. In a kernel environment, you'd like run lots of tiny Lua interpreters, one for every "task" you want to perform. You can impose limits on memory and CPU usage on each instance. Under an out-of-memory condition, you can also ask each of them to reclaim a maximum amount of memory, via a hook and via the GC interface. And if that fails, you can start killing them off one by one in order of least importance, just like you might with other processes or functions. The fact that Lua has better defined semantics and interfaces for resource management than a chunk of C code means that it's actually easier to deal with out of memory conditions with Lua interpreters than for general C code.

  55. users will appreciate other things by stenvar · · Score: 1

    Regardless of how much this would simplify kernel hacking, it means that a lot of controversial or legally restricted code can be added to the kernel with just some tiny text files being passed around. Users could likely add exFAT support, cryptography, DVD decryption, etc. with nothing more than a command like "cat exfat-support > /proc/lua".

    And this would also be available at boot time, making it much easier to work around all the weird problems that keep Linux systems from starting; instead of ever increasingly complex configuration files, blacklists, and C-based workarounds, most of those boot problems could be handled by loading a little bit of Lua code at boot time.

  56. Oh Really by Anonymous Coward · · Score: 0

    So Linux is old-fashioned in that it is rock-solid ? They should do more "experiments" for the sake of experiments ? I assume something "functional" or "monads" or similar crapola. Surely it would be as stable and efficient as Windows at some point, if they did that.

    Guess what ? Lots of people run the world's business on zOS, which dates back into the 60s and they are very happy. They usually do NOT use dynamic memory allocation. Their stuff simply works while the kids play with a new mad idea every week and think they are somehow "innovative".

  57. Re:Stupid NOT by ByOhTek · · Score: 1

    If they have a JIT compiler for it, then it actually won't hurt too much, except at the initial use of a feature. Unless they have the incredible stability of Windows 9x... This shouldn't be a problem.

    --
    Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).