Thread Synch AOSV 2020  1.2
LKM for exchanging messages between threads
Thread Syncher

This module for Linux kernel allows threads to subscribe to a group in order to exchange messages and synchronize between each other. In simple terms, the entire subsystem can be divided into the following sub-modules:

  • Messages System: handles the exchanges of messages between threads
    • Delayed messages: allows threads to post messages that will become available once a delay is expired
    • Garbage Collector: routine that periodically free storage memory by deleting delivered messages
  • Synchronization system: allows threads to be descheduled until another thread woke them up.
  • Parameter config system: install a sysfs that allows authorized users to config group’s parameter

For user-level library documentaion see this page.
For kernel-level code documentation see this page.
For benchmarking file options see this page.

Message Subsytem

Messages in a group are delivered to readers in FIFO order. Threads can subscribe to a group’s messages and when they do they become an “active member” of that group.
When a thread reads a message, the module adds its PID to the message’s list of recipients. Later, the garbage collector will traverse the messages FIFO queue and compare the set of message’s recipients with the set of active members: if active members are a subset of a message’s recipients, the message is removed and memory is freed.

Security Features

Each group has a field that describes its owner: an owner is represented by an UID that corresponds to the user that installed the group. By default any threads can edit the group’s parameters both through the “sysfs parameter config system” and by interacting with the group's facilities (via ioctl). To prevent this, it is possible to set the “strict mode” flag of a group: when this flag is active, only the current owner of a group can modify its internal parameters.