linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Kernel read/write Blocksize
@ 2006-12-07 10:12 Neal Morrison
  2006-12-07 10:31 ` Glynn Clements
  0 siblings, 1 reply; 4+ messages in thread
From: Neal Morrison @ 2006-12-07 10:12 UTC (permalink / raw)
  To: linux-admin

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel read/write Blocksize
  2006-12-07 10:12 Kernel read/write Blocksize Neal Morrison
@ 2006-12-07 10:31 ` Glynn Clements
  2006-12-07 11:00   ` Neal Morrison
  0 siblings, 1 reply; 4+ messages in thread
From: Glynn Clements @ 2006-12-07 10:31 UTC (permalink / raw)
  To: Neal Morrison; +Cc: linux-admin


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 <glynn@gclements.plus.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel read/write Blocksize
  2006-12-07 10:31 ` Glynn Clements
@ 2006-12-07 11:00   ` Neal Morrison
  2006-12-07 12:21     ` Glynn Clements
  0 siblings, 1 reply; 4+ messages in thread
From: Neal Morrison @ 2006-12-07 11:00 UTC (permalink / raw)
  To: Glynn Clements; +Cc: linux-admin

On Thu, 7 Dec 2006 10:31:47 +0000
Glynn Clements <glynn@gclements.plus.com> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel read/write Blocksize
  2006-12-07 11:00   ` Neal Morrison
@ 2006-12-07 12:21     ` Glynn Clements
  0 siblings, 0 replies; 4+ messages in thread
From: Glynn Clements @ 2006-12-07 12:21 UTC (permalink / raw)
  To: Neal Morrison; +Cc: linux-admin


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 <glynn@gclements.plus.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-07 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07 10:12 Kernel read/write Blocksize Neal Morrison
2006-12-07 10:31 ` Glynn Clements
2006-12-07 11:00   ` Neal Morrison
2006-12-07 12:21     ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).