linux - When running a program in parallel on multiple processors in shared-memory space, does each processor have it's own .TEXT segment? -


this user asked why 2 linux processes of same file not share same text segment, responder replied modern operating systems sandbox programs default , shared libraries entities not duplicated os (not including storage memory).

while researching earlier, however, found(1) other(2) questions(3) talked how operating system trying balance optimization process-memory protection, , through combination of virtual memory addressing , page table lookups, optimizations copy-on-write, 2 programs could sharing same .text segment, although wouldn't aware of it. correct in saying this?

excerpt: real thing text section shared mapping different virtual pages same physical pages (called frames).

the reason ask because we're working on molecular dynamics simulator runs in shared memory-model , we're trying determine whether there 1 processor tasked burden of holding program code, or if every processor requires own local copy. (there 6,000 processors.)

the thing confuses me openmp memory model "shared", each thread has "private access each variable" (slide 5/19), sounds lot shared library [so/dll] model, , i'm wondering if that's how shared resources operate in general.

additional source - question asking shared memory, in terms of whether specific location processes have access to. in diagram, want know whether 3 text segments can simplified 1 text segment , n-pointers, essentially.

it looks misunderstanding here, partially becasue of dirrerent usage of "shared" term. i.e., sharing of text segment doesn't have in common openmp memory model.

speaking on techical side, it's easy @ state of text page sharing under linux. there useful /proc//smaps files, each mapping linux kernel reports size in shared_clean state (see man 5 proc more details).

for example, when run single less /proc/self/smaps 1st mapping see

shared_clean: 0 kb private_clean: 108 kb

but after running 2nd less /proc/self/smaps in terminal @ same machine got

shared_clean: 108 kb private_clean: 0 kb

so, see code /usr/bin/less shared between different processes.

to me, answer "sandboxes" 1st reference not valid. can see sharing here. can try yor particular workload , see occurs real codes.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -