Showing posts with label virtual memory. Show all posts
Showing posts with label virtual memory. Show all posts

Wednesday, September 14, 2011

Difference between 32-bit and 64-bit Windows OS


The industrial software application, running the operation for the complicated piece of equipment, I support on a daily basis, Optical Surface Analyzer, is based on the Windows XP 32-bit Operating System. The application is extremely memory consuming, requiring saving huge amounts of data in one process and guaranteeing smooth operation of the automatic robotic laser-based tool. Sufficient memory is essential for that, but developers reached the limit of the memory limitations of the Windows for a single process (which is 2 GB), and even sophisticated manual rebase of the drivers to free the virtual memory interval does not help. Customers are curious how this limit can be pushed forward to expand the tool capabilities. Multiple tests proved that no logical steps in the current framework, like increasing RAM or managing better the virtual memory, can help.

But, there is solution – transition to the 64-bit Windows OS. What is absolute necessity for the industrial professional applications, might not be so critical for the computer home users, unless you also use the heavy memory consuming programs, like games, graphic utilities, or video editing applications. In any case, Windows 64-bit slowly but steadily makes it way to the consumer market.

Image and video hosting by TinyPic

So, let’s review what the difference is, and how you can benefit from using this next generation OS in in brief questions and answers session:

  1. What is the difference between 32-bit and 64-bit versions of Windows?
The terms 32-bit and 64-bit refer to the way a computer's processor (also called a CPU), handles information. The 64-bit version of Windows handles large amounts of random access memory (RAM) more effectively than a 32-bit system.

  1. How can be the difference explained a simple way?
Think of your computer as a series of tubes that can either be 32 or 64 bits wide. When you have the smaller 32-bit size, there is more potential for bottlenecks to occur. Bottlenecks slow down your system because one process has to wait for another to finish before it can begin. But if you want to have 64-bit wide tubes, your computer needs to be thinking in 64-bit so your software and hardware all need to support 64-bit.

  1. What is the difference in terms of the memory management?
On a 32-bit operating system, you are restricted to a maximum of 4 gigabytes of RAM. On a 64-bit operating system, you really do not have a limit. Normally when you exhaust your physical RAM on a 32-bit system, it has to use virtual memory or hard disk space to pick up the slack. On a 64-bit system, you can install as much RAM as you can to cover your overhead.

  1. What are the main advantages of the 64-bit Windows?

        More RAM. 64-bit versions are theoretically capable of supporting a little over 17 billion GBs of RAM due to the spacious register system. Realistically, Windows 7 64-bit Home editions are limited (because of licensing issues, not physical limitations) to 16GB of RAM and the Professional and Ultimate editions can be extended up to 192GB of RAM.
        Increased efficiency. Not only can you install more RAM in your system (as much as your motherboard can support) you will also use your installed RAM with greater efficiency. Because of the nature of the 64-bit address system in the register and how Windows 64-bit allocates memory you’ll see less of your system memory consumed by secondary systems (like your video card).
        Virtual memory allocation. Your computer will be able to allocate significantly more virtual memory per process. Under 32-bit architecture Windows is limited to assigning 2GB of memory to an application. Modern games, video and photo editing applications, and other memory consuming applications like virtual machines, need a lot of memory each. Under 64-bit systems they can have theoretically up to 8TB of virtual memory. On top of the more efficient use and allocation of memory, applications optimized for 64-bit operating systems, such as Photoshop and Virtualbox, are super fast and take full advantage of the spaciousness of the processor and memory afforded to them.
        Advanced security features. Windows 64-bit with a modern 64-bit processor enjoys additional protections not available to 32-bit users. These protections include the hardware D.E.P., as well as Kernel Patch Protection that protects you against kernel exploits, and device drivers must be digitally signed which cuts down on the incident of driver-related infections. 

  1. What are the main disadvantages of the 64-bit Windows?
        Need dedicated 64-bit drivers. You may not be able to find 64-bit drivers for older but critical devices on your system. For small things that are easily replaced or need to be upgraded anyway, this isn’t a big deal. For mission critical and expensive hardware it is. You’ll have to decide for yourself if the upgrade cost and tradeoffs are worth it.
        May need a new Motherboard.  You may have a motherboard, which will not support 64-bit processor, or will support an early 64-bit processor but not support more than 4GB of RAM. In this case you’ll still get some of the benefits of a 64-bit processor but you won’t get the benefit that most people crave: access to more memory.
        Old software issues. Some older software, developed for 34-bit, cannot be easily used on 64-bit. Also, unlike previous versions of Windows, Windows 7 64-bit has no support at all for 16-bit applications. If by some chance you’re still using a really old legacy application for something you’ll need to either virtualize it or forgo an upgrade. Also, just because an application itself is 64-bit, it doesn’t mean that all plugins and extensions for it are 64-bit as well.

64-bit Windows looks really good, isn’t it? But that does not mean that you need to scrap or upgrade your existing computer immediately. Frankly, it all depends on what are you using this computer for. For general day-to-day applications, your hardware and software fill your needs perfectly well. However, if you are computer user, suffering from the memory deficiency, there is solution, and this solution is Windows 7 64-bit.

Image and video hosting by TinyPic

Sources and Additional Information:






Saturday, February 7, 2009

Virtual Memory Optimization in Windows Computers

What is Page File?

A key to improving your PC’s performance is the page file (also called the swap file and/or virtual memory). A page file is a cache of data on your hard drive; this cache is used to supplement your computer’s main memory (RAM). When a computer runs out of memory, it uses the page file. Since data access on a hard drive is slow compared to accessing memory, your PC’s performance takes a hit.

What is exactly Virtual Memory?

In a 32-bit computer, the memory addresses are 32 bits long and stored as binary (base 2) numbers. There are approximately 4 billion possible different 32-bit binary numbers (2^32=4,294,967,296). Because of this, there is a 4GB limit for addressable memory in a 32-bit computer.

A program instruction on an Intel 386 or later CPU can address up to 4GB of memory, using its full 32 bits. Each process is assigned an address space of 4GB of virtual memory, regardless of the amount of available physical memory. Each process is isolated from the rest and has its own 4GB address space. This means that the 4GB addressability limit applies on a per-application basis, not across all applications taken together.

This is normally far more than the RAM of the machine. The amount of physical memory on the computer is not related to the amount of memory address space. If a computer has 256MB of physical memory, there is still a 4GB memory address space, and if a computer has 8GB of physical memory, there is still a 4GB memory address space.

Applications are not allowed direct access to physical memory. When an application requests more memory, Windows maps some physical memory (as long as some is available) into the process’s address space.

The hardware provides for programs to operate in terms of as much as they wish of this full 4GB space as Virtual Memory, those parts of the program and data which are currently active being loaded into Physical Random Access Memory (RAM). Windows maintains several tables that keep track of all of this, and the application knows only about the virtual memory address.

The processor itself then translates (‘maps’) the virtual addresses from an instruction into the correct physical equivalents, doing this on the fly as the instruction is executed. The processor manages the mapping in terms of pages of 4KB each - a size that has implications for managing virtual memory by the system.

Why do I need page file optimization?

Optimizing your page file when you’re running low on RAM is always a good idea. When all physical RAM in a computer is in use, Windows starts using the hard disk as if it were additional RAM. This is why we have a Page file (also called the swap file). Because RAM memory is a lot faster than the hard disk, whenever the computer begins to use the Page file to relieve memory pressure, we begin to experience drastic performance degradation.

One of the most effective things you can do to improve performance is ensure that there is enough RAM available to avoid frequent paging (swapping) of memory contents between disk and RAM.

This means that the actual limit on the memory used by all applications is the amount of RAM installed plus the maximum size of the Page file.

How much swap space do you need? That depends the amount of RAM you have and the programs you use. The current algorithm Windows uses to set the default paging file size is:

  • If total physical RAM is less than 2 gigabytes (GB), the paging file is set to 1.5 times the amount of RAM or 2 GB, whichever is smaller.
  • If total physical RAM is equal to or more than 2 GB, the default size is set to 2 GB.
Note that in Default Windows settings the setup amounts of initial and maximum page files are different. It is recommended to make its initial size as big as the maximum size. Although this will cause the Page file to occupy more HD space, we do not want it to start off small, then having to constantly grow on the HD. Writing large files (and the Page file is indeed large) to the HD will cause a lot of disk activity that will cause performance degradation. Also, since the Page file only grows in increments, you will probably cause Page file fragmentation, adding more overhead to the already stressed HD.

Should You Disable Your Page File?

Several experts suggest that you disable the page file to increase performance, by doing away with the page file that means your computer won’t have to access the hard drive. So it should be faster, right? It can be, or it can cause several instability problems for your computer. Many programs won’t even run without a page file enabled. The effect definitely depends on the amount of physical memory available. The 8 GB RAM systems might run just like normal, but when you lower the amount of memory available to 2 GB, system instability will definitely be visible.

Page File configuration

For simplicity of the task, you might follow the Microsoft recommendations listed above for the amount of the Page file settings. However, you can go further and set it according to particular needs of your computer, which require more time and more experience.

Open System Properties, then the Advanced tab and press the Performance Settings button, selecting the Advanced tab, finally pressing the Change button. Select the Drive which XP is installed to and set the Paging file size for selected drive to Custom size, setting the Initial size and Maximum to 1500MB according to the basic recommendations. If you have multiple drives available ensure these are set to No paging file. Click Ok and restart as required for the changes to take effect.

You can stop right here if you do not want to go deeper and you are satisfied with standard settings. Otherwise, you can continue with recommendations below.

After computer reboot press Ctrl + Alt +Delete simultaneously and load the Task Manager, selecting the Performance tab. This tab allows use to monitor peak Virtual Memory use (The Peak value in the Commit Charge (K) section). This window can be minimized and you should then run your most resource intensive Applications in order to see just how Virtual Memory is utilized. Once you’re satisfied with your testing switch back to Task Manager.

image001
The Peak value records maximum Virtual Memory use during the session, in K, e.g. in the image above 324548K. Dividing this amount by 1024 gives you the value in MB - 317MB in this instance. For improved stability this value should be padded, so add at least 50MB to this value, e.g. 317MB should be increased to 400MB. This provides us with a Minimum Page File size to use. If the real demand of virtual memory is different, you can tweak the original settings.

Once more open System Properties, select the Advanced tab and press the Performance Settings button, selecting the Advanced tab, finally pressing the Change button.

image002

A few general points to recall before you do anything;
If you have only 1 Hard Drive, split into multiple partitions, the Page File should be set to the partition XP is installed to, you should not create multiple Page Files for different partitions in this case, i.e. 1 Hard Drive = 1 Page File.

If you have multiple Hard Drives installed it is beneficial to locate the Page File on the Hard Drive XP is not installed to; but only where the other Hard Drive is of a similar or better performance, e.g. if you have a SATA Drive and ATA 100 Drive the Page File should be located on the SATA Drive regardless as it is notably faster.

The Page File should not be located on a mirrored Drive, e.g. RAID array, if possible as fault tolerance/backup is not required and may decrease performance.

How to overcome the 4GB limitation for page file in Windows?

When you set the paging file size in Windows, the documentation states that the largest paging file that you can select is 4,095 megabytes (MB). This limit is imposed by the page mapping that we use on x86 processors. These processors cannot handle more pages per page file. This is the limit set per volume; you can actually create paging files this large on one or more drives if you need a larger paging file. If extra drives or volumes are not available, you can create multiple paging files on a single drive by placing them in separate folders.

To create multiple paging files on one volume to overcome the 4,095-MB limit:
1. On the drive or volume you want to hold the paging files, create folders for the number of paging files you want to create on the volume. For example, C:’Pagefile1, C:’Pagefile2, and C:’Pagefile3.
2. Click Start, Click Run, type regedit in the Open box, and then click OK.
3. In the left pane, locate and click the following registry subkey:
HKEY_LOCAL_MACHINE’System’CurrentControlSet’Control’SessionManager’MemoryManagement
4. Find the Pagingfiles value, and then double-click it to open it.
5. Remove any existing values, and add the following values:
c:’pagefile1’pagefile.sys 3000 4000 c:’pagefile2’pagefile.sys 3000 4000 c:’pagefile3’Pagefile.sys 3000 4000
6. Click OK, and then quit Registry Editor.
7. Restart the computer to cause the changes to take effect.
8. Access the virtual memory settings to check the properties of the paging file. To do this, follow these steps.

Sources and Additional Information:
http://www.petri.co.il/pagefile_optimization.htm
http://support.microsoft.com/kb/237740
http://www.pctipsbox.com/speed-up-windows-by-optimizing-your-page-file/


Related Posts Plugin for WordPress, Blogger...