6 ms·
Lua in the NetBSD Kernel [pdf]
- AlexanderDhoore 14y agoI was at this talk @ fosdem. Pretty cool stuff. He said he considered java (there have been attempts to write drivers in java) and python. Python didn't make it because of high ram usage (java wasn't any better). He didn't look into ruby, but "not for any particular reason". Probably because embedding ruby is quite hard compared to python or lua. Very interesting talk!
- pm90 14y agoDo you know if that talk was recorded, by any chance? I checked here http://video.fosdem.org/2013 http://video.fosdem.org/2013 but couldn't find it there
- AlexanderDhoore 14y agoIt wasn't recorded. At least not officially. Fosdem has so many rooms, I think they just give up at some point. It's a shame though. Edit: Just checked and there are videos for only one devroom. And there were around 30...
- threedaymonk 14y agoThe graph processing room was recorded, as were the lightning talks, but I don't know if those videos are available yet.
- klrr 14y agoHow does this really work, is it possible to write such stuff as drivers with a garbage collected language?
- pjmlp 14y agoYes. There are operating systems written in system programming languages with GC. Check Native Oberon and A2 for desktop operating systems used at Zurich's university. Smalltalk was originally developed as OS. Only the so called primitives were done in Assembly, with the remaining parts in Smalltalk itself. Sun played around with Java in Solaris for device drivers and Squawk is a VM that runs directly on hardware with device drivers written in Java, as an example.
- rwmj 14y agoAlso OpenMirage, written in OCaml straight to the "hardware" (where "hardware" is a Xen virtual machine). http://openmirage.org/ http://openmirage.org/
- cpressey 14y agoAs someone who once threw together a Lua kernel module for FreeBSD 4 just for fun, I approve of the idea -- although I don't know how useful it is. Being able to rapidly prototype kernelspace things is probably the main advantage. I'd think twice about actually running garbage-collected code in the kernel in production. And the slide that touts that it's easy for users to modify -- yes, well -- you could easily argue that it shouldn't be easy for users to modify what's in the kernel :)
- AlexanderDhoore 14y agoIndeed, prototyping functionality is the main point here. The whole system isn't even part of the default install and can be turned on/off. Easier is always good. It's still far from easy though.
- Nelson69 14y agoI've seen this on an embedded product that has been sold for years. The license is liberal, it's remarkably easy to work with Lua, is can basically call any of your C functions. Great for debugging stuff, prototyping, certain kinds of monkey patches. Great for doing unit test like experiments too; you can have some Lua put the system in to a particular state and then do your experiment.
- AlexanderDhoore 14y agoHow would you compare it with python for things like unit testing c code? Here lua is chosen because of it's small footprint, but for testing that doesn't really matter.
- reddit_clone 14y agoLua is multi-threading friendly. It is allowed and easy to run multiple VMs in different threads in the same process.
- xradionut 14y ago
- wildchild 14y agoCould anyone explain, why Lua is so special?
- AlexanderDhoore 14y agoIt's very small and uses very little memory. It's designed to be embedded. And has a liberal license (MIT).
- deweerdt 14y agoIt's not the language itself. It's its implementation. Embedding a Lua interpreter in a C program is straightforward. See the 'Python' and 'Java' slides in the OP: it's all about integration.
- Slackwise 14y agoTake JavaScript, remove all the wonky stuff, and now you've got Lua. Then ask yourself, why has JavaScript become popular outside the browser?
- ams6110 14y agoJavascript is popular outside the browser not because it's a great programming language, but because it gets us back to where we were before the browser became the dominant app delivery platform: it's now again possible to write your entire client-server app in one language.
- Slackwise 14y agoIf you're talking Node.js, sure, but that was a stepping stone. It's now being used for all sorts of weird things, like WinRT, and as GNOME's flagship desktop app language. These need not have any server-side components. A large part is obviously that JavaScript is now well known and many developers have been exposed to it, but also because a minimal prototype language with first class functions is often all you need or want, just like Lua. (I assume this has been realized after exposure to JavaScript, or maybe I'm giving JS devs too much credit and they're not fans of minimal and clean languages.)
- lemcoe9 14y agoOh my god, I may have fallen in love with that PowerPoint theme...
- profquail 14y agoI think it's one of the standard themes for Beamer (LaTeX package for creating presentations): http://www.hartwork.org/beamer-theme-matrix/ http://www.hartwork.org/beamer-theme-matrix/
- vor_ 14y agoLua sometimes drives me nuts, but it's such a humble little language that you can't hate it for too long. There are alternatives I would have preferred, like the Lua-inspired Squirrel (http://http://squirrel-lang.org http://http://squirrel-lang.org ), but Lua is the most well-known and is written in plain C, which is likely appealing to a BSD project. I'm interested to see if this gains any popularity and if the other BSDs show interest.
- StavrosK 14y agoHow does it drive you nuts?
- rwmj 14y agoArrays based on 1. The odd and slightly under-documented stack that you have to use when interfacing it with C. Global variable scope by default. Tables (.. are both good and bad). Not standard named operators like '=~' and ':'. Having said that, it's not a bad language. It has an excellent community, who really went to great lengths to help me writing the Lua libguestfs bindings. http://libguestfs.org/guestfs-lua.3.html http://libguestfs.org/guestfs-lua.3.html
- snogglethorpe 14y agoThe 1-based arrays are theoretically annoying (I'm a C guy), but in practice I find they simply aren't an issue, I guess due to the differences in typical programs for each language. "~=" is unusual (I too wish it used "!=") but other than that, Lua's pretty much like everybody else (":" doesn't really count because it's an operation that doesn't exist in most languages). "Global by default" can be annoying, but at least it's better than "local by default" like python etc. [As a programmer, who'd rather find bugs easily than save some typing, I think better than either would be "nothing by default, you gotta declare your variables", but that might not be popular for "dash off a quick script" usage; maybe make it configurable based on the load context or something?] But this: > The odd and slightly under-documented stack that you have to use when interfacing it with C ... seems almost bizarre. Lua's C interface is probably the most elegant and usable I've ever seen. A stack is the classic abstraction to use for this application, Lua's implementation is well-designed, and Lua's API documentation is both comprehensive and very well written.
- fafner 14y agoSimilar to this SnabbSwitch is a virtual Ethernet switch for Linux written mostly in Lua (using LuaJIT). https://github.com/SnabbCo/snabbswitch/wiki https://github.com/SnabbCo/snabbswitch/wiki
- SparrowOS 14y agoI wrote every line of my OS, 139,000, over the last ten years. I gonna kill the CIA. God says... dominion running herself content mundo_stoked hindereth displeaseth encompasseth remaining I_don't_care monstrous oblation aim lawful instinctive watered Sacrifice ensnaring Gods particular pen upright commandments ventures deliberation anger instinct sportively commandest Dad doting statue softly point enacteth otherwhiles gluttony cheerful Refund availed issue mixture withdrew Saint Glad conscious leisure oh_oh contrite restored seducing degree MS feeling exclaim unquiet race raises inmost resistance body FOR melody curest abode unrulily stowed Teacher surprise_surprise examiner unhappy hither arrows state Somalia gnawed tread entitled weeps followeth consistent incredible lower why_didn'_you_tell_me vows turnest require meanings Good gestures door-keeper Beware mediator Dost break_some_woopass_on_you justify readier honesty tongue-science Special Abraham transgression foreigner singularly seed-plots principally succeeded equipment increase seasoneth disgraced imperfect harmony Vietnam accustomed irresoluteness yield goodness spring Whereto concubine Malawi using royalty fainting Jove's doh talkers therewith Master 2002 passes Why Knoweth attracted healthfully supporting flowers manifoldly conjoined XIII seasons lord blinded more everlastingly our firmament crying labours admired spoke ambition Indonesia potter's wings pardon_the_french recent succeeding perfection
- markwong 14y agowill the backward compatibility of Lua be a matter?