Service morphing is a set of techniques used to continuously meet an application's quality of service (QoS) needs, in the presence of run-time variations in service locations, platform capabilities, or end-user needs. These techniques provide high levels of flexibility in how, when, and where necessary processing and communication actions are performed. Lightweight middleware supports flexibility by permitting end-users to subscribe to information channels of interest to them whenever they desire, and then apply exactly the processing to such information they require. New compiler and binary code generation techniques dynamically generate, deploy, and specialize code in order to match current user needs to available platform resources. Finally, to deal with run-time changes in resource availability, kernel-level resource management mechanisms are associated with user-level middleware. Such associations range from loosely coupled, where kernel-level resource management monitors and occasionally responds to userlevel events, to tightly coupled, where kernel-level mechanisms import, export, and use performance and control attributes in conjunction with each resource-relevant userlevel event.