Consumer-producer Application

Discussion in 'Computing and Networks' started by Ashish Vara, Aug 24, 2016.

  1. Ashish Vara

    Thread Starter New Member

    Dec 3, 2015
    Hello folk,

    I hope you are well.

    Consumer-producer problem is example of multi process or thread synchronization. I know what is it and how to implement it but could any one tell me about what are the basic applications and use of consumer-producer model? For what purpose we have to think about it to implement in our application?

    Note: My query is related to Linux system programming

    Any response would be appreciated.

    Thank you.
    Ashish Vara
  2. ci139


    Jul 11, 2016
    unlike you i never heard about this model (maybe)
    what i guess it's about is the typical situation where not IT aware consumer (live chk if i'm about the correct case = false)
    . . . so (instead) it's a case with the busy wholesale store - you can't sell wrong amounts or nothing - you don't want to have profit loss due the goods taking up storage space - not being sold - if there's a demand for - and even less where there is no demand for

    it extends to a more general event timing . . . ??? . . . where the cause of the events to be registered occur - in multiple locations - before they're registered in/by a conrtol system and is perhaps relevant to time-line/-tag about when it occurred and make relations by latter ASAP - - - keeping in mind the system purpose e.g. that to keep your balance you don't have to fetch back goods from customers whom they were provided incorrectly by delayed later received and timed events e.c.
  3. Papabravo


    Feb 24, 2006
    It comes up in control networks all the time. Each node in a network is both a producer and consumer of messages. For a server, each consumption of a message results in a series of actions including the production of one or more messages. For a client each production of a message results in the consumption of one or more replies from the attached servers.
  4. MrSoftware

    Senior Member

    Oct 29, 2013
    Producer/consumer is all over the place. Could be a web server producing web pages that are consumed by one or more browsers. In an operating system specifically, you could have one or more applications producing log information that is sent to the log server process(s), where it is "consumed". The log process then becomes the producer by packaging the log data and sending it to the file system driver (consumer) which writes it to hard disk. If you're talking about a single process, then the producer thread may gather data from one or more files or network connections, while another one or more threads (consumers) write the data to a different file or network connection.

    Note that depending on how many consumers and producers there are, implementations without locks or semaphores are possible. For example: