Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2001 12:06:02 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Thierry Herbelot <thierry@herbelot.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: scheduling frequency for threaded applications ?
Message-ID:  <20010319120601.A29888@fw.wintelcom.net>
In-Reply-To: <3AB664FE.32CD18CD@herbelot.com>; from thierry@herbelot.com on Mon, Mar 19, 2001 at 08:58:54PM %2B0100
References:  <3AB66167.7DE93AB2@herbelot.com> <20010319114625.Z29888@fw.wintelcom.net> <3AB664FE.32CD18CD@herbelot.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* Thierry Herbelot <thierry@herbelot.com> [010319 11:59] wrote:
> Alfred Perlstein wrote:
> > 
> > * Thierry Herbelot <thierry@herbelot.com> [010319 11:43] wrote:
> > > Hello,
> > >
> > > I'm developping a network benchmark application ("packet blaster").
> > >
> > > The current version uses many processes, to send and receive packets,
> > > and collate statistics.
> > > when I look at top(1), I see most of the time taken is in the "system"
> > > category. I assume this is due to the many context switches between the
> > > collaborating processes.
> > 
> > You're incorrect.  System means just about any time spent inside the
> > kernel (except interrupts), so basically syscalls count towards this
> > meaning that your application is driving the kernel pretty hard.
> > 
> > This is easy for a team of processes, but nearly impossible with
> > a thread based approach.
> 
> could you please elaborate ? (indeed, if you could also shed some light
> on the first question : how frequently are threads rescheduled ?)

I really have no idea how frequently threads are rescheduled.

the point is this:

In FreeBSD a threaded application has a single process context, meaning
that the kernel schedules all threads as a single entity.  In effect
you limit the parallelness(?) by using threads.

Now if you want kernel threads, then use the linux-threads port, however
you're back to normal process scheduling because afaik linux-threads
(at least when run on FreeBSD) are implemented with processes.

I don't think you understand that the overhead you're seeing is
most likely _not_ because of any scheduler issue, but more likely
because you're asking the kernel to do a signifigant amount of
work for you.

This is about as far as I'm going to go on the issue, basically once
you make your "write()" syscall, you enter into 'system' time because
you're having the kernel do work for you.

The getrusage() manpage might be a good place to look for more
answers.

> PS : the TI-RPC commit was a nice one !

There's still a few kinks to work out, hope to have it fixed within
the next couple of days.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010319120601.A29888>