Can you use the task functions RemoveTask() etc. with processes ?
You can RemTask() a process, but you must be very careful when you use it. It's the same for tasks too. In general it's not good design to call RemTask() for a foreign task.
I don't think so, so how do you exit well from a spawed(child) process created from disk then ?
Basically when task/process runs into final 'rts with original sp' (or end of the initial function in C), system will internally call RemTask(NULL) anyway.
In general you should avoid forcibly removing any of your child tasks/processes, if only possible. Rather you should use a signal or message to request the child to abort, then Wait() [for signal] or WaitPort() + GetMsg() [for message] in the parent to make sure the child has terminated. The child will indicate the termination by first calling Forbid(), and then Signal() [for signal] or ReplyMsg() [for message]. NOTE: There musn't be matching Permit()! The idea here is to avoid running into race condition (that is the child still executing the LoadSeg()d code while the parent already UnLoadSeg()ed it!). The child running into RemTask() will handle the missing Permit() when it removes the task/process from the system.
I know I'm beginning to sound like a broken record here, but
my IPC example should demonstrate this quite well... :-)