Question regarding pthreads and sockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi all,

I am working on a client-server simulation using pthreads. The client and
server processes have multiple threads. The main thread creates those using
pthread_create (using default attributes). The server has 3 threads. One of
those 3 threads is a server in turn that listens on a port using blocking
accept(TCP Socket). After request comes it creates another thread that serves
all client requests. The client is also a thread created by initial thread
that connects to the server thread and sends some messages. The messages are
of size around 110 bytes each. After the message is sent the client thread
waits for the acknowledgement from the server thread (using blocking receive)
and then sends the next message.

The problem I am facing is, for around 1000 messages or so the system works
perfectly well. For each of the message the client sends the server threads
sends the correct response. However if the number of messages increase, the
client thread hangs and the server thread (that was serving the request) is
never scheduled back (some other thread is scheduled due to the service thread
being blocked permenantly). My question is, is it related to the pthread
paramters (should I change something in pthread parameters to solve the
problem) or it is the socket parameters that are hampering my program?

Thanks in advance,
Abhijit Vaidya 



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux