Re: performance implications of releasing resources and context switches
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Mon, 28 Jul 2008 17:31:15 -0700 (PDT)
On Jul 28, 8:33 am, Ambrose Silk <si...@xxxxxxxxxxxxxx> wrote:
It seems there might be a performance benefit to forgoing the munmap()
and close() calls and letting them be handled by _exit() instead. As I
read the docs, _exit() is a single system call (thus 1 context switch)
which guarantees to remove all mappings, close all open files, etc.
If your process is long-running, you have to clean up as you go along.
Otherwise, you risk tying up or running out of resources. So you can
only do this for resources that you would normally free right at the
end of your execution.
Normally speeding up the end of execution wouldn't have any
significant benefit. The performance you care about is performance
while you have work to do, not after all your work is done.
A typical process might allocate a resource 1,000,000 times in its
life and need to free 995,000 of them while it's running. So at most
there's that .5% that you could let the exit implicitly free. And
that's the .5% that you only free when you're done with what you were
doing anyway, so it's the .5% that has the least impact on
performance.
It's like Federal Express trying to rush their employees home at the
end of their shifts. Sure, it saves a bit of employee time, but it
doesn't get the packages delivered any faster. Longer shifts are a
better solution to cutting the overhead of shift changes.
DS
.
- Follow-Ups:
- Re: performance implications of releasing resources and context switches
- From: Ambrose Silk
- Re: performance implications of releasing resources and context switches
- References:
- performance implications of releasing resources and context switches
- From: Ambrose Silk
- performance implications of releasing resources and context switches
- Prev by Date: Re: File Unique ID
- Next by Date: Re: File Unique ID
- Previous by thread: Re: performance implications of releasing resources and context switches
- Next by thread: Re: performance implications of releasing resources and context switches
- Index(es):
Relevant Pages
|