OS is single-threaded, but multi-tasked. There can be only one thread in one process, but you can create multiple processes. The launch flags I listed here (NewThread | NewStack | NewGlobals) are used to create a new background process.

Perhaps we're simply using different terms, but in the terminology we use, Palm OS 5.x and earlier have multiple preemptively-multitasked threads, all in a single process. (A process determines priority & security levels, access to memory segments, etc. and in 5.x and earlier, all threads in a process have the same access.)


So I'd change your statement to read "Palm OS 5.x and earlier have a single process, with multiple threads. There is no way to create another process, but there are a limited number of threads which can exist at a time." The max # is hard-coded, so be careful with what you design: your software might not be the only software on the device using this technique!


Palm document is so poor that I can not find any information regarding how different processes can communicate with each other.

The documentation quality is generally considered to be quite high; it is simply that what you're looking for is undocumented and therefore doesn't (and shouldn't) appear in the docs. It wasn't until 6.0 that there were supported mechanisms to create processes and threads and have them communicate with each other.


Prior to 6.0 there were very limited mechanisms: there was a memory semaphore which both controlled access to write to the storage heap(s) and also acted as a rudimentary mutex... and a few carefully designed APIs which were reentrant and thus used for simple communication, principally the key queue. But no promises or support were made for multithreading except in limited circumstances for licensees for various reasons, particularly contractual ones.

If you must use a background thread on 5.x and earlier, use as few system services as possible: most of 5.x wasn't designed for reentrancy and those sorts of problems are the hardest to debug.

-David Fedor
PalmSource, Inc.

--
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to