MMU-less systems and vfork.

Discussion in 'Ruby' started by Brian Mitchell, May 2, 2005.

  1. I have an upcoming project that will be on an MMU-less platform
    (coldfire) running uClinux. I was possibly going to use ruby but it
    seems that I cannot confirm if ruby supports vfork as an
    implementation of forking or not. Is it possible at all?

    Thanks,
    Brian.
    Brian Mitchell, May 2, 2005
    #1
    1. Advertising

  2. Brian Mitchell

    Luke Graham Guest

    On 5/3/05, Brian Mitchell <> wrote:
    > I have an upcoming project that will be on an MMU-less platform
    > (coldfire) running uClinux. I was possibly going to use ruby but it
    > seems that I cannot confirm if ruby supports vfork as an
    > implementation of forking or not. Is it possible at all?


    You should probably do this in a c extension, you could pass in the execve
    (or whatever) arg from ruby.

    --
    spooq
    Luke Graham, May 3, 2005
    #2
    1. Advertising

  3. On 5/2/05, Luke Graham <> wrote:
    > On 5/3/05, Brian Mitchell <> wrote:
    > > I have an upcoming project that will be on an MMU-less platform
    > > (coldfire) running uClinux. I was possibly going to use ruby but it
    > > seems that I cannot confirm if ruby supports vfork as an
    > > implementation of forking or not. Is it possible at all?

    >
    > You should probably do this in a c extension, you could pass in the execve
    > (or whatever) arg from ruby.
    >


    Sorry I should have been more clear on this.

    My question was: Will ruby still run when fork is not available
    (replacing fork with vfork or cutting out fork). The quick answer is
    no. It will segfault if you add

    #define fork vfork

    to ruby and run "fork". Will it still work if I avoid fork in ruby and
    use, like you said, a C extension to vfork for me? (I don't have my
    hardware to run tests on yet).

    In the end it looks like the answer is no but I am no expert so I
    decided to ask this time around. This was all more of a curiosity. I
    would love to be able to use a slim version of ruby to write higher
    level code along with lower level C extensions. Anyone willing to
    write a patch for me? ;-)

    Thanks,
    Brian.
    Brian Mitchell, May 3, 2005
    #3
  4. Brian Mitchell

    Luke Graham Guest

    On 5/3/05, Brian Mitchell <> wrote:
    > On 5/2/05, Luke Graham <> wrote:
    > > On 5/3/05, Brian Mitchell <> wrote:
    > > > I have an upcoming project that will be on an MMU-less platform
    > > > (coldfire) running uClinux. I was possibly going to use ruby but it
    > > > seems that I cannot confirm if ruby supports vfork as an
    > > > implementation of forking or not. Is it possible at all?

    > >
    > > You should probably do this in a c extension, you could pass in the execve
    > > (or whatever) arg from ruby.
    > >

    >
    > Sorry I should have been more clear on this.
    >
    > My question was: Will ruby still run when fork is not available
    > (replacing fork with vfork or cutting out fork). The quick answer is
    > no. It will segfault if you add
    >
    > #define fork vfork


    Agreed, theres no way thats going to work. vfork != fork.

    > to ruby and run "fork". Will it still work if I avoid fork in ruby and
    > use, like you said, a C extension to vfork for me? (I don't have my
    > hardware to run tests on yet).


    I dont see why it wouldnt work. You have to abide by the rules of vfork
    though, which can be summarised as "nothing but exec or exit", so its
    kind of pointless.

    > In the end it looks like the answer is no but I am no expert so I
    > decided to ask this time around. This was all more of a curiosity. I
    > would love to be able to use a slim version of ruby to write higher
    > level code along with lower level C extensions. Anyone willing to
    > write a patch for me? ;-)
    >
    > Thanks,
    > Brian.
    >
    >



    --
    spooq
    Luke Graham, May 3, 2005
    #4
  5. Brian Mitchell

    Luke Graham Guest

    On 5/3/05, Luke Graham <> wrote:
    > On 5/3/05, Brian Mitchell <> wrote:
    > > On 5/2/05, Luke Graham <> wrote:
    > > > On 5/3/05, Brian Mitchell <> wrote:
    > > > > I have an upcoming project that will be on an MMU-less platform
    > > > > (coldfire) running uClinux. I was possibly going to use ruby but it
    > > > > seems that I cannot confirm if ruby supports vfork as an
    > > > > implementation of forking or not. Is it possible at all?
    > > >
    > > > You should probably do this in a c extension, you could pass in the execve
    > > > (or whatever) arg from ruby.
    > > >

    > >
    > > Sorry I should have been more clear on this.
    > >
    > > My question was: Will ruby still run when fork is not available
    > > (replacing fork with vfork or cutting out fork). The quick answer is
    > > no. It will segfault if you add
    > >
    > > #define fork vfork

    >
    > Agreed, theres no way thats going to work. vfork != fork.
    >
    > > to ruby and run "fork". Will it still work if I avoid fork in ruby and
    > > use, like you said, a C extension to vfork for me? (I don't have my
    > > hardware to run tests on yet).

    >
    > I dont see why it wouldnt work. You have to abide by the rules of vfork
    > though, which can be summarised as "nothing but exec or exit", so its
    > kind of pointless.


    Just to explain what I meant by this... For most (ruby) applications,
    having vfork
    is not better than having no fork. Having ruby running on mmu-less hw,
    even with that caveat, is not useless :) If defining fork to vfork is enough to
    get it working, then go with it.

    --
    spooq
    Luke Graham, May 3, 2005
    #5
  6. In article <>, Brian Mitchell wrote:
    [...]
    >My question was: Will ruby still run when fork is not available
    >(replacing fork with vfork or cutting out fork). The quick answer is
    >no.

    [...]

    The usual build of Ruby on Windows does not use fork - Ruby does not require
    fork to operate.

    If everything goes well, ./configure will notice that fork isn't available,
    and will not set HAVE_FORK in config.h.
    Tim Sutherland, May 5, 2005
    #6
  7. On 5/4/05, Tim Sutherland <> wrote:
    > In article <>, Brian Mitchell wrote:
    > [...]
    > >My question was: Will ruby still run when fork is not available
    > >(replacing fork with vfork or cutting out fork). The quick answer is
    > >no.

    > [...]
    >
    > The usual build of Ruby on Windows does not use fork - Ruby does not require
    > fork to operate.
    >
    > If everything goes well, ./configure will notice that fork isn't available,
    > and will not set HAVE_FORK in config.h.


    This is what I needed to know. thanks. I should have looked harder but
    my tinker time on this is limited. I do not yet have my toolchain
    completely done yet but I should be able to test this setting. BTW, I
    did get it partially working with certain forms of fork (vfork
    implementation swapped in) but as was said and as I knew, vfork is
    quite an different beast but does the trick in some cases.

    Now to figure out if I can slim it down anymore than using the right
    compiler flags.

    Thanks,
    Brian.
    Brian Mitchell, May 5, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. schand

    MMU and vtable

    schand, Oct 26, 2006, in forum: C++
    Replies:
    1
    Views:
    373
    Kaz Kylheku
    Oct 27, 2006
  2. schand

    MMU and vtable

    schand, Oct 26, 2006, in forum: C++
    Replies:
    9
    Views:
    438
    Ian Collins
    Oct 27, 2006
  3. asit

    vfork() error

    asit, Aug 11, 2009, in forum: C Programming
    Replies:
    4
    Views:
    663
    David Schwartz
    Aug 12, 2009
  4. jiajia wu
    Replies:
    0
    Views:
    345
    jiajia wu
    Oct 1, 2009
  5. 6668
    Replies:
    0
    Views:
    141
Loading...

Share This Page