$ID,2$There is no distinction between $FG,2$task$FG$, $FG,2$process$FG$ or $FG,2$thread$FG$. The $FG,2$Fs$FG$ segment reg is kept pointing to the current task's $LK,"CTask",A="MN:CTask"$. There is only one window per task, and only $FG,2$Core0$FG$ tasks can have windows. Each task has a code and data heap so memory is returned when it dies. Each task has a $LK,"hash",A="HI:Hash"$ symbol table.
Since there is not friendly disk sharing and all tasks have the same address map, it might be accurate to call ZealOS, "multi-thread/single-process". You run a single application process on $FG,2$Core0$FG$ and it can create threads on the same core or others. If you run multiple processes, it should be safe, but one process will wait until another completely finishes a long disk access.
$ID,-2$$TR,"System Task"$
$ID,2$The System task is immortal. The system task is created at start-up and appears in the small window at the top beneath the user terminal windows. Since the System task is immortal, on its heap go all memory objects which you don't want destroyed by any single task's death. When created, the System task runs the file $LK,"::/StartOS.CC"$. When start-up is finished, the system task enters a server mode where it accepts requests from other tasks. The $LK,"Sys",A="MN:Sys"$("") routine will make the System task compile and run text src code. $FG,2$#include$FG$ statements can be sent to $LK,"Sys",A="MN:Sys"$(""), creating system-wide code and data which are immortal.
$ID,2$ZealOS uses the asm $FG,2$CALL$FG$ instruction, exclusively, and that instruction is limited to calling routines $FG,2$+/-2Gig$FG$ from the current code location. To prevent out-of-range issues, code and data are separated, placing all code within the lowest $FG,2$2Gig$FG$ of memory, addresses $FG,2$00000000$FG$-$FG,2$7FFFFFFF$FG$. The compiler and $LK,"Load",A="MN:Load"$()er alloc memory from the code heap to store code and global vars, unless the compiler option $LK,"OPTf_GLOBALS_ON_DATA_HEAP",A="MN:OPTf_GLOBALS_ON_DATA_HEAP"$ is used. When programs call $LK,"MAlloc",A="MN:MAlloc"$() is from the data heap, which in not limited in size, except by physical RAM memory. You can alloc from any heap in any task at any time on any core, even making $LK,"independent",A="MN:MemPagAlloc"$ heaps.
$ID,2$Often a task will $LK,"Spawn",A="MN:Spawn"$() or $LK,"PopUp",A="MN:PopUp"$() a task as a helper. The helper is known as a child Task, though you can $LK,"Spawn",A="MN:Spawn"$ a task and assign it a different parent... like $FG,2$System$FG$. Links are kept as to who's whose child, so when one task is $LK,"Kill",A="MN:Kill"$()ed the child helper tasks die, too. You can get a report of current system tasks with $LK,"TaskRep",A="MN:TaskRep"$(). There is just one window per task, so child tasks are needed for pop-ups.
$ID,2$$LK,"CosmiC",A="FI:::/Doc/CosmiC.DD"$ is more than $FG,2$C$FG$ and less than $FG,2$C++$FG$. It has the default args of $FG,2$C++$FG$ and uses $FG,2$class$FG$ in place of $FG,2$struct$FG$. It uses $FG,2$U0,U8,U16,U32,I64$FG$ and $FG,2$I0,I8,I16,I32,I64$FG$ for signed and unsigned ints. It has different $LK,"operator precedence",A="FF:::/Doc/CosmiC.DD,operator precedence"$. It has $FG,2$PASCAL$FG$-like function calls with no parens, but requires an $FG,2$&$FG,2$$FG$ when referring to function addresses.
In $FG,2$AOT$FG$ mode, $FG,2$.PRJ$FG$ files are compiled to $FG,2$.BIN$FG$ files, skipping $FG,2$.OBJ$FG$ files. After compiling, $FG,2$.BIN$FG$ files are $LK,"Load",A="MN:Load"$()ed.
There is no $FG,2$main()$FG$ routine. Instead, statements outside functions are automatically executed upon loading. There is no way to unload except by killing the task. To invoke $FG,2$AOT Compiled Mode$FG$, $LK,"Comp",A="MN:Comp"$() is used. The $FG,2$Kernel$FG$ module and compiler are made in $FG,2$AOT$FG$ compiled mode. See $LK,"BootHDIns",A="MN:BootHDIns"$() which calls $LK,"MakeAll",A="MN:MakeAll"$() where $LK,"::/Boot/Kernel.BIN.C",A="FI:::/Kernel/Kernel.PRJ"$ and $LK,"::/Compiler/Compiler.BIN",A="FI:::/Compiler/Compiler.PRJ"$ are created.
$ID,2$In $FG,2$just-in-time$FG$ mode, the compiler places code and data in memory alloced from the heap, incrementally, making them immediately ready for in-place execution. This mode is used during cmd line operations. When you $FG,2$#include$FG$ a file, it is compiled function by function and code ends-up all over in the memory, at least in the first 2Gig of memory. The $LK,"ExeFile",A="MN:ExeFile"$() routine is the same as $FG,2$#include$FG$ but can be used in programs. $LK,"ExePrint",A="MN:ExePrint"$() routine will compile and run a string.
$ID,2$The compiler generates insts one step before making actual assembly (machine) language insts. This code is rev polish stack machine in nature and can be viewed with $LK,"PassTrace",A="MN:PassTrace"$(). The compiler does not $FG,2$interpret$FG$ code, except in the process of optimization to make the final machine code. Assembly language output can be viewed when code is compiled with the $LK,"Trace",A="MN:Trace"$(), or, afterward, with $LK,"U",A="MN:U"$() or $LK,"Uf",A="MN:Uf"$("").
$ID,2$Since there are no $FG,2$namespaces$FG$, it is highly recommended to put a 2-3 character module code prefix on syms. e.g. $FG,2$WS$FG$, $FG,2$Doc$FG$, $FG,2$Lex$FG$
Function args which are outputs (passed as ptrs) have leading underscores. Also, args which have idently named local variable counterparts have leading underscores.
$FG,5$*$FG$ C++ like naming is used. $FG,2$New$FG$, $FG,2$Del$FG$, $FG,2$Init$FG$, $FG,2$Reset$FG$, ect. are placed on the end of a function name instead of at the beginning. $FG,2$ResetMusicSettings$FG$ should be $FG,2$MusicSettingsReset$FG$.
$ID,2$Programs can dynamically request chunks of memory alloced from a $FG,2$heap$FG$ using $LK,"MAlloc",A="MN:MAlloc"$(). They must $LK,"Free",A="MN:Free"$() it when finished. Ptrs are used to refer to the chunk. The $FG,2$heap$FG$ is dynamically alloced mem.
$ID,2$Many operating system structures have space set aside for you to store values. You are on your own managing these with multiple applications and libraries.
$ID,2$Core0, has the $LK,"System Task",A="FF:::/Doc/Glossary.DD,System Task"$$FG$, and it is the master. The $FG,2$application processors$FG$ have an $LK,"Executive Task",A="FF:::/Doc/Glossary.DD,Executive Tasks"$ and are the slave processors. Only $FG,2$Core0$FG$ tasks can have windows and can launch applications. Slave cores are used if the application explicitly $LK,"Spawn",A="MN:Spawn"$s() a task or $LK,"JobQueue",A="MN:JobQueue"$() a job on them.