HP-UX Processor Sets A Technical White Paper HP-UX 11i Manufacturing Part Number: 5185-4322 November 2001 © Copyright 2001 Hewlett-Packard Company
ÿ ÿ Notice © Copyright Hewlett-Packard Company 2001. All Rights Reserved. Reproduction, adaptation, or translation without prior written permission is prohibited, except as allowed under the copyright laws. The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose.
Table Of Contents Abstract ............................................................................................................................................5 Introduction.......................................................................................................................................5 Processor Sets Features Overview..................................................................................................5 Benefits of Processor Sets ...................................
ÿ Abstract This white paper discusses the HP-UX Processor Sets (Psets) feature in the HP-UX 11i release. The paper explains in detail the processor sets functionality and how systems can be configured with processor sets to effectively manage system processor resources. The paper also includes selected usage models and examples, as well as the benefits of using processor sets on HP-UX 11i systems.
Dynamic Configuration Privileged users can dynamically set up and change the system processor set configuration. Users can create a new processor set, destroy an existing processor set, or reassign a processor from its current processor set to another. (Every enabled processor in the system is assigned to a processor set.) Dynamic Application Binding Each running application in the system is bound to some processor set, and this processor set defines which processors the application may execute on.
Member of Partitioning Continuum The HP-UX Partitioning Continuum provides a spectrum of tools and mechanisms for users to partition, allot, and manage system resources for their workloads, based on the degree of flexibility or isolation needed. HP-UX Processor Sets provide maximum flexibility in managing processor resource isolation among system workload. Benefits of Processor Sets HP-UX Processor Sets add flexibility and power to the management of processor resources in server systems.
Scheduling Allocation Domain A Scheduling Allocation Domain for an application defines which processors the application may execute on in the system. Without processor sets, an application has access to all processors in the system. Depending on the system workload scheduling policies and priorities, the operating system scheduler may execute the application on any processor in the system. We cannot isolate processor(s) for a given application.
appropriate access permissions, users can dynamically reassign any processor (except Processor 0) to another processor set, thereby removing the processor from its current set. When all processors are removed from a processor set, the processor set becomes empty but still exists. Processors can be reassigned any time later to use the processor set again. However, an empty processor set cannot have any applications assigned to it. Users can dynamically destroy a processor set when it is no longer needed.
Assigning Applications to Processor Sets Every process is bound to a processor set in the system. In a multi-threaded process, every thread has a processor set binding, but not all threads in the process need to be bound to the same processor set; an application may choose to bind some of its threads to different processor sets. As a result, a thread may have a different processor set binding than its process. The processor set binding inheritance follows the scheduling inheritance rules.
ÿ Superuser can perform any processor set operation. ÿ A new privilege group, PRIV_PSET, is defined for processor set operations. (Note: Please refer to the setprivgrp(2) manpage for more information on privilege groups in HP-UX.) Users with PRIV_PSET privilege can perform any processor set operation. This allows someone to acquire “restricted” superuser permissions for processor set management. ÿ Every processor set is assigned a user-owner, who may or may not have superuser or PRIV_PSET privileges.
Non Default Pset Default Yes with WRITE Pset permission in Source Pset Bind a thread or Yes a process to a Pset Yes Yes with EXEC permission if caller No has same effective user-id (EUID) as that of the target process.
WRITE User can modify the processor set attributes and configuration, destroy the processor set. The following bit values are used for the access bit mask: PSET_OWNER_READ The processor set owner has READ access. PSET_OWNER_WRITE The processor set owner has WRITE access. PSET_OWNER_EXEC The processor set owner has EXEC access. PSET_GROUP_READ All users in the processor set owner’s group have READ access. PSET_GROUP_WRITE All users in processor set owners group have WRITE access.
PSET_ATTR_EMPTY Indicates the behavior when a request to bind a process or a thread to an empty processor set is made. An empty processor set has no processors assigned to it. Currently, only the following value is supported: PSET_ATTRVAL_FAIL Reject the request. This is the default value for this attribute. PSET_ATTR_LASTSPU Indicates the behavior when a request to remove the last processor from a processor set is made.
Default Pset. When the last processor from a processor set is reassigned to another processor set, all applications in the now-to-be-empty processor set are migrated to the Default Pset. System Daemon Processes The HP-UX operating system provides a set of kernel-private daemon processes to perform system-level activities and services. Users may configure processor sets in such a way that only a minimum number of processors are left in the Default Pset.
Table 2. Supported Pset APIs API Description pset_create(2) Create a new processor set. pset_destroy(2) Destroy a processor set. pset_assign(2) Reassign a processor from one processor set to another. pset_bind(2) Rebind a process or a thread from one processor set to another. pset_setattr(2) Change processor set attribute values. pset_getattr(2) Query processor set attribute values. pset_ctl(2) Query processor set configuration.
int pset_create( psetid_t *newpset /* OUT: Id of new pset */ ); Any user may create a new empty processor set object. This relaxation in processor set creation, when coupled with the access permissions for other processor set operations, provides for a very flexible processor set usage model. Consider this scenario: The system administrator configures a processor set with some processor resources and then makes some other department administrator owner of the processor set.
# psrset –a 1 2 4 6 successfully assigned processor 2 to pset 1 successfully assigned processor 4 to pset 1 successfully assigned processor 6 to pset 1 Users can create a pset and assign processors using psrset as follows: # psrset –c 2 4 6 successfully created pset 2 successfully assigned processor 2 to pset 2 successfully assigned processor 4 to pset 2 successfully assigned processor 6 to pset 2 Binding Applications to a Processor Set The pset_bind() system call allows users to rebind a process, a thread
# mpsched –c 1 –p 271 Pid 271: bound to processor 1 Multi-threaded applications based on the POSIX PTHREADS library can change the processor set binding of a pthread using the pthread_pset_bind_np() library interface. int pthread_pset_bind_np( psetid_t *answer, /* OUT: thread’s current pset*/ psetid_t pset, /* IN : new pset for thread */ pthread_t pthreadid /* IN : target pthread */ ); Destroying a Processor Set The pset_destroy() system call allows users to destroy a processor set.
pset_attrtype_t type, /* which attribute */ pset_attrval_t val/* new value for attribute */ ); (Please see the section, Attributes for Better Manageability, for the list of supported attributes and possible attribute values.) Users can query and change attribute values using psrset. In the following example, the user first queries the current values of attributes for processor set 1, and then changes the processor set ownership, access permissions, and the value of the PSET_ATTR_NONEMPTY attribute.
system. PSET_GETFIRSTPSET Return psetid of the first processor set in the system. PSET_GETNEXTPSET Return psetid of the next processor set in the system after pset. PSET_GETCURRENTPSET Return psetid of the current processor set for the calling thread. PSET_GETNUMSPUS Return the number of processors assigned to the processor set pset. PSET_GETFIRSTSPU Return the ID of the first processor in the processor set pset.
thread. MPC_GETNUMSPUS_SYS Return number of enabled processors in the system. MPC_GETFIRSTSPU_SYS Return ID of the first enabled processor in the system. MPC_GETNEXTSPU_SYS Return ID of the next enabled processor in the system after the specified processor. The pstat_getpset() interface allows applications to query the processor sets specific information.
ÿ Use PRM. The HP PRM maintains the configuration in a database. When PRM is started after reboot, it can restore the configuration saved in the database. ÿ Use psrset. The psrset command provides a command line interface for processor set configuration, which can be programmed as a shell script for the desired configuration.
configured with maximum processors, but users activate only the processors needed to meet their needs. A deactivated processor remains in the system (ready to be activated at any time without requiring system reboot), but does not process any workload. The processor sets will integrate with iCOD as follows: ÿ A processor is removed from its current processor set when deactivated. A deactivated processor does not belong to any processor set. ÿ When reactivated, the processor is added to the Default Pset.
Also, many applications are designed to scale to all available resources in the system with the assumption that the entire system is available to them. As servers with enough power to host many applications become available, the customers are now looking to consolidate their applications into larger servers, although they still need resource partitioning among applications to minimize interference and to guarantee necessary resource allocation to each application.
For More Information Please refer to the following web sites for more information on processor sets, resource management, and other features available in HP-UX: ÿ HP-UX Operating System http://www.hp.com/go/hpux ÿ HP-UX Processor Sets http://www.hp.com/products1/unix/operating/hpux11i/hpux11i_proc_sets.html ÿ Download Processor Sets for HP-UX 11i systems http://ww.software.hp.com (Click Enhancement Releases) ÿ HP-UX Process Resource Manager (PRM) http://ww.hp.