Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Re: Re: Change UID for threads?

by MarkM (Curate)
on Jul 09, 2003 at 18:00 UTC ( #272768=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Change UID for threads?
in thread Change UID for threads?

Threads share memory by using the same virtual memory space. Memory at address 0xDD000000 in one thread is the same memory at address 0xDD000000 in the other thread. If malloc() is executed in one thread, the address can be passed to the other thread, and the other thread can access it as expected.

IPC shared memory segments are a little different. The memory is registered against an identifier, and exists outside of the address space of the other processes. Processes that use the shm*() controls can map the shared memory segment into their virtual memory. IPC shared memory segments are protected, as you say, with user and group permissions.

As for which one to use? This is a hard call. It becomes even harder when you bring Perl into the picture, as Perl threads does not allow you to take full advantage of the fact that memory is shared (memory has to be copied from one thread to another, as opposed to accessed in a synchronized manner). Given that you want to use permissions, and have each execution thread running as a different userid, IPC::Shareable may be your only real option.

Good luck!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://272768]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-08-15 12:13 GMT
Find Nodes?
    Voting Booth?

    No recent polls found