Windows System Programming Third Edition


Chapter 16. Win64 Programming



Download 3.41 Mb.
Page23/31
Date31.07.2017
Size3.41 Mb.
#24970
1   ...   19   20   21   22   23   24   25   26   ...   31

Chapter 16. Win64 Programming


The most significant advance in Windows capability since the introduction of Windows NT and 95 is the advent of 64-bit programming and the extension of Win32 to Win64. The combined API is generally referred to simply as the Windows API, and this has been the practice throughout the book. The Win64 API allows Windows to run the largest and most demanding enterprise and scientific applications. These 64-bit systems allow programs to use huge address spaces, larger than the 4GB limit imposed by 32-bit addresses.

This chapter describes Win64 status and benefits, the programming model, and portability and migration issues. These considerations apply regardless of the actual 64-bit processor or the specific Windows version supporting Win64. Program 16-1 shows the process of porting one of the previous examples.


Current Win64 Status


This section reviews the current situation, as of mid-2004, regarding Microsoft's support of Win64 on different systems and processors. The situation is in flux, and this information is only a snapshot in time. Nonetheless, the programming considerations covered here will not be affected by the evolution of Win64 support.

There is likely to be extensive future progress and change, although Win64 adoption has been slow. The information here is generally taken from vendor Web sites and trade publications, and these same sources can be used to obtain updated information in the future.


Processor Support


Win64 is, or almost certainly will be, supported on as many as three distinct processor families.

  • Intel's Itanium Processor family (IPF), which uses an architecture totally different from the familiar Intel x86 architecture. IPF provides large register files (including 128 general-purpose registers), multiple instruction pipelines, large on-chip three-level caches, and numerous other features designed for high performance as well as 64-bit addressing. Itanium 2 processors are currently shipping, and while Itanium, the predecessor, is now obsolete, it is convenient simply to say "Itanium" to refer to the entire family.

  • AMD's AMD64 processors, Opteron and Athlon 64, which are targeted at servers and workstations, respectively. The AMD64 architecture can be regarded as being the Intel x86 architecture with extensions to allow for 64-bit virtual addressing with concurrent 32-bit and 64-bit operation.

  • Intel's 32/64-bit processors, which are comparable to AMD64. At the time of writing, the 64-bit extension technology will first appear on Xeon processors. These processors are predicted to be available sometime after late 2004.

Windows Support


Microsoft's Win64 API is designed to support 64-bit architectures with minimal impact on existing source and binary code. Specific Win64 versions at this time include the following.

  • Windows XP 64-bit Edition is available in at least two versions. A beta test version from Microsoft supports only the AMD Opteron processor. HP markets several Itanium workstations with Windows XP-Itanium 2 already installed.

  • Windows Server 2003, Enterprise Edition for 64-bit Extended Systems is also currently in beta testing. It supports the AMD Opteron and the Intel Xeon with 64-bit extension technology.

  • Windows Server 2003, Enterprise Edition for 64-bit Itanium-based Systems supports, as the name implies, workstations and servers that use one or more Itanium processors. There is also a Datacenter Edition. HP, for example, markets its Integrity systems equipped with this Windows version.

Third-Party Support


Numerous database, mathematical library, enterprise application, open source, and other systems are available on Win64. Nonetheless, anyone planning a Win64 port should verify the availability of required third-party products.

прямоугольник 14564-Bit Architecture Overview


From a programmer's perspective, the major issue in migrating from 32-bit to 64-bit programming models is that pointers and system data types such as size_t and time_t can now be 64 bits long. Therefore, process virtual address space is no longer limited to 4GB (actually, only 3GB is directly available to applications). Thus, Win32 to Win64 migration can be regarded essentially as a "pointer and data stretch" and, within the Windows model, there is very little effect on user data.

The Need for 64-Bit Addressing


Many applications require the ability to access large address spaces. Examples, such as the following, are numerous.

  • Imaging applications. A system with 4GB yields only about 20 seconds of high-definition television (HDTV) with true color.

  • Mechanical and electronic computer-aided design (MCAD and ECAD). Part assemblies for complex components require more than 3GB to be represented, and chip design simulations are extremely memory-intensive.

  • Databases and data warehousing. It is not uncommon to use files of hundreds of gigabytes, and similar amounts of virtual address space simplify the file processing.

