ipc

Calling python script from C#

故事扮演 提交于 2021-02-06 13:27:39
问题 I have a C# code which helps to run python environment first and then it executes my python process. But the problem is it takes a lot of time to execute. Actually i just want to pass my values and execute single line of code in python script. But need to execute all python code every time. Is there a way to run python process out side and just run the single line when i want. I attached both C# code and python process with this C# Code public String Insert(float[] values) { // full path of

Calling python script from C#

我的梦境 提交于 2021-02-06 13:27:05
问题 I have a C# code which helps to run python environment first and then it executes my python process. But the problem is it takes a lot of time to execute. Actually i just want to pass my values and execute single line of code in python script. But need to execute all python code every time. Is there a way to run python process out side and just run the single line when i want. I attached both C# code and python process with this C# Code public String Insert(float[] values) { // full path of

POSIX semaphores - cannot determine what causes segmentation fault

若如初见. 提交于 2021-01-29 19:54:19
问题 I'm working on the sleeping barber problem (using FIFO queue and shared memory), and I have a problem. I try to run this program just to see what is shown, however, I get segmentation fault every time. In the code I check, if semaphores are created successfully, if shared memory is created properly, but the program crashing must come from different place, which I cannot seem to find. I also tried to use Valgrind but what I got is: Valgrind for the newer version of code: However, when I try to

IPC in Message-Passing Systems - Direct Communication

ぃ、小莉子 提交于 2021-01-29 17:25:23
问题 According to the book 'operating systems concepts', it says: With direct communication, each process that wants to communicate must explicitly name the recipient or sender of the communication. This scheme exhibits symmetry in addressing. In this scheme, the send and receive primitives are defined as: Send(P, message): Send a message to process P receive (Q, message)-Receive a message from process Q. In asymmetry only the sender names the recipient; the recipient is not required to name the

can not open FIFO

与世无争的帅哥 提交于 2021-01-29 14:48:08
问题 I write this program to test the FIFO in Ubuntu。The main program create a child process to write something ,and then the parent read and print it /* communication with named pipe(or FIFO) @author myqiqiang @email myqiqiang@gmail.com */ #include<sys/types.h> #include<sys/stat.h> #include<stdio.h> #include<errno.h> #include<fcntl.h> #include<string.h> #define FIFO_SERVER "/home/myqiqiang/fifoserver" //fifo directioy #define BUFFERSIZE 80 void main() { pid_t pc; int flag,fd; char data[BUFFERSIZE

Initializing shared memory using mmap() for a 2D array, is it necessary to also map memory for subsequent pointers? Should I use shm instead?

元气小坏坏 提交于 2021-01-29 08:48:51
问题 I am using mmap() to initialize a shared memory space for parent and child processes and the object happens to be a double char pointer (i.e. char** ). It's necessary because I'm going to be storing user input to this 2D array in a child process and the parent will be accessing this same data after the child has terminated. It wasn't hard to work this out after reading a little bit of documentation on mmap() , and it feels a lot like malloc() , but less of a commitment. Consider the code

How can I monitor a FIFO?

為{幸葍}努か 提交于 2021-01-28 09:28:25
问题 I want to debug an issue between two processes ideally by setting up a read-only terminal window of that traffic. Is this something I can simply use existing, standard linux utilities for? The FIFO lives at /run/myfifo and is created in one of the processes with: /* Create a FIFO if one doesn't already exist */ int createFifo(char *filepath) { if (access(path, F_OK) == -1) { return mkfifo(filepath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); } return 0; } tail -F /run/myfifo ?

How can I monitor a FIFO?

匆匆过客 提交于 2021-01-28 09:24:23
问题 I want to debug an issue between two processes ideally by setting up a read-only terminal window of that traffic. Is this something I can simply use existing, standard linux utilities for? The FIFO lives at /run/myfifo and is created in one of the processes with: /* Create a FIFO if one doesn't already exist */ int createFifo(char *filepath) { if (access(path, F_OK) == -1) { return mkfifo(filepath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); } return 0; } tail -F /run/myfifo ?

Why I can create a shared memory bigger than the size mounted on /dev/shm using POSIX?

久未见 提交于 2021-01-28 05:46:58
问题 I am trying to handle errors using shared memory IPC in a Ubuntu 16.04. First, I checked the available memory in /dev/shm using df -h, having 500M availables, so I coded something quickly in order to check what happens if I try to create a shared mem bigger than the mounted size. The code is the following (it has been modified several times so I know that is not very tidy): #include <iostream> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ipc.h> #include <sys

Sharing a memory map simultaneously between processes

浪子不回头ぞ 提交于 2021-01-28 01:07:27
问题 After overcoming some other difficulties, I'm now stuck with this (probably simple) problem. My goal: Multiple instances of my application are running and performing operations (read & write) on the same file at the same time Solution (what I want to do): use memory-mapped files to speed up the execution. When the app starts, it attempts to call CreateFromFile( ) (I understand that if the file has already been mapped by someone else, this will do nothing but return the "handle"), then