Thread: producer-consumer woes

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Unhappy producer-consumer woes [resolved]

    Hi guys and gals,

    I got myself into a bad situation. If I don't finish this producer consumer project by tomorrow there is a chance I won't get my undergrad degree (or I'll have to pay through the nose next fall to retake the class). Let me be clear: this is utterly my fault. I dicked around spring quarter and now I'm frantic.

    It's an involved problem, so I'm willing to pay for help. I don't want it done for me, but I do want to go through it with someone who has experience implementing semaphores and managing shared memory.

    The situation: there are three programs, source, filter, and display. Source produces "messages", places them in a buffer which filter then reads, processes, and puts into a second buffer which is then emptied by display (which displays them). But it's trickier than that because there are really 4 sources, 3 filters, and 3 displays (achieved using fork in each program).

    If I take out the fork() calls and run only one process of each program, it works fine. But putting the fork() calls back in causes a seg fault *only* in the display process, and I cannot for the life of me figure out why (the code is nearly identical to what's going on between source and filter, so why it becomes a problem between filter and display is a mystery). The other two run programs normally until they can't do anything because the buffers aren't getting emptied and they just hang. It's almost there -- there's got to be some little logical step I'm missing.

    (This is just a synopsis. Source code and more details will follow for serious responders.)

    If there is anyone out there who is inclined to help me with this (and there are plenty of reasons not to be so inclined), I'm willing to pay them a standard hourly wage for a mid-level C programmer. (Hope this isn't against any rules.. If it is, sorry for wasting your time.)

    I'll be fielding responses through the night and morning, but my deadline is Friday afternoon PST.

    Cheers,

    shoba
    Last edited by shoba; 06-19-2009 at 01:03 AM. Reason: problem solved

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    You going to pay other programmers to do your work when you get hired after school? Like the night before a big demo when things aren't working right? I'm sure if you just posted your code with where the fault happens people would be more willing to help you.

  3. #3
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by valaris View Post
    You going to pay other programmers to do your work when you get hired after school? Like the night before a big demo when things aren't working right? I'm sure if you just posted your code with where the fault happens people would be more willing to help you.
    not anymore lol
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    2
    False alarm. Got it working.

    And Valaris, I agree -- paying someone else to do your work is not a sustainable strategy (let alone ethical). But if you think I'm NOT going to use any and all resources I have access to in order to solve this problem, you're crazy.

    I don't think asking for help on an involved problem and offering compensation is necessarily a cop out. It is when you don't want to put in the work yourself, but I have been, and for a long time I wasn't making the progress I needed to, so I changed my tactics and decided to solicit some help. That's sound thinking in my book.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. producer / consumer question
    By pheres in forum C++ Programming
    Replies: 8
    Last Post: 08-02-2007, 05:55 PM
  2. pthread producer consumer problem
    By Amit Chikorde in forum C Programming
    Replies: 1
    Last Post: 01-17-2007, 07:39 PM
  3. Consumer program
    By wise_ron in forum C Programming
    Replies: 11
    Last Post: 09-27-2006, 05:21 AM
  4. Consumer - Producer
    By MethodMan in forum C Programming
    Replies: 0
    Last Post: 04-18-2003, 07:14 PM
  5. Producer consumer problem
    By traz in forum C Programming
    Replies: 2
    Last Post: 11-08-2002, 08:04 PM