Kernel read/write Blocksize
Kernel read/write Blocksize
am 07.12.2006 11:12:47 von Neal Morrison
Hello everybody,
some of my colleagues told me that the internel Buffsize ist 4k.
Yesterday I saw in the Kernelconfigurations that the default value for
the stacksize is 8k and you can set it to 4k.
Kernel hacking -> Use 4Kb for kernel stacks instead of 8Kb
So my question is: Is the stacksize simular to the read/write size?
And what ist the best read/write size when I build my
own networkingprogramms?
--
Regards Neal
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Kernel read/write Blocksize
am 07.12.2006 11:31:47 von Glynn Clements
Neal Morrison wrote:
> some of my colleagues told me that the internel Buffsize ist 4k.
> Yesterday I saw in the Kernelconfigurations that the default value for
> the stacksize is 8k and you can set it to 4k.
>
> Kernel hacking -> Use 4Kb for kernel stacks instead of 8Kb
Note that this is for the kernel stack, not the user-space stack.
> So my question is: Is the stacksize simular to the read/write size?
What do you mean by "read/write size"?
Various operations either require or will be more efficient when
dealing with sizes which are multiples of some block size. Different
operations may involve different block sizes; e.g. the RAM page size
isn't necessarily the same as the disk block size, so operations which
involve copying data between disk and RAM should ideally use values
which are a multiple of both (i.e. a multiple of the larger of the
two).
Also, the RAM page size may vary between CPU architectures, while the
disk block size may vary between different filesystem types or even
between different partitions using the same type of filesystem.
Any relevant sizes can normally be obtained either via a standard
macro, or from sysconf() or [f]pathconf().
> And what ist the best read/write size when I build my
> own networkingprogramms?
Networking doesn't operate in blocks, so it doesn't really matter.
--
Glynn Clements
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Kernel read/write Blocksize
am 07.12.2006 12:00:19 von Neal Morrison
On Thu, 7 Dec 2006 10:31:47 +0000
Glynn Clements wrote:
>
> Neal Morrison wrote:
>
> > some of my colleagues told me that the internel Buffsize ist 4k.
> > Yesterday I saw in the Kernelconfigurations that the default value for
> > the stacksize is 8k and you can set it to 4k.
> >
> > Kernel hacking -> Use 4Kb for kernel stacks instead of 8Kb
>
> Note that this is for the kernel stack, not the user-space stack.
Ok, thank you for this clearing.
> > So my question is: Is the stacksize simular to the read/write size?
>
> What do you mean by "read/write size"?
>
For example. I have to write an Server in C. And now I want to figure
out which is the best blocksize, relative to the kernel, I should read
from the socket. Is it easier for the kernel, when I read 4k blocks
from the networkbuffer or doesn't matter?
I want to write the serverprogramm in relative to have the best
performance, so I think that is fundamental to know something about the
internel copy prozessing of the kernel.
--
Regards Neal
P.S. Please excuse of my bad english.
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Kernel read/write Blocksize
am 07.12.2006 13:21:18 von Glynn Clements
Neal Morrison wrote:
> > > So my question is: Is the stacksize simular to the read/write size?
> >
> > What do you mean by "read/write size"?
>
> For example. I have to write an Server in C. And now I want to figure
> out which is the best blocksize, relative to the kernel, I should read
> from the socket. Is it easier for the kernel, when I read 4k blocks
> from the networkbuffer or doesn't matter?
>
> I want to write the serverprogramm in relative to have the best
> performance, so I think that is fundamental to know something about the
> internel copy prozessing of the kernel.
For networking, it doesn't matter.
Block size is more relevant for disk I/O, particularly for memory
mapped I/O (mmap() etc), and to a lesser extent for random access
(lseek() etc).
--
Glynn Clements
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html