I wrote a code to pass a 64-bit value from a writer thread to reader threads using a global variable. (not mentioned any locking for the sake of simplicity)
uint64_t g_x;
writer_thread()
{
g_x = new_value;
}
reader_thread()
{
uint64_t curr_value;
curr_value = g_x;
}
Now, I want to separate writer and reader threads into different processes without extra latency, system calls etc?
How can I do this in Linux? Is it possible? How can I get the g_x variable into the address space of both processes?
If I use shmget/shmat, mmap (or etc), can I achieve the same performance?
Thanks in advance.