Skip to contentSkip to conversation

Kernel read/write Blocksize

DISCUSSION Neal Morrison 2 participants 4 messages Dec 7, 2006

lore
Share & tools
lore
#0 lore raw

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?

Signature · 1 line
Regards Neal
#1 lore raw
Quoted 5 lines · Neal Morrison

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.

Quoted 1 line

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().

Quoted 2 lines

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.

Signature · 1 line
Glynn Clements <[email protected]>
#2 lore raw
Quoted 10 lines · On Thu, 7 Dec 2006 10:31:47 +0000 Glynn Clements <[email protected]>…
Quoted 5 lines · Neal Morrison

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.

Quoted 4 lines
Quoted 1 line

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.

Signature · 3 lines
Regards Neal

P.S. Please excuse of my bad english.
#3 lore raw
Quoted 4 lines · Neal Morrison
Quoted 3 lines
Quoted 1 line

So my question is: Is the stacksize simular to the read/write size?

What do you mean by "read/write size"?

Quoted 8 lines

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).

Signature · 1 line
Glynn Clements <[email protected]>