Windows 7 - How many bytes there are in one gigbyte.

Asked By Joe Sulla on 31-Jul-12 08:29 PM
This is not a programming question.
I want to know how many bytes there are in one gigbyte.

I have a computer with 1G RAM.
ControlPanel System shows 1G

TotalPhysicalMemory returns the total amount of physical memory for the
computer.
On my machine TotalPhysicalMemory returns 1072689152
But 1024 * 1024 * 1024 = 1073741824
Does the number 1072689152 make any sense for a 1G machine?

Thanks

BACKGROUND INFO

When I run the program below I get 1023MB
Not 1G

Because NumBytes is les than  1024 * 1024 * 1024


Dim NumBytes As ULong = My.Computer.Info.TotalPhysicalMemory
Select Case NumBytes
Case Is < 1024
Return Format(CInt(NumBytes), "###,###,###,###,##0 bytes")
'CInt rounds
Case Is < 1024 * 1024
Return Format(CInt(NumBytes / 1024), "###,###,###,##0 KB")
Case Is < 1024 * 1024 * 1024
Return Format(CInt(NumBytes / 1024 / 1024), "###,###,##0
MB")
Case Else
Return Format(CInt(NumBytes / 1024 / 1024 / 1024), "#,###.00
GB")
End Select


David H. Lipman replied to Joe Sulla on 31-Jul-12 09:26 PM
http://en.wikipedia.org/wiki/Gigabyte



--
Dave
Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk
http://www.pctipp.ch/downloads/dl/35905.asp
BillW50 replied to Joe Sulla on 31-Jul-12 10:18 PM
Hi Joe... that is because our computers use the binary numeral system
and not decimal like we are used to. And one bit can only hold one of
two states, 0 or 1. That is not very useful with just one bit. So
computers use more bits to give more possible states.

1 bit = only 2 states possible
2 bits = only 4 states possible
3 bits = only 8 states possible
4 bits = only 16 states possible
etc.

So it just keeps doubling for every extra bit you add. And when you get
to 1000 possible states, you cannot exactly. But 1024 possible states
works out the closest. And that is the closest we can get to using the
binary system.

And instead of saying 1024, or 1k24, etc, they just call it as 1k or
1000 for short. Anything less than 1000, they usually call it what it
really is. Like 2, 4, 8, 16, 32, 64, 128, 256, and 512. And anything
over 512, they generally start rounding it off.

When you see 1023 instead of 1024, that is ok. Because all zeros is the
one state that is sometimes not counted.

Now as for 1,072,689,152 when you think it should be 1,073,741,824...
yes well some things are not counted. Like the BIOS could grab some RAM,
a video card, or other possibilities. And you think something is wrong
when just over 1MB comes up missing? Nope, not at all. This is perfectly
normal.

--
Bill
Gateway M465e ('06 era) - Thunderbird v12
Centrino Core2 Duo T7400 2.16 GHz - 4GB - Windows 7 SP1
Paul replied to Joe Sulla on 01-Aug-12 02:56 AM
There are reserved areas of memory, not offered to the OS.

I learned a bit about this, some time back, by looking at the source
code from memtest86+ (memtest.org). Try "memsize.c" file for example.
And that leads me to this as a quick reference on the topic.

http://en.wikipedia.org/wiki/E820

x86-based computer systems reports the memory map to the operating
system or boot loader."

it is possible 1MB of memory is reserved for the BIOS. So if you install
1024MB, you get to use 1023MB. And if the motherboard has integrated video,
sometimes the frame buffer allocation is stolen permanently as well, and
then you get even less of your remaining 1023MB. (Some integrated graphics,
have a stolen allocation and a dynamic allocation, and the dynamic allocation
is drawn from system memory while gaming.)

The BIOS does not have to be completely dead, while Windows is running.
SMM delivers an interrupt of a high enough level, that Windows cannot stop it.
It allows SMM to run, say, 30 times a second, stealing time slices from
the OS. It has been used on motherboards, to control the VCore regulator,
and adjust the number of running phases. That sort of kooky stuff.
And at one time, the SMI signal on a motherboard connector (which I think
is also related to SMM mode), allowed things like Asus iPanel to interrupt
the computer and access BIOS code, to support the iPanel display.

http://en.wikipedia.org/wiki/System_Management_Mode

(The "1800" on the iPanel display in this example, is being updated
by BIOS code, via SMI interrupts, rather than the OS. No Windows driver.)

http://ed.toton.org/reviews/asus-ipanel/ipanel3.jpg

You can detect excessively long runtimes in SMM mode, by using the
DPC Latency checker program. Some spikes in DPC Latency are unavoidable
(like when the video card switches into 3D mode as a game starts). But
on occasion, excessive SMM runtime needs to be corrected via a BIOS
update. Gigabyte has designed a few motherboards, where a BIOS update
was needed to fix issues with SMM usage. (People who use their computers
for audio/video recording purposes, may be checking for this kind of
transparent BIOS interference.)

So there are some things "under the hood", that are not part of the OS
as such. And they may need resources.

An Intel datasheet, for one of their chipsets, may have a memory map
in it, with more details about what some of the areas are used for.

You'd be surprised how many things of purely historic interest,
affect your modern computer. A question I do not have an answer for,
is to what extent EFI or UEFI BIOS designs, part ways with that history.
Maybe they still support all the crap buried down there...

Paul
Joe Sulla replied to David H. Lipman on 01-Aug-12 11:55 AM
thanks
Joe Sulla replied to BillW50 on 01-Aug-12 11:58 AM
Thanks, good answer
Joe Sulla replied to Paul on 01-Aug-12 12:09 PM
That is interesting.

I will probably try DPC Latency checker but I wonder how, if it is running in
the OS, it can tell that the BIOS, for example, is grabing cycles. Unless it
uses a realtime clock I would think that the missing cycles would not be
visible to it.

Thanks very much
Paul replied to Joe Sulla on 01-Aug-12 03:02 PM
The OS cannot tell when SMM runs.

But the DPC Latency checker, measures how long it takes
for a deferred procedure call to get serviced. If the service
time increases, that shows as a taller column in the DPC
graph. Consistent "noise" or pattern of tall columns in
DPC Latency checker, is a sign of an SMM problem. The odd
spike when a 3D game starts, which is not an SMM problem.
It implies that DPCs are not getting serviced, for
a fairly long period of time. But at that instant,
the screen is black, as my newly launched 3D game appears as a
replacement for the desktop image. My "normal" DPC service
time is in the low microseconds. A couple of Gigabyte
motherboards, were not "staying in the green area" of the
graph, and needed some BIOS work to fix whatever they had
running for an SMM.

http://img19.imageshack.us/img19/7169/dpclat.gif

http://en.wikipedia.org/wiki/Deferred_Procedure_Call

People running things like audio workstations, care
about this stuff. It would have to be a fairly serious
problem, before a guy like me would notice. I only got
a copy of that utility, to see what all the fuss was about.

Paul
Al Sparber-PVII replied to Joe Sulla on 31-Jul-12 09:10 PM
As to size, I have to say that it is as big as the size of your brain
because if you had a larger brain than you would have been able to work
it out yourself or even used Google to help you.

Now to increase the size of your brain, we have extension programs to
extend the size of your penis.  This might help your brain to a certain
extent because you will not feel left out by the big boys when you go for
swimming lessons.



--

Al Sparber - PVII
http://www.projectseven.com
Dreamweaver Menus | Galleries | Widgets
http://www.projectseven.com/go/hgm
The Ultimate Web 2.0 Carousel
Joe Sulla replied to Paul on 01-Aug-12 06:22 PM
Amazing
JJ replied to Al Sparber-PVII on 04-Aug-12 12:50 AM
Apparently, your brain capacity does not increase as you stuff more
things. Instead, your respect for others was decreased in order to
make space.