Giter VIP home page Giter VIP logo

producer_consumer's Introduction

Producers consumers - An advanced and extensive example of the producer and consumer problem.

Table of contents

Build

The code is located in the 'pc' folder, being the file 'IPC.h' the interface entry point to create producers and consumers.

To build the project and the executable shells, go to folder 'build' and type:

  • cmake ..
  • make

Executables

Bin folder

If the build is successful, all the executable targets will be generated in the 'build/bin' subdirectory.

Main shell

The main shell is an executable target to test the producer and consumer code.
To execute the main shell, go to the bin folder and execute './pcshell'.
The shell accepts the following commands:

0: Quits the application.
1: Add a producer.
2: Add a consumer.
3: Remove a producer.
4: Remove a consumer.
5: Remove all producers.
6: Remove all consumers.
7: Add 5 producers.
8: Add 5 consumers.

The code of the shell is located in 'testApps/src/main.cpp'.

Executable test target

This is an executable that implements some integration tests using the C++ Google Test Framework Gtest. The code of the main test application is located in 'testApps/src/test.cpp'.

Valgrind

The implemented tests also use Valgrind client requests to check for memory leaks in each test case. To do so, the number of memory leaks is checked before and after each test case. If the number of memory leaks has increased after the test case, it means the code of the test case added memory leaks.

The source files 'pc/src/valgrind_check.h' and 'pc/src/valgrind_check.cpp' shows how the Valgrind client requests are used. To execute the test target under Valgrind, go to the bin folder and execute the script 'memcheckTests.sh'. Such script makes use of a Valgrind suppression file to get rid of errors generated by the Gtest suite.

producer_consumer's People

Contributors

hebrerillo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.