SimpleEventBuilder/testing/is_epoll_really_thsafe/readme.md

9 lines
855 B
Markdown
Raw Normal View History

2023-08-27 14:18:17 +00:00
# Is epoll really thread safe?
### Motivation
Scope of this test is simply to verify that TCP communication with epoll doesen't mix data. In particular, it's important to verify that if one big chunk is sent, the TCP protocol doesen't split it into different events for level triggered epoll (ofc it's gonna be splitted due to buf size).
The important thing is that if I send 1MB of data, it doesen't wake up 2 threads listening to the same fd just because TCP split the package (afaik that shouln't happen, but it's always better to verify, since [`epoll()` is fundamentally broken](https://idea.popcount.org/2017-02-20-epoll-is-fundamentally-broken-12/)).
Tested on sending buffer of size 1000 (receiving size 8 2 threads) with simulation re-executed 1000 times -> no reordering. This approach should then be considered safe and used in the project.