Skip to content
  • Philippe Gerum's avatar
    copperplate/heapobj: use per-process heap for anon sessions · 14343e9e
    Philippe Gerum authored
    We have different lifetimes for Cobalt-managed POSIX objects such as
    mutexes and condvars, and Cobalt maintains dynamically allocated
    resources for them.
    
    Some POSIX objects are embedded into the session header for protecting
    sysgroups, and serializing allocation ops on the shared
    heap. Therefore, they must survive until the last process detaches
    from the anon session.
    
    Most other POSIX objects stored into the shared heap become virtually
    stale when the application exits and should be reclaimed
    automatically, so that we don't end up leaking kernel resources as
    processes come and go into the anon session.
    
    For the sake of simplicity, Cobalt reclaims shared POSIX objects upon
    exit of their respective creator, assuming that a multi-process
    application requires all involved processes to be present at any time,
    including the one which has initialized the resources.
    
    By using separate, per-process heaps for each instance of the anon
    session, we make sure that all POSIX resources can be reclaimed safely
    by Cobalt for any given session, upon application exit.
    14343e9e