Hi all,

I've been working with C semaphores for a while using shared memory (ftok, semget, semop, semctl) and it works perfectly. However, I was wondering wether using these structures all processes are protected against starvation.

I have made several tests with nearly 200 processes sharing a binary semaphore and I see that every one enters in the critical section but not the same times.

Does anbody know if the OS makes something to guaranty the freedom against starvation?

Thanks!

I don't know, I use a red hat based distribution with kernel 2.6.9. I don't expect semaphores to change behaviour betwen distributions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.