<div dir="ltr">Hello!<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 26, 2015 at 8:25 AM, Neeraj Sharma <span dir="ltr"><<a href="mailto:neerajsharma.live@gmail.com" target="_blank">neerajsharma.live@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am trying to port erlang on rumpkernel and running into some issues. RumpKernel do not have fork/execve, so there are some constraints. Please note that I am new to erlang internals, so please be a bit more verbose.</div><div><br></div><div>1. Erlang allocates pages which are aligned to superblock. I found strange pthread issues and debug it to due to the mmap allocation which does multiple allocation/deallocation to get the desired alignment. Can this be changed to align on just the pagesize instead? Is the alignment a strict requirement?</div></div></blockquote><div><br></div><div>It is not a strict requirement. For instance windows and ose do not have use this feature. It can be disabled by playing around with the defines in erl_mmap.h. There might also be a configure test for it, can't remember of the top of my head.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>2. Erlang fork/execve, which is bad when running on rump because there is no such support at present. I am trying to run beam directly and even got a shell but then things fail while trying to run erlang application. I suspect that there are more fork at other places (probably for port). There are couple of things I'd like to know in this case.</div><div><br></div><div>2.1 What is the best way to run beam directly (instead of going via erl)?</div></div></blockquote><div><br></div><div>For OSE there is no erl wrapper, instead beam is invoked directly. This is not very beautiful, but it works good enough. You can read about how it is started here: <a href="http://www.erlang.org/doc/apps/ose/ose_intro.html#id56869">http://www.erlang.org/doc/apps/ose/ose_intro.html#id56869</a></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>2.2 Can I change fork/execve to pthread_create instead?</div></div></blockquote><div><br></div><div>No, I don't think that would work. What you can do is configure the Erlang to not use the native dns resolver. This normally this gets rid of most of the child programs that are needed. See the inet configuration manual for details on how to do this: <a href="http://www.erlang.org/doc/apps/erts/inet_cfg.html">http://www.erlang.org/doc/apps/erts/inet_cfg.html</a>.</div><div><br></div><div>Happy porting!</div><div><br></div><div>Lukas</div></div></div></div>