I've been meaning to sit down and try this for a month...and now I have.

One of the things that people seem to be excited about with CALL WORKER is
the ability to run on something other than the main core. I'm not as
excited about this as some, but I'm ready to be convinced. It strikes me as
an excellent feature for a specific subset of problems where the benefits
will really shine...and not worth the effort for most things.

But anyway, that's just my opinion and not the question. Here's the setup
for the question:

* You can run a worker in cooperative (traditional, single-core) mode or
preemptive (multi-core) mode.

* The difference is in how you _start_ the worker.

* Preemptive threads can't access a lot of features because of OS
limitations.

* Therefore, it's illegal to call various commands for execution in a
preemptive thread.

I've got no problem with any of that and, as far as I can tell, 4D have
done a pretty darn good job of giving us access to multi-core programming.

Still getting to the question. Right, so, how do you coordinate UI with a
headless preemptive worker? CALL FORM and CALL WORKER. I guess this is even
the motivation behind these commands in the first place. Now we get to the
question: Pushing illegal code to a preemptive worker.

CALL FORM and CALL WORKER don't send "messages", they send blocks of code
for execution in an existing context. They're remote procedure calls.
There's no broker to intercept or inspect the code that we can see or
influence, 4D gets the call, appends the code to the call chain in the
target context and then runs the code. This isn't exactly how it's
described in the manuals, but that's how it's designed, how it works, and a
different way that it all _could_ be described in the manuals.

Okay, now this gets to the question about illegal code. When you compile,
4D's compiler checks the call chain for a preemptive method and verifies
that there is no chance at all of an illegal call coming through. So, no
open windows, etc. You can't even get the database to compile if there's
_anything_ wrong. I think 4D's done a good job with this and have no
complaints about this approach...but the compiler can only see static code.
So, it can see all of the code at rest, but none of the code at runtime.
What prevents you from pushing over some illegal code with CALL WORKER?
CALL WORKER appends that code to the worker and runs it *in its context.*
In other words:

-- You've got a preemptive thread.
-- It can't run a variety of commands.
-- You push over some illegal code via CALL WORKER.
-- 4D's is meant to EXECUTE the cooperative (illegal) code in the
preemptive (multi-core) context.

What happens? Not what I feared, not what I expected, not what I want, and
not what's documented.

I'm curious what a) people thing should happen, b) what people want to have
happen), and c) what other people see does happen.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to