Re: Preemptive execution question

2017-04-07 Thread Chip Scheide via 4D_Tech
I have not read any more of this thread...
I am not able to use these commands...

What should happen:
- 4D should throw an error (interseptable by On Err) on the computer 
that caused the problem (i.e. client or server)
- abort the illegal code block. SO if the error occurs inside some 
looping structure, it is not just the loop that is terminated, but the 
entire enclosing block of code.
- move on to the next executable block of code 

is this what happens? I guess I will see as this thread progresses.
On Fri, 7 Apr 2017 10:52:33 +1000, David Adams via 4D_Tech wrote:
> 
> -- 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,
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
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
**

Re: Preemptive execution question

2017-04-06 Thread John DeSoi via 4D_Tech

> -- 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.

Please tell us. Inquiring minds want to know.

> I'm curious what a) people thing should happen, b) what people want to have
> happen), and c) what other people see does happen.

I want it to work unless a non-preventive command is executed. Then it should 
crash with an informative error message :).

Personally, I thought the design was wrong to prevent code from compiling. We 
have plenty of documented cases that are not allowed and if you ignore them 
your application will crash. But it is easy enough to write one method that 
works in different contexts that does the right thing. The preemption 
restrictions require maintaining duplicate code where you have functionality 
that needs to work in preemptive and non-preemptive contexts.

John DeSoi, Ph.D.

**
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
**

Preemptive execution question

2017-04-06 Thread David Adams via 4D_Tech
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
**