9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] rsc's libtask on embedded
@ 2015-07-09  8:38 Steve Simon
  2015-07-09 14:17 ` Joseph Stewart
  0 siblings, 1 reply; 12+ messages in thread
From: Steve Simon @ 2015-07-09  8:38 UTC (permalink / raw)
  To: 9fans

Anyone stripped rsc's libtask for use on a bare metal embedded system,
I'am about to do it but if somone already has I could steal it.

-Steve



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09  8:38 [9fans] rsc's libtask on embedded Steve Simon
@ 2015-07-09 14:17 ` Joseph Stewart
  2015-07-09 14:50   ` Steve Simon
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Stewart @ 2015-07-09 14:17 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

I really like rsc's libtask and have managed to hide it in a few products.

As for your question: What architecture? Any runtime available?

Personally, I've used libtask on ARM/x86 under Linux/OSX... hardly "bare
metal" though.

The current implementation depends mostly on the ucontext API + berkeley
sockets for net stuff.

There's another project called http://libmill.org/ that is (was?) based on
setjmp/etc that might be easier to port.

Do keep me posted on your "travels"... I'm interested in this kind of stuff
too.

...or maybe we should just all help Charles updating/minimizing Inferno...

-joe

On Thu, Jul 9, 2015 at 4:38 AM, Steve Simon <steve@quintile.net> wrote:

> Anyone stripped rsc's libtask for use on a bare metal embedded system,
> I'am about to do it but if somone already has I could steal it.
>
> -Steve
>
>

[-- Attachment #2: Type: text/html, Size: 1401 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 14:17 ` Joseph Stewart
@ 2015-07-09 14:50   ` Steve Simon
  2015-07-09 15:09     ` David du Colombier
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Steve Simon @ 2015-07-09 14:50 UTC (permalink / raw)
  To: 9fans

The system I am trying to add libtask to has no runtime other than libc.

Corrently it is an even based system that uses a "min main loop" and
a twisty maze of nested state machines that all look the same.

Hence my desire to add co-routines + channels (i.e. exactly what libtask is)
to it. I have no need for the file or network modules but those are easily removed.

I don't have the context calls but I do have setjmp/longjmp so that is what I
am trying to use.

I will shout if it works out.

-Steve



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 14:50   ` Steve Simon
@ 2015-07-09 15:09     ` David du Colombier
  2015-07-09 15:52       ` Joseph Stewart
  2015-07-09 15:55       ` Joseph Stewart
  2015-07-09 15:51     ` Bakul Shah
  2015-07-09 15:58     ` Joseph Stewart
  2 siblings, 2 replies; 12+ messages in thread
From: David du Colombier @ 2015-07-09 15:09 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Russ implemented his own setmcontext and getmcontext functions
to work on systems that doesn't properly support ucontext.
So I don't think you really need ucontext support in your libc.

By the way, I maintain an updated version of libtask:

https://github.com/0intro/libtask

I've used it on quite a few places over the years,
but I only on POSIX systems so far.

--
David du Colombier



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 14:50   ` Steve Simon
  2015-07-09 15:09     ` David du Colombier
@ 2015-07-09 15:51     ` Bakul Shah
  2015-07-09 15:58     ` Joseph Stewart
  2 siblings, 0 replies; 12+ messages in thread
From: Bakul Shah @ 2015-07-09 15:51 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Sounds like all you want are coroutines (with create, destroy & switch-to calls) and wait queues (with create, destroy, signal & wait calls). With these you can build channels easily. With a bit more work you can even implement pre-emption but then you need mutexes. Setjmp/longjmp is fine (that was I did in my first version ages ago!).

