with mmap(), processes must inherit the mapping from a parent to share memory. is there a way to share memory between processes that don’t share a parent? shmat() seems to be the best solution, but it requires clean up if the processes didn’t detach the memory on exit/die. Domain sockets are close…
What is the maximum number of threads that std::async will create and execute asynchronously?
I have a large number (>>100K) of tasks with very high latency (minutes) and very little resource consumption. Potentially they could all be executed in parallel and I was considering using std::async to generate one future for each task. My question is: what is the maximum number of threads that std::a…
Poco C++ Libraries: “Not found: mysql”
I am using poco-1.7.7 with MySQL. I am building with g++ on Ubuntu. Building, linking and running works fine. However, when a Data Session is created, an exception “Not found: mysql” is thrown: The mysql client is installed and is part of $PATH. Additional information: I am running Ubuntu using Do…
Linux: effect of signal on multiple threads
I don’t think this is a duplicate. I have a very specific question about what happens to other threads when a signal handler is invoked. I have a multithreaded program that plays with hardware. On getting SIGTERM (from a parent process), I want the signal handler to set the state of the hardware to a gi…
Function to search of multiple patterns using grep
I want to make a bash script to use grep to search for lines which have multiple patterns (case-insensitive). I want to create a bash script which I can use as follows: and it should get traslated to: I tried following bash script, but it is not working: The error is: Answer I think you can do a recursive fun…
grep case-insensitively for a string in a text file
I’m writing a Perl script but I don’t get a part of it. There’s a text file with host names, one per line. I need to search a second file with host names (a blacklist) for the hostname read from the first one. To be sage the search should be done case insensitive. My first approach was using…
‘Close window’ button wont work when using tkinter + gobject
My tkinter application runs fine, but to implement dbus functionality I had to use gobject. Got it working and all, except that, running both tkinter’s and gobject’s mainloops makes the “close window” button from the standard window manager (‘x’ button in the window interfa…
Faster solution to compare files in bash
file1: and file2: I need find match file2 in file1 and print whole file1 + second column of file2 So ouptut is: My solution is very slow in bash: I am prefer FASTER any bash or awk solution. Output can be modified, but need keep all the informations (order of column can be different). EDIT: Right now it looks…
Generate raw binary from C code in Linux
I have been implementing just for fun a simple operating system for x86 architecture from scratch. I implemented the assembly code for the bootloader that loads the kernel from disk and enters in 32-bit mode. The kernel code that is loaded is written in C, so in order to be executed the idea is to generate th…
bash command XOR ^ anothercommand
In the example below: what’s the expected behaviour of the XOR operator in shell? So when we enter what triggers anothercommand to run (if it will execute at all)? Answer If you enter command ^ anothercommand, you are simply providing command with two arguments, ^ and anothercommand. There is no operato…