Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #20610
| From | Bernd Paysan <bernd.paysan@gmx.de> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Hosted Forths on multicore machines |
| Date | 2013-03-13 01:51 +0100 |
| Organization | 1&1 Internet AG |
| Message-ID | <khoiia$rt6$1@online.de> (permalink) |
| References | <fd73df23-4c41-4cd7-936a-3141d752af25@g16g2000vbf.googlegroups.com> <khlvr3$jq3$1@online.de> <e0f429ac-b7ba-45ff-9900-293bd90cf992@oz4g2000pbc.googlegroups.com> <7b6f28a8-83d1-429e-9c20-22959df667c3@q9g2000pbf.googlegroups.com> |
Alex McDonald wrote: > On Mar 12, 1:05 pm, Alex McDonald <b...@rivadpm.com> wrote: >> On Mar 12, 1:19 am, Bernd Paysan <bernd.pay...@gmx.de> wrote: >> >> > Alex McDonald wrote: > [snip] >> >> > > Forth's traditional "multiuser" feature isn't adequate (PAUSE). It >> > > simply isn't extendable to multi core machines. >> >> > Well, in Gforth's unix/pthread.fs (using Posix threads as multitasker), >> > PAUSE just maps to sched_yield(). >> >> That's not useful in a multicore environment. With 4 cores and 4 >> threads, one thread active per core, it will return immediately. >> Unless there's processor affinity set on the thread, any core can run >> any thread; all PAUSE does is pester the OS scheduler for no net >> return. It's only useful in single core/multithread environments; for >> instance, you release a mutex and want to have other tasks that are >> waiting get CPU cycles. >> > > (adding) Or if you have an issue with priority inversion, PAUSE may be > useful. But it is avoidable with good design. I don't actually use PAUSE. It's just there, for "compatibility reasons" and it calls sched_yield(), which sometimes may be useful. I exclusively use the <event ->somesignal task event> construct. It does everything I need: It sends an atomic (multi-)message from one task to the other, and I can define the sequence point (the event> side is the sender's sequence point, the ?events is the receiver's sequence point). Example: I'm splitting my net2o packet handler code off into a task at the moment. This means you can write event-driven programs that communicate with each others through net2o. It turned out to be a trivial exercise: Just put a <event ... task event> wrapper around the packed handler, and if there is an event to signal inside the code that handles packets, signal it. I need to expose the unsent event queue length, because there's no need to send empty queues around (or is this just an optimization issue? <event task event> should really do nothing, and do it fast). This is still somehow in flux, because <event is not really needed. Whatever events come, queue up, and event> sends them. The only possible reason why you might want <event is for nesting, something like <event ->foo ... <event ->bar a event> ... b event> -- Bernd Paysan "If you want it done right, you have to do it yourself" http://bernd-paysan.de/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-11 14:17 -0700
Re: Hosted Forths on multicore machines "Clyde W. Phillips Jr." <cwpjr02@gmail.com> - 2013-03-11 17:41 -0700
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-12 06:38 -0700
Re: Hosted Forths on multicore machines Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-12 02:19 +0100
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-12 06:05 -0700
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-12 06:34 -0700
Re: Hosted Forths on multicore machines Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-13 01:51 +0100
Re: Hosted Forths on multicore machines "Elizabeth D. Rather" <erather@forth.com> - 2013-03-12 09:46 -1000
Re: Hosted Forths on multicore machines Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-03-13 11:30 +0100
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-13 04:35 -0500
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-13 06:55 -0700
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-13 09:49 -0500
Re: Hosted Forths on multicore machines Paul Rubin <no.email@nospam.invalid> - 2013-03-13 08:18 -0700
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-13 10:39 -0500
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-13 16:36 -0700
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-14 03:44 -0500
Re: Hosted Forths on multicore machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-14 09:06 +0000
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-14 06:26 -0500
Re: Hosted Forths on multicore machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-03-14 15:41 +0000
Re: Hosted Forths on multicore machines Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-14 17:56 +0100
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-15 03:26 -0500
Re: Hosted Forths on multicore machines Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-16 23:11 +0100
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-12 05:01 -0500
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-12 06:10 -0700
Re: Hosted Forths on multicore machines Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-03-12 17:04 +0100
Re: Hosted Forths on multicore machines Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-03-12 11:28 -0500
Re: Hosted Forths on multicore machines Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-03-12 19:52 +0100
Re: Hosted Forths on multicore machines morrimichael@gmail.com - 2013-03-12 10:11 -0700
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-12 11:34 -0700
Re: Hosted Forths on multicore machines Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-03-12 19:44 +0100
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-12 13:13 -0700
Re: Hosted Forths on multicore machines Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-03-15 15:44 +0100
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-15 09:37 -0700
Re: Hosted Forths on multicore machines Alex McDonald <blog@rivadpm.com> - 2013-03-12 11:37 -0700
Re: Hosted Forths on multicore machines Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-03-13 10:46 +0100
Re: Hosted Forths on multicore machines the_gavino_himself <visphatesjava@gmail.com> - 2013-03-12 15:22 -0700
csiph-web