Skip to main content
27 events
when toggle format what by license comment
Apr 21, 2016 at 12:54 history edited Frank CC BY-SA 3.0
responded to Basile Starynkevitch's revised answer from today.
Apr 19, 2016 at 19:57 vote accept Frank
Apr 19, 2016 at 19:46 answer added Basile Starynkevitch timeline score: 1
Apr 17, 2016 at 16:18 answer added Jules timeline score: 1
Apr 17, 2016 at 7:51 history edited Frank CC BY-SA 3.0
Added Boost excerpt to gnat's great edit
Apr 16, 2016 at 21:57 comment added Frank @Basile Starynkevitch, Thank you for your reply. I have a question about Figure 11.10, Using a mutex to protect a data structure on page 372 in the book "Advanced Programming in the UNIX Environment Second Edition" by W. Richard Stevens and Stephen A. Rago. Figure 11.10 uses malloc(sizeof(struct foo)) to allocate the reference counted object. May one use this example to share a mutex between processes?
Apr 16, 2016 at 16:08 comment added Basile Starynkevitch futexes are practically used only for libc implementors (with the help of some assembler code, probably). So look into GNU libc or MUSL libc.
Apr 16, 2016 at 14:32 comment added Frank @Basile Starynkevitch, Could you point me to a URL with a futex code example? Thank you.
Apr 15, 2016 at 13:40 comment added Frank @gnat, I just removed some sentences. Thank you for the edit.
Apr 15, 2016 at 13:39 history edited Frank CC BY-SA 3.0
removed source code which I did not write
Apr 15, 2016 at 12:58 vote accept Frank
Apr 19, 2016 at 19:57
Apr 15, 2016 at 12:07 answer added ratchet freak timeline score: 2
Apr 15, 2016 at 11:52 comment added Frank @ratchet freak, You are correct , our struct pthread_mutex_t contains a ypedef struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __pthread_list_t; which is a pointer to some allocates structure that needs to change during locking and unlocking. Thank you.
Apr 15, 2016 at 11:43 comment added Frank @Basile Starynkevitch, Thank you for your comments. I just scaned shm_overview(7) and it says "The POSIX shared memory API allows processes to communicate information by sharing a region of memory." If one wishes to share a region of memory , is forking necessary?
Apr 15, 2016 at 11:37 comment added Frank @ratchet freak. Here is our struct pthread_mutex_t, typedef struct { int reserved; int count; uint64_t owner; from scs.stanford.edu/histar/src/uinc/bits/pthreadtypes.h. Could you pleas tell me whether the mmap cast will work with this struct? Thank you int kind; jthread_mutex_t jmu; } pthread_mutex_t; from
Apr 15, 2016 at 11:21 comment added Basile Starynkevitch But if you care about inter-process-communication (between genuine processes, not threads) see also shm_overview(7) and sem_overview(7). You need to care about synchronization issues.
Apr 15, 2016 at 11:18 comment added Basile Starynkevitch See futex(7). Also, your libc (providing pthread_mutex_lock) is free software on Linux, so glance into the source code.
Apr 15, 2016 at 11:13 comment added ratchet freak Can you be sure the pthread_mutex_t doesn't have a pointer to some allocated structure that it needs to change during lock and unlock? If not then this method won't work.
Apr 15, 2016 at 11:05 review Close votes
Apr 21, 2016 at 3:04
Apr 15, 2016 at 11:03 comment added Basile Starynkevitch Perhaps the code in the question is enough, but I still find your entire question a bit unclear....
Apr 15, 2016 at 11:01 comment added Frank @Basile Starynkevitch, May I ask what source code I should add to the original question?
Apr 15, 2016 at 10:54 comment added Basile Starynkevitch I don't exactly know, because I don't have access to all your source code. But that URL is a possible answer to your "Have I confused threads with processes?" question.
Apr 15, 2016 at 10:52 comment added Frank @Basile Starynkevitch, Thank you for the URL. I am reading it right now. How might I apply it to solving my problem?
Apr 15, 2016 at 10:49 comment added Frank There is a very nice article titled Sharing Mutex and Condition Variable Between Processes on April 10 2014 in this URLhttp://www.gonwan.com/page/3/. which forks a child process.
Apr 15, 2016 at 10:49 comment added Basile Starynkevitch Have you read computing.llnl.gov/tutorials/pthreads ?
Apr 15, 2016 at 10:43 history edited gnat CC BY-SA 3.0
spelling, formatting, personal stuff cleanup
Apr 15, 2016 at 10:38 history asked Frank CC BY-SA 3.0