Re: Shared Memory and Semaphores?

If my understanding of your question is correct, it is duplex.

If my understanding of your question is correct, it is duplex. With shared memory, both processes could communicate both ways, not just with one as the reader and one as the writer. Pipes only allow either reading or writing, but you can overcome this by using two pipes (although message queues are a better option).

" semaphore = -2 Yes. Semaphore++ proc b: "Is the resource..." semaphore = -1 Yes. Semaphore++ proc c: "is the resource..." semaphore = 0 No.

(nothing happens) at this point, proc c can queue (depending on your api, this might be a busy loop or it might be a callback, or you might simply spawn a waiting thread & write your own callback) proc a: "im done" semaphore--; proc c will notice that semaphore is available, through something probably similar to what I mentioned previously. The reason I wrote all that out is so I could say, its both. Its like a message queue in that you can have threads waiting on a resource (shared memory controlled by a semaphore) that trigger some action, even an actual system message, when they get the resource.

Or you could just busy-wait until it's done, and that would be like piping.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions