Go to file
2022-10-02 22:26:07 +07:00
bin Separate modes of tcp handlers 2022-10-02 22:26:07 +07:00
src Separate modes of tcp handlers 2022-10-02 22:26:07 +07:00
.gitignore Add gitignore 2022-09-23 00:06:51 +07:00
README.md Separate modes of tcp handlers 2022-10-02 22:26:07 +07:00

Kernel Queue (kqueue) Utilization

This is your lame attempt to understand how those Network Virtual Functions sofware works as well to sharpen your understanding on C++ and C programming language.

Why not epoll or select

Using epoll or select would make your system spend most of its time looking at and fiddling sith the data structures and has very little time for anything else.

Notes

  • Compile using g++ for the file watcher

To trace the function calls on FreeBSD based system use truss() instead of strace.

The kqueue_socket.c is my attempt on create a socket watcher timer program using kevent.

    // --------------------------------------------
    struct kevent my_event;
    struct kevent my_change;

    EV_SET(&my_change, ...); // Initialize the kevent

    for(;;){

        ...;
    }

TCP 01

  • Pointer of kevent

TCP 02

  • Array of kevent

Goal

  • Understand the difference between c++ and C
  • Understand how strcuct works and the difference between it on c++ and C
  • Understand

Issues

  • Modification to target file only detected after 2 or more interrupt