How many bytes there are in one gigbyte.

J

Joe Sulla

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
 
B

BillW50

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

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 isn't 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 can't 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.
 
P

Paul

Joe said:
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

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

"e820 is shorthand to refer to the facility by which the BIOS of
x86-based computer systems reports the memory map to the operating
system or boot loader."

It's 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 doesn't have to be completely dead, while Windows is running.
SMM delivers an interrupt of a high enough level, that Windows can't 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 aren't 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 don't 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
 
J

Joe Sulla

BillW50 said:
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 isn't 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 can't 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.

Thanks, good answer
 
J

Joe Sulla

Paul said:
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

"e820 is shorthand to refer to the facility by which the BIOS of
x86-based computer systems reports the memory map to the operating
system or boot loader."

It's 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 doesn't have to be completely dead, while Windows is running.
SMM delivers an interrupt of a high enough level, that Windows can't 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 aren't 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 don't 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

That is interesting.

I'll 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
 
P

Paul

Joe said:
That is interesting.

I'll 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

The OS can't 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" doesn't count. On my machine, there is a 16000 microsecond
spike when a 3D game starts, which is not an SMM problem.
It implies that DPCs aren't 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, weren't "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
 
J

Joe Sulla

Paul said:
The OS can't 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" doesn't count. On my machine, there is a 16000 microsecond
spike when a 3D game starts, which is not an SMM problem.
It implies that DPCs aren't 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, weren't "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

Amazing
 
J

JJ

Al Sparber-PVII said:
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 won't feel left out by the
big boys when you go for swimming lessons.

Apparently, your brain capacity doesn't increase as you stuff more
things. Instead, your respect for others was decreased in order to
make space.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top