Im taking an operating system course.

i understood the code that solved the consumer - producer problem using semaphores.

but what i didnt understood is where do we use these codes...what kind of processes uses this code ? im so lost... can anybody give me a real example ?

Hey there,

YOu'd uses that code in pretty much any program that need to use memory that's shared with another process. Also multithreaded programs use them to help with cpu scheduling. They can also be used to synchronize processes (processor scheduling).

Basically, if a program doesn't use mutually exclusive (mutex) memory management would use them.

You see it the most in databases and web applications (backend)

Hope that didn't come out sounding crazy :)

, Mike

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.