Skip to content

Producer - Consumer simulation using unix mutex synchronisation on cyclic array

Notifications You must be signed in to change notification settings

jkordas/producer-consumer-mutex-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It is a simple program written in C to demonstrate how to use mutex synchronisation in unix systems. It consists of Producer and Consumer processes.

Producer tries to put new value into cyclic array if there is an empty space inside. Consumer tries to get value from array if there is one and leave empty space.

Compile:

gcc -pthread main.c -o main

Run:

./main 10 400 600

Arguments:

1. Buffer Size
2. Producer Max Sleep [ms]
3. Consumer Max Sleep [ms]

Examples:

screen1

screen2

Read more about mutex mechanisms in unix systems.

About

Producer - Consumer simulation using unix mutex synchronisation on cyclic array

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published