This is probably a retarded question, but...how does a program measure cpu/gpu temperatures. I'm assuming there's not a tiny thermometer anywhere on the motherboard.
It gathers the information from the BIOS. The motherboard will have a temperature sensor under the CPU socket. There is another one somewhere else on the board, usually on the chipset. The GPU will have a temp sensor as well.