Live data from Hacker News

Boot a linux kernel right inside your browser.

bellard.org

241–250 of 255 posts

Re: Boot a linux kernel right inside your browser.

#243
I tested the JS/Linux with google chrome 12 (beta and gnu/linux) with a new vmlinux26.bin and root.bin compiled using the 2.6.30 kernel with buildroot and work as expected (fine).

I don't know what is the problem of the original 2.6.20 linux kernel with JS/Linux but with this new compilation work perfectly.

Re: Boot a linux kernel right inside your browser.

#244
post #231

Earlier quoted context omitted.

I've always wished that, instead of a "browser language", browsers exposed a LOW LEVEL bytecode environment (which browsers are then free to interpret, JIT compile or on-the-fly AOT compile at page load time). It should be reasonably low level, in that it should provide an abstraction from the hardware, but still allow for very efficient execution of lower level code. Then high level languages and frameworks could be…

Factor, Racket, and Lua all have ffi's that are very easy to use. I've never quite liked Lua's metaprogramming, though (macros are very useful when you're writing bindings.) and my least favourite Lua quirk would be the lack of integer types - both other languages have fairly sane (and performant!) numeric towers. That said, I'd give a higher priority for the language in my browser to be safe: some kind of correctnes…

Standard Lua may not have integer types, but as far as I know, LuaJIT does actually support integer types under the hood. At the very least, you can force it by declaring an integer using the FFI, eg:

    local ffi = require("ffi")
    int = ffi.new("int")
    int = 10
    print(int)
I also don't find the lack of macros in Lua as limiting as I do in other languages. For example, if I wanted to create an EDSL in Lua, I would have it parse a string at startup. For example, imagine a state machine DSL:

    fsm = my_dsl[[
        start: foo
        stop:  quux
        foo -> bar
        foo -> baz
        bar -> foo
        baz -> quux
    ]]{ foo = function()
            code for foo here
        end,
        bar = function()
            code for bar here
        end,
        baz = function()
            code for baz here
        end,
        quux = function()
            code for quux here
        end
    }
    fsm.run()
As a real-world example, here is some Lua code I'm using in a hobby game project:

    DEFINE(Traits.Position)[[
        float x;
        float y;
        float z;
    ]]
    DEFINE(Traits.Movement)[[
        float x;
        float y;
        float z;
    ]]
    DEFINE(Behaviors.do_movement){
        input={Traits.Position, Traits.Movement},
        output=Traits.Position,
        frequency=0.01,
	
        -- Update entities position
        fn = function (pos, mov)
            local delta = dark.timedelta
            new_pos = Traits.Position.new()
            new_pos.x = pos.x + (mov.x * delta)
            new_pos.y = pos.y + (mov.y * delta)
            new_pos.z = pos.z + (mov.z * delta)
            return new_pos
        end}

    -- Create a sample entity
    local entity = Entities.new()
    entity.add(Traits.Position, {1.0, 0.0, 0.0})
    entity.add(Traits.Movement, {0.0, -1.0, 0.0})

"That said, I'd give a higher priority for the language in my browser to be safe: some kind of correctness guarantee would be nice. Or even, while we're at it, some kind of way to analyze the script and say "this script GETS from urls x,y, and posts data d to z""

I definitely agree with the above.

Re: Boot a linux kernel right inside your browser.

#246

Earlier quoted context omitted.

Close but I think you have your orders understated. A normal programmer faces O(n^2), while a great programmer achieves O(n log n). Really bad programmers do O(k ^n) amount of work to achieve the same, with k>2.

Why k > 2? k > 1 is bad enough. Otherwise, recursive fib(n) would be just fine (O(~1.618^n)).

Because 1.00000000000001 ^ N is not bad for most values of N that you will actually use.

Re: Boot a linux kernel right inside your browser.

#249
I admire Fabrice a lot, he is a programming hero for me. However it is not true that he is not interested in money, for instance the QEMU module performing the run-time code translation to go fast was not released for free in order to earn from this. I don't know if he managed to earn or not from QEMU in the end, but IMHO that of selling the module to final user was not the right strategy, when QEMU was started and became famous, "virtualization" was an huge buzz and interest for many companies, so many ways to make money from this.

Also this new code is not released under a free license, so by default as far he is not sure what he's going to do with the code the "open source way" is not the default. This is not a critique. I think Fabrice Bellard is a genius, but as an observer he seems interested in making a profit from his work like many other programmers.

Instead subjectively I've to admit today I no longer consider the GPL a completely free license, but this is another matter and may be related not to earning but to the meaning "free software" has for you. For me it is as simple as letting people to do everything with your code. IMHO the BSD license turns out to be better both for users AND for you to earn from your product later.

Re: Boot a linux kernel right inside your browser.

#250

I admire Fabrice a lot, he is a programming hero for me. However it is not true that he is not interested in money, for instance the QEMU module performing the run-time code translation to go fast was not released for free in order to earn from this. I don't know if he managed to earn or not from QEMU in the end, but IMHO that of selling the module to final user was not the right strategy, when QEMU was started and b…

GPL has no restriction on selling code, RMS earned his living money by selling reel tapes of code when GNU was first founded.
Post reply on HN