An Overview of Palm OS n Designed for special hardware –small screen ( 160 x 160 ) –less processing power than desktop PCs –quick turnaround expected –limited memory ( 512k ~ 8MB ) –no disk drive or PCMCIA disk
The Appearance of a PalmPilot
System Architecture
Memory Orgnization n Motorola uses 32-bit addresses n External data bus is only 16 bits wide n ROM - stores the main suite of applications ( the OS itself) n RAM - stores additional and replacement applications & system extensions n RAM - dynamic RAM & storage RAM
Dynamic RAM n Served as temporary space for allocation n Analogous to the RAM installed in a typical desktop system n Is cleaned after reboot n Implement a single heap that provides memory for dynamic allocations( TCP/IP, IrDA, …)
Storage RAM n Holds nonvolatile user data ( appointments, to do lists, memos, address lists, … ) n Is accessed via calling the database manager or the resource manager n Analogous to the disk drive of a typical desktop system
Memory Chunks and Heaps n A chunk - contiguous memory between 1byte ~ 64 KB that has been allocated by the Palm OS memory manager n Each chunk resides in a heap n Memory manager allocates memory in the dynamic heap n Data manager allocates memory in the storage heap
Memory Heaps n Each heap has a unique heap ID n The heap with heap ID 0 is the dynamic heap n Only the dynamic heap is reinitialized through soft reset cycles
Movable / Nonmovable Chunks n Each chunk is referenced by a local ID n The local ID of a nonmovable chunk : the offset of the chunk from the base address of the card n The local ID of a movable chunk : the offset of the master pointer to the chunk from the base address of the card
The Memory Manager n The functions of the memory manager: –allocating new chunks –disposing of chunks –resizing of chunks –locking and unlocking chunks –compacting heaps when they become fragmented
Heap Structure n Master pointer table stores 32-bit pointer to movable chunks n Movable chunks are allocated at the beginning Heap Header Movable chunks Non-movable chunks Heap Master pointer table
Chunk Structure n Each chunk begins with an 8-byte header followed by that chunk’s data n Flags:sizeAdj flag: –high nibble : set for free chunk –low nibble : reqSize = size [this value] n size field( 3 bytes) –the size of the chunk, which is larger than the size requested by the application, including the chunk header itself
Chunk Structure(cont.) n Lock:owner byte –high nibble : the lock count, which is incremented when being locked –low nibble : the owner ID of the memory chunk n hOffset field( 3 bytes) –the distance from the master pointer to the chunk header, divided by two
The Data Manager n The database is analogous to disk n A database is a collection of records n A record is mapped to a memory chunk n A database accesses its records by storing their local ID’s n An application requests a particular record in a database by index
The Resource Manager n Resources : store the UI elements of an application, such as images, fonts, dialog layouts, … n Resource manager : Data manager with the additional ability of tagging each chunk of data with a unique resource type and resource ID
Application Structure n Single threaded n Event-driven n PilotMain() corresponds to main() in C n PilotMain -- Response to launch codes n An event loop in response of a normal launch
Flowchart of event handling
Developing Apps on Palm n Various development tools: –Code Warrior for Palm OS –Palm SDK (header files, documents, examples) –GCC –POSE - An open source Palm emulator runs on Windows, Mac and UNIX
Conclusion n The Palm OS provides a good platform for developing Palm apps n The Palm OS provides various libraries for communicating with PC’s n A good OS design is not necessarily having the most advanced feature, but having the best integration of the hardware
The End B 龔律全 B 卓聖堯