Physical systems can now support this demand for large address spaces. For some time, 64-bit microprocessors have been available, and many systems support large physical memories at reasonable cost.

The same factors that make huge files (larger than 4GB) desirable and necessary also drive the need for 64-bit addressing, and now that sufficiently powerful Itanium, AMD64, and 64-bit extension microprocessors are available, it is only natural that Windows should evolve to meet this need. A 64-bit OS is essential if Windows is to play a significant role in enterprise and high-end computing.

Nonetheless, many 32-bit applications will continue to work well and will not require early migration. Personal productivity applications, such as Microsoft Office and Adobe FrameMaker, will probably not require 64-bit migration for some time. Consequently, Windows will support backward compatibility.

Current 64-bit processors frequently provide performance gains, as would be expected, but these gains do not directly impact programming at the source level.


The UNIX Experience


PC systems have always lagged behind mainframe and UNIX systems in terms of core functionality and scalability. The same is true of 64-bit architectures.

  • Major UNIX vendors have provided 48-bit and 64-bit microprocessors since the early 1990s.

  • The major UNIX vendors have supported 64-bit APIs during the same time period.

  • The UNIX community has standardized on the so-called LP64 model, which is different from Win64's P64 model, as will be described later.

  • Migrations from 32 to 64 bits have been relatively straightforward, if not always trivial, and the same can be expected of Win32 to Win64 migration.

The Windows 16-Bit to 32-Bit Experience


The Windows 16-bit to 32-bit migration started in the early 1990s with the introduction of Windows NT, and the migration picked up momentum when Windows 95 became commonplace. Although it is tempting to say that we will see a replay of the same history, there are differences.

  • Windows NT and 95 were the first widely used "real" PC OSsthat is, these two systems supported demand paging, threads, preemptive scheduling, synchronization, and many other features described in Chapter 1.

  • While Win32 greatly expanded the useful address space, as does Win64, the advance was more than that. Obsolete and awkward, but popular, extended memory models were replaced. Although Windows 2000 introduced one similar extended memory model (not described in this book), the overall change is not as significant.

  • Win32 introduced extensive new functionality, whereas Win64 does not.

Are 64 Bits Enough?


Within the PC world where Windows originated, one could argue that the original 16-bit Intel x86 model (which actually provided 20 bits of address space) lasted for more than a decade and that the 32-bit architecture has already lasted as long. However, the move to Win64, and 64-bit programming in general, has been much slower than the move to 32 bits. In both cases, however, minicomputers and servers moved to the next level at least 10 years before PCs made the same move. It's now natural to ask if there will be a future move of servers or even PCs to 128 bits. I would contend that any such extension is more than 10 years into the future simply because of the sheer magnitude of a 64-bit address space.

Predictions are precarious, however, but we could, only half seriously, invoke the oft-quoted Moore's Law to the effect that cost/performance is halved every 18 months. In turn, speed and capacity approximately double every 18 months. Applying this argument to address space, we need one extra bit of address space every 18 months, implying that the 64-bit model should be good for 48 years (nearly as long as the history of modern computing). Whether or not this informal argument, which I have seen in a formal presentation, will hold remains to be seen. However, PC resource requirements in the past have grown faster than this argument would predict.



Directory: bitstream -> NAU
bitstream -> A mathematical theory of communication
bitstream -> Images of Fairfax in Modern Literature and Film Andrew Hopper
bitstream -> Amphitheater High School’s Outdoor Classroom: a study in the Application of Design
bitstream -> Ethics of Climate Change: Adopting an Empirical Approach to Moral Concern
bitstream -> The Age of Revolution in the Indian Ocean, Bay of Bengal and South China Sea: a maritime Perspective
bitstream -> Methodism and Culture
bitstream -> Review of coastal ecosystem management to improve the health and resilience of the Great Barrier Reef World Heritage Area
bitstream -> Present state of the area
NAU -> International significance of icao alphabet for flight safety
NAU -> Performance comparison of android runtime and dalvik environments on an android device

Download 3.41 Mb.

Share with your friends:
1   ...   19   20   21   22   23   24   25   26   ...   31




The database is protected by copyright ©ininet.org 2024
send message

    Main page