Next: Automation of Persistence
Up: The Palm Connected Organizer
Previous: The Device
The Operating System
PalmOS is a simple, single-tasking operating system
with a GUI widget set that enables the application developer
to build event driven, graphical applications.
The 2 to 8 MB of physical RAM is divided into two parts:
- 64 KBytes of ``dynamic memory'' in older version of PalmOS,
and up to 256 KBytes in more recent versions. This is the amount of
RAM in which a PalmOS application executes. Memory in this area can
be acquired from the operating system through the MemPtrNew
system call and then be freely written and read.
- The remaining memory - called ``static memory'' - is
battery-backed. This area is maintained by the OS as secondary
memory. It is organized as a list of ``databases'' with mostly untyped
records of variable size to which the user can obtain a handle using
the DmGetRecord call. By locking such a handle using the
MemHandleLock call, a pointer to a record's location can be
obtained. As long as a handle is locked the operating system
guarantees not to move the associated record in memory. The pointer
returned by MemHandleLock only allows read access to
the record's memory area. Writing has to be performed using the
DmWrite call - direct write access will result in a fatal
exception and will eventually reset the device.
This partitioning of the device's physical memory can be
avoided by using the undocumented system calls
MemSemaphoreReserve/MemSemaphoreRelease. These will switch
the memory protection of the ``static'' memory area off and
on. When these calls are used, great care has to be taken when
issuing other system calls as some may need the semaphore. This forces
the programmer to release the memory semaphore before entering certain
system calls.
As mentioned in the introduction, PalmOS has no automatic
multi-tasking capabilities. If a user changes from one application to
another, the first one will be asked to stop by an AppStop
event. Once it has stopped, all dynamic memory will be reclaimed by
the operating system. The second application will then be started
using the same dynamic memory as the first. The operating system does
not provide any implicit support for saving the context of an
executing application. Instead, the application programmer is forced to
save the state explicitly, in a database residing in static memory.
Next: Automation of Persistence
Up: The Palm Connected Organizer
Previous: The Device
2001-02-27