> On Jul 9, 2015, at 7:50 AM, Steve Simon <steve@quintile.net> wrote:
> 
> The system I am trying to add libtask to has no runtime other than libc.
> 
> Corrently it is an even based system that uses a "min main loop" and
> a twisty maze of nested state machines that all look the same.
> 
> Hence my desire to add co-routines + channels (i.e. exactly what libtask is)
> to it. I have no need for the file or network modules but those are easily removed.
> 
> I don't have the context calls but I do have setjmp/longjmp so that is what I
> am trying to use.
> 
> I will shout if it works out.
> 
> -Steve
> 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 15:09     ` David du Colombier
@ 2015-07-09 15:52       ` Joseph Stewart
  2015-07-09 15:55       ` Joseph Stewart
  1 sibling, 0 replies; 12+ messages in thread
From: Joseph Stewart @ 2015-07-09 15:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

David, it's good to hear you're keeping libtask updated... I'll check it
out for sure!

On Thu, Jul 9, 2015 at 11:09 AM, David du Colombier <0intro@gmail.com>
wrote:

> Russ implemented his own setmcontext and getmcontext functions
> to work on systems that doesn't properly support ucontext.
> So I don't think you really need ucontext support in your libc.
>
> By the way, I maintain an updated version of libtask:
>
> https://github.com/0intro/libtask
>
> I've used it on quite a few places over the years,
> but I only on POSIX systems so far.
>
> --
> David du Colombier
>
>

[-- Attachment #2: Type: text/html, Size: 1082 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 15:09     ` David du Colombier
  2015-07-09 15:52       ` Joseph Stewart
@ 2015-07-09 15:55       ` Joseph Stewart
  1 sibling, 0 replies; 12+ messages in thread
From: Joseph Stewart @ 2015-07-09 15:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

