October 14th, 2013, 11:48 AM
[RESOLVED] Questions about a sample code on shared memory.
I attached a sample code of shared memory that I downloaded from somewhere. However there are few things about it:
1. Producer must be started first, o.w. consumer gives an error: "shm_open: No such file or directory". -- I want to be able to start the processes in any order.
2. If Producer restarts, then Consumer must be restarted as well. -- That's very inconvenient, if my producer goes down then I'd have to restart Consumer as well.
3. Consumer takes 100% of CPU time of one core. -- I think that's because Consumer is polling the buffer, can it be resolved using semaphores?
Someone could comment how to resolve those?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.