chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Best way to share memory between C and Chicken


From: Jörg F . Wittenberger
Subject: Re: [Chicken-users] Best way to share memory between C and Chicken
Date: 05 May 2013 01:07:55 +0200

On May 4 2013, Ivan Raikov wrote:

 I think you can try to have native threads by running a separate instance
of the Chicken runtime for each thread, but are you sure that you will
really achieve a significant speedup over Unix processes and/or MPI?
It's not the early nineties anymore... I suggest prototyping  code and
running real-world benchmarks first.

Hm.  I dunno, I'm old school.

So far I have at least one case, where I've been resorting to native
threads because I didn't see another solution.  Maybe you/anybody
could enlighten me?

The case at hand: I'm running sqlite queries, which can take a long time. I don't want to block the chicken system while those are busy. Worse: I'm using the sqlite VFS to get the actual data blocks ... from chicken, hence the chicken thread MUST not wait for sqlite... (for reference an old version of the code is here http://lists.nongnu.org/archive/html/chicken-users/2010-01/msg00046.html )

As I said: I'm old school - could I really expect a reasonable performance
from running a separate sqlite process and cop the data back and forth
between the processes?  Suggestion how to do this are welcome!

On Sat, May 4, 2013 at 8:39 AM, Dan Leslie <address@hidden> wrote:
...
Relatedly, is anyone poking at implementing native threads?
I've been digging around a bit but haven't had much time to progress very
far.

In fact I'm contemplating about this for a while and never got the
courage to try.  (Especially because I don't see how I could create
a half-way meaningful benchmark beforehand to judge the gain/loss
early in the development process.)

The bottleneck for me is usually blocking on i/o.  Wrt. this I do not
expect (as in wild guess - no benchmarks done) much from multiple
threads.

However some things I'm doing are just computations.  Am I thinking
"early nineties" style when I assume that chicken will utilize only
one cpu core?  If so, I'd prefer not spare the others all the time.

My problem: I can't see a good way to share chicken-managed memory
between threads.  I recall having seen a paper on using a dedicated
thread for memory allocation...but can't find it anymore.

Nevertheless: maybe it would be feasible to do all second gen
gc in a dedicated thread and force a minor gc before passing data
between threads?  Would it?


Best

/Jörg



........








reply via email to

[Prev in Thread] Current Thread [Next in Thread]