1. Multitasking

--0-2012788142-1161920318=:74713
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Please, help me clean up one question.
We have multitasking in E now released as inner property of E interpretator.
If I used this multitasking functions (task_...) and then translate E program to
C by "e2c" - will be multitasking kept ? For Linux. I.e. when after compiling by
C compiler I will have one binary executable file - will work some code parts
concurently as independent processes as it was in E ?
Or better use ' system("myprog &", 2) ' ?


 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.
--0-2012788142-1161920318=:74713
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Please, help me clean up one question.<br>We have multitasking in E now released
as inner property of E interpretator.<br>If I used this multitasking functions
(task_...) and then translate E program to C by "e2c" - will be multitasking kept
? For Linux. I.e. when after compiling by C compiler I will have one binary
executable file - will work some code parts concurently as independent processes
as it was in E ?<br>Or better use ' system("myprog &amp;", 2) ' ?<br><br><p> 
		<hr size=1>Do you Yahoo!?<br> 
Get on board. <a
href="http://us.rd.yahoo.com/evt=40791/*http://advision.webevents.yahoo.com/mailbeta">You're
invited</a> to try the new Yahoo! Mail.
--0-2012788142-1161920318=:74713--

new topic     » topic index » view message » categorize

2. Re: Multitasking

Volodymyr Ilnytskyy wrote:
> Please, help me clean up one question.
> We have multitasking in E now released as inner property of E interpretator.
> If I used this multitasking functions (task_...) and then translate E program
> to C by "e2c" - will be multitasking kept ? For Linux. I.e. when after
> compiling
> by C compiler I will have one binary executable file - will work some code
> parts
> concurently as independent processes as it was in E ?
> Or better use ' system("myprog &", 2) ' ?

Multitasking works the same in the interpreter and the translator,
on all platforms (DOS, Windows, Linux, FreeBSD).

However, a Euphoria task is not the same as an operating system thread
or operating system process. Your multitasking Euphoria program runs 
as a single thread within a single process. That's how it looks to
the operating system. 

The Euphoria scheduler decides which task to run next whenever 
the current task executes task_yield(). The scheduler sets up the 
call stack and set of private variables for the task it wants to run.

Euphoria's multitasking is "cooperative". Operating system
threads are "preemptive". The operating system can switch
from one thread to another whenever it wants, essentially at random. 
This is rather dangerous, and you have to make careful use of locks 
to protect shared data. With Euphoria's cooperative multitasking,
there is far less danger, and less need for locks, since a task
need not let go of control until it has completed a complete,
logical step.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

3. Multitasking

I have seen many demos of programs that employ multitasking abilities. So far
I have only been able to create single task programs with procedures and
functions. All the demos that I have seen are unfortunately already bound, so
I have no idea how to get multitasking ability in my programs. Can anyone help
me out???

new topic     » goto parent     » topic index » view message » categorize

4. Re: Multitasking

ThatNerd at AOL.COM wrote:
>
> I have seen many demos of programs that employ multitasking abilities. So far
> I have only been able to create single task programs with procedures and
> functions. All the demos that I have seen are unfortunately already bound, so
> I have no idea how to get multitasking ability in my programs. Can anyone help
> me out???

see language wars in the euphoria zipfile...
it implements a 'round robin' kinda pseudo multitasking...
its really not that far away from 'true' multitasking anyway...

basically, in short:
create a global sequence (array) that will have one element for
each task that will be running 'simultaneously'.
the value at that element will be when it can have use
of the programs attention again, in absolute referenced, linear time.

if you have ten tasks, 3 of which are supposed to happen every
0.1 seconds, 2 at 0.4seconds, another every second, and a couple
that need to happen as soon as possible from the last time they
executed, (let's say a delay of 0.001 seconds), and the current
time is 2130.092, then your array may say:
{2130.105,2130.206,2130.093.... etc

you then have a loop in your main loop that scrolls thru every
element looking for the next task that is ready to go...
if its ready, call that proc, and return to looking for the
next ready task...

language wars is a good example, and even includes the ability
to have early execution of some tasks if no tasks are quite ready
to go yet, for that 'idle time' processing work, so that when
a task that *is* ready to go, won't have to wait for the task
that could have been done during idle time to complete...

hope this helps --Hawke'

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu