lkml.org 
[lkml]   [2002]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRE: TCP memory pressure question

On Sat, 23 Nov 2002 23:34:15 +0100, Folkert van Heusden wrote:

>What about:

>int WRITE(int handle, char *whereto, int len)
>{
>int cnt=len;
>
>while(len>0)
>{
>int rc;
>
>rc = write(handle, whereto, len);
>
>if (rc == -1)
>{
>if (errno == EINTR)
> {
> /* just try again */
> }
> else if (errno == EAGAIN)
> {
> /* give up time-slice */
> if (sched_yield() == -1)
> {

By yielding your time slice, you prevent yourself from performing any
'read's. So what's going to fix the memory pressure?

There are two cases where this could work:

1) For an application that uses very little TCP memory. By yielding, perhaps
some other process will come along, a more heavy TCP memory user, and fix the
problem.

2) For an application that uses a thread-per-connection architecture. By
yielding, we give other threads a chance to run and hope that they will
relieve the memory pressure.

But for a poll/select loop application that is heavily using TCP memory,
this makes things worse. By stopping our own execution, we delay the time
when we'll do 'read's. So we extend the TCP memory pressure problem for even
longer.

DS


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.172 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site