The htmobile library provides a convenient means to retrieve feature and identification data to improve application performance.
The variety of hardware platforms currently available requires applications to have access to increasingly large amounts of hardware information in order to run efficiently.
Systems that support Hyper-Threading Technology, for instance, expose two logical processors to the operating system for each physical processor. This characteristic produces a challenge, since the two logical processors share some resources and must be treated differently than two physical processors. Moreover, since the operating system will report two CPUs instead of one, Hyper-Threading Technology must be addressed in terms of software licensing when implementing per-processor pricing models.
Another problem to be considered is the case of multithreaded applications in a multiprocessor system. Ideally, the number of threads created should be equal to the number of available processors, in order to optimize performance.
In a Hyper-Threading Technology-enabled system, however, the operating system will return the number of logical processors instead of physical processors. Thus, the number of threads created could be greater than the number of physical processors. This situation would result in threads competing for resources, causing degraded performance.
It is also necessary to know the IDs of the current physical processor, logical processor, process, and thread for purposes of load balancing.
Finally, Intel® Centrino® mobile technology raises the need for a utility to detect the Pentium® M processor, since its architecture is different from that of the Pentium® 4 processor. Due to the differences in architecture, programs optimized for the Pentium 4 processor are not guaranteed to run well on systems based on Intel Centrino mobile technology.
The htmobile library contains functions that provide information to address many of the issues associated with these challenges. Roles served by these functions range from detecting Hyper-Threading, physical processors, and processor IDs to identifying mobile system characteristics and status, detecting Streaming SIMD Extensions (SSE/SSE2) support, and support for Prescott New Instructions (PNI) Technology.
The library was created in an attempt to make a one-stop shop so that developers do not have to spend their time recreating utility functions or linking many libraries. They can therefore concentrate their energy on developing their own programs.
The library supports a wide variety of hardware platforms, including the AMD Athlon*, Pentium® processor, Pentium® Pro processor, Pentium® II processor, Pentium® III processor, Pentium® III Xeon® processor, Pentium 4 processor, and Pentium M processor. Systems can have any number of physical processors. The library supports Windows* 98 SE, Windows ME, 32-bit Windows 2000, and 32-bit Windows XP. It supports the Intel® C++ compilers, as well as the Microsoft Visual C++ 6.0 compiler and later.
The htmobile library consists of two parts: the library itself, called htmobile.lib, and the include file, named htmobile.h. The functions in the library can logically be divided into three categories: functions related to Hyper-Threading Technology, functions related to processor features, and functions related to mobility. The following discussion of the functions divides them into those three categories.
Functions in the htmobile Library Related to Hyper-Threading Technology
The following htmobile functions gather information related to Hyper-Threading technology:
The following htmobile functions gather information related to processor features:
The following htmobile functions gather information related to mobile system functionality:
Counting correctly the number of physical processors in a system is very important, since that information is the building block of performance for multi-threaded applications in multi-processor machines. It is even more vital in systems that support Hyper-Threading Technology, since Windows has no way on its own to obtain information about the number of physical processors.
Developers must distinguish between systems based on Pentium 4 processors and Pentium M processors, since these two different architectures require different optimizations by applications. Coupled with additional information that is provided by the functions in the htmobile library, including processor features and mobile power data, this information can efficiently provide the basis for applications to detect key information about the operating hardware platform. That information is vital to providing responsive applications that make the best use of the hardware.
Information related to the material covered in this article is available from the Intel® 64 and IA-32 Architectures Developer's Manual: Vol. 2A.
Intel, the world's largest chipmaker, also provides an array of value-added products and information to software developers:
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804