Content Deep Dive
The Curious Case of Thread Group Identifiers
Blog post from SingleStore
Post Details
Company
Date Published
Author
Rodrigo Gomes
Word Count
632
Language
English
Hacker News Points
-
Summary
At SingleStore, developers were trying to solve a problem with obtaining the thread group identifier (`tgid`) using the `SYS_tgkill` Linux system call. They initially used a simple prototype that read from `/proc/self/status`, but it broke when newer Linux distributions added a new field to this file. The team investigated and discovered that the `tgid` was actually the same as the process ID (`pid`). By using the `getpid` system call directly, they were able to stabilize the tool and simplify the code, making it work on all environments tested.