It's not really a matter of whether it's Windows XP or Windows 7 that you can only recognize less than 4 GB if you have more installed, it's a matter of if it is a 64-bit version of that operating system or not. More than 99% of the Windows XP systems out there are 32-bit meaning no more than around 3 GB of RAM while a great number of Windows 7 systems are 64-bit so they can recognize more.
Generally if there is a reason to suspect that a stick of RAM might be faulty, I will run a scan or two of Memtest 86+. You can download a free ISO online which you can burn as a bootable CD and just let it run its check. However, sometimes Memtest can be tricky and won't detect a RAM error unless you test one stick at a time in the primary DIMM (usually DIMM 1A)
If you can boot into BIOS, I would recommend checking to see how much RAM is visible in the BIOS. It would also help to know which operating system you are using, as well as if you have a dedicated graphics card or if it is integrated. If your system was registering and showing in the system properties that you had 4 GB of fully usable and a stick of memory either became unseated or completely died, then you should be getting a message that you only have 2 GB of usable RAM since you have 2 sticks of 2 GB ea. If it's showing that 3 GB of RAM is usable then it could be that an update installed for a driver or Windows which modified it to hide some of the RAM that is automatically allocated for the system such as RAM used for an integrated graphics card.