[uClinux-dev] Threading and synchronization questions

Mike Frysinger vapier at gentoo.org
Fri Feb 27 22:15:12 EST 2009


On Friday 27 February 2009 20:18:10 Jan Ringoš wrote:
> From: "Lennart Sorensen" <lsorense at csclub.uwaterloo.ca>
>
> > On Fri, Feb 27, 2009 at 05:57:28AM +0100, Jan Ringo? wrote:
> >> Well, I am interested in uClinux only, in this case. I still don't see
> >> the difference. If all the processes live in the same address space
> >> here, and when I create a thread (pthread_create) I see a new duplicate
> >> process through ps command (just as if created by vfork), then what can
> >> it be, that would make pthread_mutex not work?
> >
> > So if you want to write good software, you will pretend that each process
> > has its own memory space and make sure you never try to read an address
> > that your process doesn't own.  If you want to talk to another process,
> > use a unix socket.  If you want everyone to poke at each others memory,
> > why not just build one single giant executable with threads since at
> > least then it is obvious to anyone that looks at the code that that is
> > in fact what you are doing.
>
> Poking at each others memory is not the exactly what I wanted to do :)
>
> Anyway, I am interested in using processes instead of threads, because then
> I would be able to, for specific application of the device, include only
> neccessary executables. I don't like the idea of having one large program
> where many functions may not even be used, and where a crash of one thread
> tears down everything.

then if you want to share memory with processes, you use the shared memory 
functions that were designed for this kind of thing.  `man shm_overview`.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20090227/3b360628/attachment.sig>


More information about the uClinux-dev mailing list