mtcp-stack / mtcp

mTCP: A Highly Scalable User-level TCP Stack for Multicore Systems
Other
1.98k stars 436 forks source link

About cross-thread context operations #207

Closed wtao0221 closed 6 years ago

wtao0221 commented 6 years ago

Hi,

In mTCP, suppose that I have created some sockets in the context of Thread 0, can I use mtcp_epoll_ctl to change the registered events of these sockets (created in Thread 0) in the context of Thread 1?

ajamshed commented 6 years ago

@wtao0221:

No. Each mTCP context creates its own set of socket descriptors (0 to max_fds) which are non-unique across cores/threads. Passing socket descriptors from one thread context to another will lead to logical bugs, We decided to design our stack in this way to ensure that each thread context follows a run-to-completion model.

wtao0221 commented 6 years ago

@ajamshed

Thanks for the explanation.

wtao0221 commented 5 years ago

Hi, @ajamshed

I have one question about the design choice of mTCP.

Why does mTCP exactly use one physical queue pair (i.e., 1 Tx queue and 1 Rx queue) per core? Does multiple queue pairs benefit in terms of performance?

ajamshed commented 5 years ago

@wtao0221 ,

I have not really done any performance testing when multiple queues are assigned to 1 CPU. I am not sure what kind of performance gains we will get out of this design. Do you see a potential benefit? Please let me know if there is.