BTW, somewhere I "wired in" TADNS (http://adns.sourceforge.net/) so
libtask's network lookups didn't block.

Let me know if you have any interest in me cleaning it up for use.

-joe

On Thu, Jul 9, 2015 at 11:09 AM, David du Colombier <0intro@gmail.com>
wrote:

> Russ implemented his own setmcontext and getmcontext functions
> to work on systems that doesn't properly support ucontext.
> So I don't think you really need ucontext support in your libc.
>
> By the way, I maintain an updated version of libtask:
>
> https://github.com/0intro/libtask
>
> I've used it on quite a few places over the years,
> but I only on POSIX systems so far.
>
> --
> David du Colombier
>
>

[-- Attachment #2: Type: text/html, Size: 1260 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 14:50   ` Steve Simon
  2015-07-09 15:09     ` David du Colombier
  2015-07-09 15:51     ` Bakul Shah
@ 2015-07-09 15:58     ` Joseph Stewart
  2015-07-09 16:12       ` steve
  2 siblings, 1 reply; 12+ messages in thread
From: Joseph Stewart @ 2015-07-09 15:58 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

One other thing that I've looked at but never used is Adam Dunkels'
"protothreads" (http://dunkels.com/adam/pt/) although you'd still need to
roll your own channel library.

On Thu, Jul 9, 2015 at 10:50 AM, Steve Simon <steve@quintile.net> wrote:

> The system I am trying to add libtask to has no runtime other than libc.
>
> Corrently it is an even based system that uses a "min main loop" and
> a twisty maze of nested state machines that all look the same.
>
> Hence my desire to add co-routines + channels (i.e. exactly what libtask
> is)
> to it. I have no need for the file or network modules but those are easily
> removed.
>
> I don't have the context calls but I do have setjmp/longjmp so that is
> what I
> am trying to use.
>
> I will shout if it works out.
>
> -Steve
>
>

[-- Attachment #2: Type: text/html, Size: 1260 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 15:58     ` Joseph Stewart
@ 2015-07-09 16:12       ` steve
  2015-07-09 16:31         ` Bakul Shah
  0 siblings, 1 reply; 12+ messages in thread
From: steve @ 2015-07-09 16:12 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

I looked at proto, they are just state machines pretending to be threads (imho) - not my style.

libtask for me, I hope I can slice it a little and put the non-bear-metal bits in seperate files so I can offer the changes back.

co routines plus channels is exactly what I want.

-Steve





> On 9 Jul 2015, at 16:58, Joseph Stewart <joseph.stewart@gmail.com> wrote:
> 
> One other thing that I've looked at but never used is Adam Dunkels' "protothreads" (http://dunkels.com/adam/pt/) although you'd still need to roll your own channel library.
> 
>> On Thu, Jul 9, 2015 at 10:50 AM, Steve Simon <steve@quintile.net> wrote:
>> The system I am trying to add libtask to has no runtime other than libc.
>> 
>> Corrently it is an even based system that uses a "min main loop" and
>> a twisty maze of nested state machines that all look the same.
>> 
>> Hence my desire to add co-routines + channels (i.e. exactly what libtask is)
>> to it. I have no need for the file or network modules but those are easily removed.
>> 
>> I don't have the context calls but I do have setjmp/longjmp so that is what I
>> am trying to use.
>> 
>> I will shout if it works out.
>> 
>> -Steve
> 

[-- Attachment #2: Type: text/html, Size: 1958 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 16:12       ` steve
@ 2015-07-09 16:31         ` Bakul Shah
  2015-07-09 16:50           ` Skip Tavakkolian
  2015-07-10  2:07           ` erik quanstrom
  0 siblings, 2 replies; 12+ messages in thread
From: Bakul Shah @ 2015-07-09 16:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Your use is different and simple enough that I would suggest doing this from scratch in pure C. Or start from an existing setjmp based implementation. It should really be a couple pages of code at most.

> On Jul 9, 2015, at 9:12 AM, "steve@quintile.net" <steve@quintile.net> wrote:
> 
> co routines plus channels is exactly what I want.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 16:31         ` Bakul Shah
@ 2015-07-09 16:50           ` Skip Tavakkolian
  2015-07-10  2:07           ` erik quanstrom
  1 sibling, 0 replies; 12+ messages in thread
From: Skip Tavakkolian @ 2015-07-09 16:50 UTC (permalink / raw)
  To: 9fans

i would be interested (purely out of curiosity and for learning) to
see a simple test using libtask targeting something like
qemu-system-arm emulating a virtual board like VersatilePB[1] or
simpler system.  i think that would be cool demo.

[1] http://infocenter.arm.com/help/topic/com.arm.doc.dui0224i/DUI0224I_realview_platform_baseboard_for_arm926ej_s_ug.pdf




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] rsc's libtask on embedded
  2015-07-09 16:31         ` Bakul Shah
  2015-07-09 16:50           ` Skip Tavakkolian
@ 2015-07-10  2:07           ` erik quanstrom
  1 sibling, 0 replies; 12+ messages in thread
From: erik quanstrom @ 2015-07-10  2:07 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

all process-like implementations except if they give up on per-cpu multiprogramming are setjmp based at heart.

- erik


On Jul 9, 2015 09:31, Bakul Shah <bakul@bitblocks.com> wrote:
>
> Your use is different and simple enough that I would suggest doing this from scratch in pure C. Or start from an existing setjmp based implementation. It should really be a couple pages of code at most. 
>
> > On Jul 9, 2015, at 9:12 AM, "steve@quintile.net" <steve@quintile.net> wrote: 
> > 
> > co routines plus channels is exactly what I want. 
>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-10  2:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09  8:38 [9fans] rsc's libtask on embedded Steve Simon
2015-07-09 14:17 ` Joseph Stewart
2015-07-09 14:50   ` Steve Simon
2015-07-09 15:09     ` David du Colombier
2015-07-09 15:52       ` Joseph Stewart
2015-07-09 15:55       ` Joseph Stewart
2015-07-09 15:51     ` Bakul Shah
2015-07-09 15:58     ` Joseph Stewart
2015-07-09 16:12       ` steve
2015-07-09 16:31         ` Bakul Shah
2015-07-09 16:50           ` Skip Tavakkolian
2015-07-10  2:07           ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).