System V IPC vs POSIX IPC

Both have the same basic tools — semaphores, shared memory and message queues. They offer a slightly different interface to those tools, but the basic concepts are the same. One notable difference is that POSIX offers some notification features for message queues that Sys V does not. (See mq_notify().) Sys V IPC has been around … Read more

fastest (low latency) method for Inter Process Communication between Java and C/C++

Just tested latency from Java on my Corei5 2.8GHz, only single byte send/received, 2 Java processes just spawned, without assigning specific CPU cores with taskset: TCP – 25 microseconds Named pipes – 15 microseconds Now explicitly specifying core masks, like taskset 1 java Srv or taskset 2 java Cli: TCP, same cores: 30 microseconds TCP, … Read more

wait process until all subprocess finish? [duplicate]

A Popen object has a .wait() method exactly defined for this: to wait for the completion of a given subprocess (and, besides, for retuning its exit status). If you use this method, you’ll prevent that the process zombies are lying around for too long. (Alternatively, you can use subprocess.call() or subprocess.check_call() for calling and waiting. … Read more

Interprocess communication in Python

The multiprocessing library provides listeners and clients that wrap sockets and allow you to pass arbitrary python objects. Your server could listen to receive python objects: from multiprocessing.connection import Listener address = (‘localhost’, 6000) # family is deduced to be ‘AF_INET’ listener = Listener(address, authkey=b’secret password’) conn = listener.accept() print ‘connection accepted from’, listener.last_accepted while … Read more

Combining node.js and Python

This sounds like a scenario where zeroMQ would be a good fit. It’s a messaging framework that’s similar to using TCP or Unix sockets, but it’s much more robust (http://zguide.zeromq.org/py:all) There’s a library that uses zeroMQ to provide a RPC framework that works pretty well. It’s called zeroRPC (http://www.zerorpc.io/). Here’s the hello world. Python “Hello … Read more

Signal handling with multiple threads in Linux

pthreads(7) describes that POSIX.1 requires all threads in a process share attributes, including: signal dispositions POSIX.1 also requires some attributes to be distinct for each thread, including: signal mask (pthread_sigmask(3)) alternate signal stack (sigaltstack(2)) The Linux kernel’s complete_signal routine has the following code block — the comments are quite useful: /* * Now find a … Read more

Example of Named Pipes

using System; using System.IO; using System.IO.Pipes; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { StartServer(); Task.Delay(1000).Wait(); //Client var client = new NamedPipeClientStream(“PipesOfPiece”); client.Connect(); StreamReader reader = new StreamReader(client); StreamWriter writer = new StreamWriter(client); while (true) { string input = Console.ReadLine(); if (String.IsNullOrEmpty(input)) break; writer.WriteLine(input); writer.Flush(); Console.WriteLine(reader.ReadLine()); … Read more

IPC performance: Named Pipe vs Socket

Best results you’ll get with Shared Memory solution. Named pipes are only 16% better than TCP sockets. Results are get with IPC benchmarking: System: Linux (Linux ubuntu 4.4.0 x86_64 i7-6700K 4.00GHz) Message: 128 bytes Messages count: 1000000 Pipe benchmark: Message size: 128 Message count: 1000000 Total duration: 27367.454 ms Average duration: 27.319 us Minimum duration: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)