Sharing resources with process or threads