Live data from Hacker News

Lthread is a multicore/multithread coroutine library written in C

github.com

1–10 of 26 posts

Re: Lthread is a multicore/multithread coroutine library written in C

#2
Previously posted on HN 50 days ago, there are some interesting critiques in the comments, especially regarding the GPL license, the consensus being it is ridiculous for a library like this and probably a good reason it's not as popular as it could be:

http://news.ycombinator.com/item?id=3661038

Re: Lthread is a multicore/multithread coroutine library written in C

#4

Previously posted on HN 50 days ago, there are some interesting critiques in the comments, especially regarding the GPL license, the consensus being it is ridiculous for a library like this and probably a good reason it's not as popular as it could be: http://news.ycombinator.com/item?id=3661038

Thanks, I hadn't seen the earlier discussion. I'm more interested in the approach than in the specific code, so GPL doesn't concern me terribly. It seems to be a significant block for others, though.

   -----	
halayli 50 days ago | http://news.ycombinator.com/item?id=3661584

I am not married to the license. I noticed several complaints, so I am going to reconsider it. :)

   -----
Halayli: Any further thoughts on licensing?

Re: Lthread is a multicore/multithread coroutine library written in C

#5
So, last time this was posted I commented that I was interested, but couldn't use this at work because of the GPL license.

Since then I implemented my own M:N userspace:kernel threading library (which is what lthread boils down to) based on Russ Cox's BSD-licensed libtask. You know what I found?

1) Many libc routines require a surprisingly large amount of stack. 64kiB was the smallest power of 2 I could find where I wouldn't overflow the stack somewhere in a libc call. (This isn't a problem with stack-copying, but it is a problem if you have dedicated per-lthread stacks).

2) It was slow! Just dropping the M:N library and using blocking network I/O with 200+ kernel pthreads was vastly faster.

3) Many pthread-functions get very, very confused if they are used from different pthreads (same logical "lthread"). (This happens when a userspace scheduler swap happens between matching operations.) For example, pthread mutexes don't like to be locked in one pthread and unlocked in another pthread (same "lthread"). I ran into other things that match this category, but can't remember them off of the top of my head.

I ended up scrapping it and just using a pool of kernel pthreads. It works, the code is pretty clear (blocking IO! whatever, man), and it's fast enough.

Edit: By "fast enough", I mean "can fill 2x 1Gbit pipes from disk" (without any perf-focused work thus far).

Re: Lthread is a multicore/multithread coroutine library written in C

#6
post #4

Previously posted on HN 50 days ago, there are some interesting critiques in the comments, especially regarding the GPL license, the consensus being it is ridiculous for a library like this and probably a good reason it's not as popular as it could be: http://news.ycombinator.com/item?id=3661038

Thanks, I hadn't seen the earlier discussion. I'm more interested in the approach than in the specific code, so GPL doesn't concern me terribly. It seems to be a significant block for others, though. ----- halayli 50 days ago | http://news.ycombinator.com/item?id=3661584 I am not married to the license. I noticed several complaints, so I am going to reconsider it. :) ----- Halayli: Any further thoughts on licensing?

I've been pretty busy in the past month and I never got a chance to go ahead and change the license. But yes I'll be changing it to BSD license this week.

Re: Lthread is a multicore/multithread coroutine library written in C

#8
post #4

Previously posted on HN 50 days ago, there are some interesting critiques in the comments, especially regarding the GPL license, the consensus being it is ridiculous for a library like this and probably a good reason it's not as popular as it could be: http://news.ycombinator.com/item?id=3661038

Thanks, I hadn't seen the earlier discussion. I'm more interested in the approach than in the specific code, so GPL doesn't concern me terribly. It seems to be a significant block for others, though. ----- halayli 50 days ago | http://news.ycombinator.com/item?id=3661584 I am not married to the license. I noticed several complaints, so I am going to reconsider it. :) ----- Halayli: Any further thoughts on licensing?

and done!

Re: Lthread is a multicore/multithread coroutine library written in C

#9
post #8
post #4

Earlier quoted context omitted.

Thanks, I hadn't seen the earlier discussion. I'm more interested in the approach than in the specific code, so GPL doesn't concern me terribly. It seems to be a significant block for others, though. ----- halayli 50 days ago | http://news.ycombinator.com/item?id=3661584 I am not married to the license. I noticed several complaints, so I am going to reconsider it. :) ----- Halayli: Any further thoughts on licensing?

and done!

Cool! Thanks.

Edit: looks like you missed COPYING; it's still GPLv2 (whereas LICENSE has BSD-looking text).

Post reply on HN