Loading ...
Sorry, an error occurred while loading the content.
 

RE: [blug-prog] doubt on worker-threads.

Expand Messages
  • kirtim@mahindrabt.com
    Rajendra, Why u want to make array as a TSD ? I can not find any reason to make as thread specific. I will suggest u to keep it in a main thread and pass the
    Message 1 of 3 , Oct 29, 2002
      Rajendra,
      Why u want to make array as a TSD ? I can not find any reason to make as
      thread specific. I will suggest u to keep it in a main thread and pass the
      sockid as a parameter to thread.

      see the pseudocode will be loke this

      Receive()
      {
      while(1)
      {
      if( fd = receive())
      {
      pthread_create(thread_fn ,fd,...)
      }
      }
      }

      thread_fn(fd)
      {
      process()
      send(fd);
      }

      I have multiple initiator nodes which connects to a receiver node,
      which is running on a single thread.
      Each time a new connection arrives , i store the newsockfds into an
      array, so that as soon the msgs which arrive over these connections
      are handed over to the worker threads & after processing use the
      respective newsockfds to send the response.
      Also , since i m using worker-threads which use the same function,
      can i make it thread-specific, so that they remain local to each
      thread.
      Any problems with this approach , if so can you suggest me better
      ones.

      Rajendra S.


      ---------------------------------------------------------------
      This is the programming list of the Bangalore Linux Users Group
      ---------------------------------------------------------------
      Go to http://linux-bangalore.org for more information
      about us, as well as our other mailing lists

      Before you post to this list, please read
      http://linux-bangalore.org/articles/smart-questions.php


      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

      *********************************************************
      Disclaimer

      This message (including any attachments) contains
      confidential information intended for a specific
      individual and purpose, and is protected by law.
      If you are not the intended recipient, you should
      delete this message and are hereby notified that
      any disclosure, copying, or distribution of this
      message, or the taking of any action based on it,
      is strictly prohibited.

      *********************************************************
      Visit us at http://www.mahindrabt.com
    • rstalekar
      Kirti, Well, infact what i wanted to do was pump this sockfds(part of the structure) into a queue(array of structure), so that the other- threads would start
      Message 2 of 3 , Oct 29, 2002
        Kirti,
        Well, infact what i wanted to do was pump this sockfds(part of the
        structure) into a queue(array of structure), so that the other-
        threads would start processing the message & then can send it to the
        respective sockfds.
        This main thread would just post the messages along with sockfds into
        the queue. Other worker-threads which would be used by some other
        module to process those messsages.
        Well i understand we need not make it thread-specific.
        Do suggest if u feel what i thought was wrong.

        Thanks,
        Rajendra S.

        --- In linux-bangalore-programming@y..., kirtim@m... wrote:
        > Rajendra,
        > Why u want to make array as a TSD ? I can not find any reason to
        make as
        > thread specific. I will suggest u to keep it in a main thread and
        pass the
        > sockid as a parameter to thread.
        >
        > see the pseudocode will be loke this
        >
        > Receive()
        > {
        > while(1)
        > {
        > if( fd = receive())
        > {
        > pthread_create(thread_fn ,fd,...)
        > }
        > }
        > }
        >
        > thread_fn(fd)
        > {
        > process()
        > send(fd);
        > }
        >
        > I have multiple initiator nodes which connects to a receiver node,
        > which is running on a single thread.
        > Each time a new connection arrives , i store the newsockfds into an
        > array, so that as soon the msgs which arrive over these connections
        > are handed over to the worker threads & after processing use the
        > respective newsockfds to send the response.
        > Also , since i m using worker-threads which use the same function,
        > can i make it thread-specific, so that they remain local to each
        > thread.
        > Any problems with this approach , if so can you suggest me better
        > ones.
        >
        > Rajendra S.
        >
        >
        > ---------------------------------------------------------------
        > This is the programming list of the Bangalore Linux Users Group
        > ---------------------------------------------------------------
        > Go to http://linux-bangalore.org for more information
        > about us, as well as our other mailing lists
        >
        > Before you post to this list, please read
        > http://linux-bangalore.org/articles/smart-questions.php
        >
        >
        > Your use of Yahoo! Groups is subject to
        http://docs.yahoo.com/info/terms/
        >
        > *********************************************************
        > Disclaimer
        >
        > This message (including any attachments) contains
        > confidential information intended for a specific
        > individual and purpose, and is protected by law.
        > If you are not the intended recipient, you should
        > delete this message and are hereby notified that
        > any disclosure, copying, or distribution of this
        > message, or the taking of any action based on it,
        > is strictly prohibited.
        >
        > *********************************************************
        > Visit us at http://www.mahindrabt.com
      • ajay soni
        Hi All, Does any body know that how does sock- sndbuf (Socket.c) varies when we send a packet using TCP. SONi
        Message 3 of 3 , Oct 31, 2002
          Hi All,

          Does any body know that how does

          sock->sndbuf (Socket.c) varies when we send a packet

          using TCP.

          SONi

          ________________________________________________________________________
          Missed your favourite TV serial last night? Try the new, Yahoo! TV.
          visit http://in.tv.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.