Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


April 1998

Optimizing NT's WOW Subsystem


RSS
Subscribe to Windows IT Pro | See More Internals and Architecture Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Running Win16 Applications in Separate Memory Spaces
Like the DOS VDM, the Win16 VDM is a multithreaded process wherein each Win16 application is a different thread of execution. The Win16 VDM is multitasked, so you can run a shared WOW VDM concurrently with threads from other system processes (e.g., Win32 processes). However, because of the Win16 VDM design, the system can service only one thread representing one Win16 application within one VDM and WOW process at a time. While the system is servicing the thread for one Win16 application, the NT thread dispatcher (or scheduler) blocks the other threads within the same WOW environment. Whenever some process (e.g., a higher priority thread) preempts this thread, the thread dispatcher resumes with the thread that was last preempted.

For better performance, memory isolation, and application protection, you can run each 16-bit Windows application in its own VDM. Using a separate VDM for each application lets you run simultaneous Win16 application threads and provides better application stability by isolating the memory space of each 16-bit application. Running multiple application threads is of particular benefit on multiprocessor machines, which can execute these threads simultaneously. However, memory usage is a major disadvantage of using separate VDMs. Because you're launching a separate VDM (and WOW environment) for each Win16 application, you use more memory than if you run all Win16 applications in one shared VDM and WOW process. Therefore, you want to launch separate VDMs for each Win16 application only if your system has plenty of available RAM.

Another concern with running each Win16 application in its own memory space is that the application can cause interoperability problems for other applications that use shared memory to communicate. Although most applications use methods such as Dynamic Data Exchange (DDE) and Object Linking and Embedding (OLE) to share data, old applications might use shared memory and fail to communicate properly. If you encounter such applications, configure them to run in a shared memory space rather than a separate one.

To make each 16-bit application (including Win16 and DOS applications) run it its own memory space, you must edit the shortcut that launches the application. Start by right-clicking the application's shortcut icon and choosing Properties from the context menu. Next, select the Run in Separate Memory Space check box. After you make these changes, the application will run in a separate memory space every time you run the application. You can accomplish the same goal for dynamic executions of an application by selecting the Run in Separate Memory Space check box in the Start menu's Run window, as Screen 2 shows, or by entering the following command-line option:

start /separate <application filename>

Alternatively, you can run a Win16 application in a shared memory space with other Win16 applications by typing

start /shared <application filename>

Always configure crash-prone applications or those requiring maximum stability to run in separate memory space. If you avoid sharing memory address space (which errant applications in the same shared environment can violate) and system resource pools (memory heaps) with other Win16 applications, the application will be less likely to experience problems. You might want to create two shortcuts for each of your 16-bit applications: one to run the application in a separate memory space and another to run the application in a shared memory space.

Configuring WOW to Use Separate Memory Spaces by Default
Configuring Win16 applications on a case-by-case basis using shortcuts or command-line entries is useful only if you want to run some of your applications in separate memory spaces. To run all your Win16 applications in separate memory spaces all the time, you can edit the Registry so that your system defaults to using a separate memory space for each Win16 application. To enable this behavior, use a Registry editor (e.g., regedt32) to set the DefaultSeparateVDM value to yes in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WOW. DefaultSeparateVDM specifies whether each Win16 application runs its own instance of ntvdm.exe and wowexec.exe in its own memory space. Setting the value to yes ensures that all future Win16 applications start with a separate memory space by default. Screen 3 shows this value in the Registry.

Other WOW-related Registry Entries
In addition to setting the DefaultSeparateVDM value, you can use the Registry to configure other aspects of the WOW application environment. Some values, such as the size of the WOW environment (for RISC machines) or the command-line options, are in the same WOW subkey as the DefaultSeparateVDM value. Other values are in different subkeys in the SOFTWARE hive.

To change the size of the WOW environment, locate the wowsize value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WOW. This setting applies to only RISC-based systems. Intel-based systems ignore this setting because NT provides all memory on Intel systems on an as-needed basis. This value (ranging from 0MB to 16MB) sets the size of the WOW environment, and NT determines the default value according to the system configuration. Because of the overhead associated with the WOW VDM, for each megabyte that you specify in this setting, NT allocates 1.25MB of memory. Therefore, a wowsize value of 4MB uses 5MB of memory, even though applications can access only 4MB.

Table 1 shows the recommended WOW VDM sizes for various systems according to the amount of installed memory. You can use this table as a guide for selecting the wowsize value for your RISC-based NT machine. Most applications will fail if you set the wowsize value to less than 3MB. Therefore, always set this value to at least 3MB, and set it higher if possible.

Most NT RISC system users don't have to worry about the wowsize value because most RISC-based computers have at least 32MB of memory. A large wowsize value will cause problems only when memory resources are limited and little or no memory is available for other applications or the system. Also, remember that the WOW VDM continues to run even after the Win16 application that invoked it has terminated.

