Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
IPC::Sharable ... curious ipcs -a resultsby andyok (Novice) |
on May 27, 2021 at 16:05 UTC ( [id://11133147]=perlquestion: print w/replies, xml ) | Need Help?? |
andyok has asked for the wisdom of the Perl Monks concerning the following question:
Consider the following:
Before executing the above, I do an ipcs -a It tells me that there are no Semaphore Arrays and only a handful of shared-memory segments. I invoke the perl-debugger and execute the above code (including the tie). ftok() gives me 0x01003A83 I now do another ipcs -a ... and now I see: Shared-memory-segment with key 0x01003A83 and size 65536 bytes Semaphore-array with the same key and 3 semaphores Question-1: is it normal that a semaphore is created when a shared-memory-segment is set up? In the debugger, I now do $Sess{abc} = 1 There is no change to what is reported by ipcs -a However, if I do now $Sess{a}{b}{c}{d}{e} = 1 I now find 4 more 65536 shared-memory-segments created and a load of corresponding semaphores. Question-2:Does that seem reasonable? It just seems very curious that the originally created shared-memory segment doesn't simply grow as the data-structure %Sess gets populated And the %Sess isn't heavily populated, yet I now have five 65536-byte segments, each with it's own semaphore ... very curious?
Back to
Seekers of Perl Wisdom
|
|