In this paper, we describe key features of the Gilgamesh PIM architecture developed at Caltech and JPL, and introduce an object-based programming model for such architectures based on the notion of "macroservers". Macroservers are associated with a state space in which a set of lightweight threads executes asynchronously; the location and distribution of objects and data in PIM memory can be dynamically controlled. We discuss the elements of a software architecture for Gilgamesh and illustrate some aspects of macroservers by outlining a sparse matrix algorithm.