Mon 16 Mar 11:39:34 CET 2026

This commit is contained in:
sbosse 2026-03-16 11:40:39 +01:00
parent 50409ce811
commit 44be850085

17
doc/tasks.md Normal file
View File

@ -0,0 +1,17 @@
# Multi-Tasking
The PLX programming language as well as the VM supports multi-tasking based on the traditional Unix-style process forking. A process fork create a copy of the parent process. Here the parenrt and child task shares the same physical code and heap memory, but each task has its own registers, stacks, and context structures. On forking the parent stacks are copied to the child task's stacks. Multi-tasking is prossible with global memory (variables), but it is very limited. Therefore, there are global variables stored in the heap memory and local variables stored in the stack memory.
[EXAMPLE] Ex. [#fork]. Example of the task forking using global and local variables. After the fork both tasks have diefferents sets of local variables but a shared set of global variables. { size:12 }
```
var xg
var* xl,id
id=fork
xg=id
yield
xl=id
! xl,xg
```
? Task locking using lock and unlock operation applied to any (global) variable? lock(xg) unlock(xg), user function or event? Use heap variable structures for locking?