bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libpager multi-client support


From: Brent W. Baccala
Subject: Re: libpager multi-client support
Date: Mon, 17 Oct 2016 21:51:41 -1000

Aloha -

I've been thinking more about the data structures involved with the new libpager code, and they're complex enough that I'd like to write them in C++11.  The pagemap has to contain a list of all clients with copies of a page, and a queue of clients waiting to access the page.  To keep the memory footprint under control, the pagemap itself should be an array of pointers to structures that are reused if multiple pages have the same "clientèle", so they also need a usage counter, plus we need to make copies of them (say, when a new client is added), which requires making copies of their constituent lists and queues.  STL containers and shared pointers seem like a good choice.

C linkage allows backward compatible use of the library.

The biggest drawback that I see is that memory usage might get out of hand.  A std::shared_ptr, for example, is four times bigger than a regular pointer.  After reading http://gamedev.stackexchange.com/questions/268 I think it might not be so bad, but I'm not thrilled about it, either.  We're basically paying for code simplicity with memory.

Also, programs like ext2fs would be linked against the standard C++ library, but I don't know if that's really such a problem.

Obviously, introducing C++ into libpager would probably open the door to large scale use of C++ in Hurd.  This might not be such a bad thing.  I suspect that serialization of RPCs could be done with templates, eliminating a lot of the need for MIG.

What do you guys think?

    agape
    brent

reply via email to

[Prev in Thread] Current Thread [Next in Thread]