Another Registry value in the WOW subkey that you can set for the WOW subsystem is wowcmdline. Only the WOW VDMs (those processes that Win16 applications invoke) use this value, which specifies the command-line parameters that NT issues when you invoke a 16-bit Windows application. You specify the path to ntvdm.exe and any of the following optional switches: -a, which specifies a command to pass to the VDM; -f, which specifies the directory to find ntvdm.exe; -m, which hides the VDM console window; or -w, which specifies the WOW VDM. The default value is %SystemRoot%\system32\ntvdm.exe -a%SystemRoot%\system32\krnl386.

You can find other WOW-related Registry entries at HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Windows NT\CurrentVersion\WOW. This Registry location references the Windows 3.x system.ini file. The values in the subkeys at this location are the same items you might find under the corresponding system.ini headings (NT maintains these settings for backward compatibility with Win16 applications).

That's All the WOW for Now
Although computer users running applications in a 32-bit environment often overlook the WOW subsystem, it is still an important part of NT for 16-bit Windows applications users. By following the tips outlined in this article, you can gain control over WOW's behavior and optimize the subsystem's configuration for your machine and application environment.

End of Article

   Previous  1  [2]  Next  


Reader Comments
Clear, insightful and concise. Article was a real help; I was just getting suspicious about the name of WOWEXEC.EXE and its behaviour.

Rob October 16, 2003


I would be interested in WOWEXEC errors - ie how to diagnose and rectify a problem where a WOWEXEC operation error on a WindowsNT machine when it is left alone for a couple of minutes.

John Armagh October 20, 2003


yes, i have a problem with my wowexec.exe....everytime i try and run a 16 bit application...the wowexec.exe opens up in the taskmanager and hangs there....and the program never opens...i have to kill it manually if i want it to go away...i was wondering if anyone knew anything about this...i have researched it..and i do not have a corrupt wowexec.exe file....and it seems other people have this problem too sometimes

drew December 31, 2003


I deleted my wowexec.exe after a virus corrupted it, or I got a virus called wowexec. Anyway, now I cant run a bunch of programs so how can I get it back?
Thanks.

brad February 21, 2004


have anyone had any problems with 16-bit applications that seam to eat a steady percentage of the processor? I have an application that runs great in windows 98 but in 2000 it pins the processor at about 50%. if i run multiple instences of the application, i can run about 5 and they will all take a steady 20%. Any suggestions on how i can resolve this? thanks

joe March 30, 2004


clear, insightful, consise, helpful .. couldn't agree with Rob more

Jay April 09, 2004


Would anyone have ANY idea why, when I run Cakewalk 3.01 MIDI sequencing software on a Sony
laptop w/ WinXP (2.4G Celeron), my CPU usage jumps to 100% and stays there??!!

Is it something to do with that "wowexec.exe" and "ntvdm.exe" that I see in the Processes tag in Task manager?

I didn't actually "install" Cakewalk, I just copied the CPWPro folder from another computer into C drive - I've been using it
this way in W95 and W96SE for years.

BTW, the reason I use CWPro 3.01 is that I can run multiple instances at the same time - good if you in a MIDI'd duo that
does dance gigs, where there can't be any lags between songs.

Thanks to anyone who can help!

J Nilsen April 19, 2004


my wowexec.exe has a space in front of it....is this the way it should be or is this virus related????

Michael May 15, 2004


I also have an application that works perfect in win98, and in winxp just hangs.... It completely freezes for a while, and then comes back to life. Anyone know how to solve this?

João Costa June 01, 2004


www.tamedos.com
You can use this program to control CPU usage of 16 bit apps running under NT based OS

Kevin June 03, 2004


 See More Comments  1   2 

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

Windows Mobile: What Went Wrong?

Paul discusses the evolution of Windows Mobile and why he thinks the platform is probably doomed. ...

Microsoft Makes Windows 7 Name Official

It's official: Microsoft's next Windows version, currently being developed under the codename Windows 7 will use that moniker as its official final name when it hits the market in early 2010. The news, delivered as is so often the case these days via a ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Are You Satisfied?

A Preliminary Look at Deployment Plans for Microsoft Windows Vista

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

Microsoft Exchange & Windows Connections event returns to Las Vegas Nov 10 - 13
Connections returns to Las Vegas for this exciting event where each attendee will receive SQL Server 2008 standard with 1 CAL. Co-located with Microsoft ASP.NET, SQL Server, and SharePoint Connections with over 250 in-depth sessions.

Free Online Event! Virtualization:Get the Facts!
Register now and attend this free, live in-depth online conference on November 13 and 20, 2008, produced by Windows IT Pro. All registrants are eligible to receive a complimentary one-year digital subscription to Windows IT Pro (a $49.95 value)!

Check Out Hyper-V Video on ITTV
Watch Karen Forster's interview on Hyper-V's performance on ITTV.net.

Ease Your Scripting Pains with the Flexibility of PowerShell!
Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer!

PASS Community Summit 2008 in Seattle on Nov 18-21
The don’t-miss event for Microsoft SQL Server Professionals. Register now and you’ll enjoy top-notch Microsoft and Community speakers and more.



Order Your SQL Fundamentals CD Today!
Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.

Email Recovery and eDiscovery for Microsoft Exchange!
Discover, Recover, and Export mailboxes, folders and individual items direct from offline EDB’s or online production Exchange Servers. Free 30 Day Demo.
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing