Check if HyperThreading is Enabled on Your Windows Server

It turns out that our datacentre guys had HyperThreading not turned on in our Oracle Database Server. We’re talking about ~30% improvement in performance with it turned on. Here’s a quick way to check if HyperThreading is enabled in Windows.

It uses the fact that when hyperthreading is enabled, the number of logical processors will be higher than number of cores.

Copy the below code and save it as ht_check.vbs

To run, open a command prompt, cd to the location you have the script saved (or use full path) and call
cscript ht_check.vbs

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set Plist = objWMIService.ExecQuery _
("Select * from Win32_Processor")
For Each prox in Plist
IF prox.NumberOfLogicalProcessors > prox.NumberOfCores THEN
Wscript.Echo "Num of Logical Procs:" + CStr(prox.NumberOfLogicalProcessors)
Wscript.Echo "Num of Cores:" + CStr(prox.NumberOfCores)
Wscript.Echo "Num of Logical Procs:" + CStr(prox.NumberOfLogicalProcessors)
Wscript.Echo "Num of Cores:" + CStr(prox.NumberOfCores)

Why is there a 2 GB memory limit for Java.exe on Windows 32-bit Servers

What is Virtual Address Space?

Data readily accessible to the processor are identified by a memory address, which starts at zero and ranges to a max value depending on the processor. 32-bit processors use memory addresses that are 32 bits wide. The 32-bit wide address allows the processor to address 2^32 bytes of memory, which is exactly 4GB. And this is the 4GB memory limit.


Why is there a 2 GB address space limit?

The address space might contain things other than memory. When a program loads under Windows, it is managed as a process. One of the most important features of a process is its virtual address space, which holds all of the code and data the process will directly access. In the 32-bit versions of Windows, processes are given a default memory limit of two gigabytes. This limit means has the logical addresses that any process touches varying between 0x00000000 and 0x7FFFFFFF (this is the full range of non-negative numbers that can fit in 32 bit). To defend the system against poorly written applications and device drivers, Windows allocates memory for applications from 0x00000000 to 0x7FFFFFFF. It maps the operating system itself in the range 0x80000000 to 0xFFFFFFF; as much as it can, at any rate. This gives user processes two gigabytes of virtual address space, and gives the system two gigabytes of virtual address space.

Is there an option to work-around the 2 GB limit?
On a system with more than two gigabytes of memory, the system can be booted with the /3GB option to expose more than two gigabytes of address space to each process that’s marked with the large-address aware bit in its executable image. User processes receive three gigabytes of space, then, while the system can use a single gigabyte of address space. However, the benefit of using this extra space can be mitigated by the fact that the system has to compress itself into the remaining one gigabyte of address space.



Memory Usage of multiple Java Processes on Windows

When you have multiple java.exe running in your machine, identifying the total memory usage is not a straight forward task – I learned it the hard way.

Here is a excellent article from Oracle Blogs series which explains how to do it

Batch script to Check internet availability and renew adapter(s) if doesn’t exist


My PC is on 24 x 7 x 365 & I am a huge downloader. Of late, my internet connection gets disconnected after a while and I have to ipconfig /release and ipconfig /renew to resume my torrents. I wanted to automate this. So, with a little bit of help from google, I figured this out.

create a file r_r.bat in %systemroot% with the following contents

@echo off
ipconfig /release *Hath*
echo The IP address has been released. Waiting to renew…
echo waiting for a minute
ping xyz.boogvgd.bam -w 5000>NUL
ipconfig /renew *Hath*
echo The IP address has been renewed

Here, replace *Hath* with you connection name. For ex. if you internet connection name is “Local Area Connection 1”, you could use *Local Area* OR *Connection 1* etc.
Now create another file chk_sts.bat in %systemroot% with the following contents.

ping -n 1 > NULL
if errorlevel 1 r_r.bat

Save both the files.

Now go to Start–>Settings–>Control Panel –>Scheduled Tasks –>Add Scheduled Tasks.
Add a new task which will repeat itself every 10 minutes(the timing is upto you) using the chk_sts.bat file as the executable. Voila!!

Incase anyone wants to know the details, leave a comment and i’ll try my best.