Skip to content

Instantly share code, notes, and snippets.

@games647
Created March 3, 2020 10:06
Show Gist options
  • Save games647/de40f74e06a7fd67ff2208257a0ebc02 to your computer and use it in GitHub Desktop.
Save games647/de40f74e06a7fd67ff2208257a0ebc02 to your computer and use it in GitHub Desktop.
Advanced Networking processing
https://programming.vip/docs/java-non-blocking-io-and-asynchronous-io.html
Differentiation into
Blocking mode IO (Single thread)
-> Often standard
Asychrnous blocking IO
-> many thready only waiting
-> spawn a new thread for every blocking call
Non-blocking IO
-> single-thread can select over multiple connection and get notified on changes
=> Java Selector call
-> worker can process changes
=> worker can be minimal only used for processing
=> less CPU overhead (thread creating + context switch between threads)
=> less memory overhead (holding cpu threads)
=> Java AsynchronousFileChannel / AsynchronousSocketChannel or similar
=> Linux: event system epoll used for networking - POSIX forbids it for files
=> Windows: networking + files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment