#1
  1. My beer is empty....
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    South Africa
    Posts
    73
    Rep Power
    13

    Trouble with thread and buffers


    Hi

    I've got a server receiving data from a serial port and a tcp/ip connection. Both are written as a server with another thread picking the data from them:

    Processing Thread
    | |
    DataCommunication Thread
    + TCP Server
    + TCP Client
    + TCP Client
    + Serial Server
    + Serial Client
    + Serial Client

    Both the serial client and the tcp client has their own FIFO buffers (Currently I use TStringList - suggestions welcome). The Serial server also has a FIFO picking the items from the Serial Client FIFO. Likewise the TCP Server has a FIFO picking the items from the TCP Client FIFO.

    Then the DataCommunication has a FIFO picking the FIFO's of the Serial and TCP Servers.

    I then have another thread picking the data from the DataCommunication thread, and processing it.

    One of these FIFO's doesn't update correctly. I've got seperate counters in each FIFO and they update correctly. The processing thread processes at a rate of 50% of that the data is received. (eg. I receive 1200 records but I process 600 in that period of time). I've checked and the process thread takes the records off the buffer as fast as it is available.

    I'm trying to process about 1200 records per second.

    Any ideas would be appreciated.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Hard to help you out without seeing any code mate.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. My beer is empty....
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    South Africa
    Posts
    73
    Rep Power
    13
    Originally Posted by Scorpions4ever
    Hard to help you out without seeing any code mate.
    I know but I don't know how to give you access to 3000 lines of code...

    It seems that we have found the problem and got it solved.

    One of the threads had a sleep of 1 second, and only took one record out of the buffer at each execute - which got us to transfer 1 record through the system in a second instead of the 1200 we received. This was fixed.

IMN logo majestic logo threadwatch logo seochat tools logo