[Python-ideas] Support parsing stream with `re`
Chris Angelico
rosuav at gmail.com
Tue Oct 9 11:46:31 EDT 2018
On Wed, Oct 10, 2018 at 2:42 AM Stephen J. Turnbull
<turnbull.stephen.fw at u.tsukuba.ac.jp> wrote:
>
> Chris Angelico writes:
> > On Tue, Oct 9, 2018 at 10:05 PM Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> > >
> > > Chris Angelico wrote:
> > > > In contrast, a mmap'd file is memory that you do indeed own.
> > >
> > > Although it's not really accurate to say that it's owned by
> > > a particular process. If two processes mmap the same file,
> > > the physical memory pages holding it appear in the address
> > > spaces of both processes.
>
> Subject to COW, I presume. Probably in units smaller than the whole
> file (per page?)
Both processes are using the virtual memory. Either or both could be
using physical memory. Assuming they haven't written to the pages
(which is the case with executables - the system mmaps the binary into
your memory space as read-only), and assuming that those pages are
backed by physical memory, which process is using that memory?
> > Tell me, which process is responsible for libc being in memory?
> > Other than, like, all of them?
>
> Yes. Why would you want a different answer?
Because that would mean that I have way more *physical* memory in use
than I actually have chips on the motherboard for. Yes, virtual memory
can be over-allocated, but physical memory can't. How do you measure
where your physical memory is being used, if adding up the usage of
all processes exceeds the available resources? It's like trying to
figure out which countries the people of this planet live in, and
saying that there are X billion in China, Y million in Australia, etc,
etc, etc, and then discovering that you're counting people multiple
times if they ever move... which means that there are ten or twenty
billion people on the planet.
ChrisA
More information about the Python-ideas
mailing list