I am writing a program which multiple processes will run concurrently. In this program, there is a need for one process to suspend all other participants temporarily. In order to spare myself the overhead of tabulating all participant process ID’s in a shared page and signaling them individually, I have…
Tag: c++
Multithreading with Semaphor, Mutex and PThread
Me and a friend are currently working on basic multithreading examples for university in c. We’re supposed to solve the producer/consumer problem with a multithreaded buffer. We’ve got a working version using mutex and conditional variables, but trying to solve this using semaphores and mutex were…
Signal Handler Behavior
I have just some questions about the system calls signal, kill and the signal handler. I have this code: 1) I don’t understand why the first printf in the first child, return -1 without a sleep(1) before…seems that the handler is executed after the beginning of the child. 2) When there is a kill t…
What does `exit()` send `status` to, the parent process or the OS kernel?
In Linux, What does exit() send status to, the parent process or the OS kernel? APUE says that exit() performs certain cleanup processing and then returns to the kernel. But when I run a program in shell, the program returns its exit status to the shell which is its parent process. Answer As you’re prob…
C NET-SNMP Get and Set specifically via MIB Name, Not OID
I have written and am testing software for a generic SNMP client module in C as well as an implementation using this generic module. I am having trouble getting a get request to work by passing in a MIB name(e.g. sysDescr) instead of an OID(e.g. 1.3.6.1.2.1.1.1). I am successful when I pass in a character arr…
Static-storage-duration object uniquness guaranties when dynamically loaded from multiple libraries
Imagine that there is a shared library S, there are shared libraries A and B, and an executable C. A and B are linked against S. C is not linked against A and B, instead C dynamically loads A and B via dlopen. S has a static-storage-duration object O with external linkage that is used inside A and B. I
C++ Command not recognized after fork() and execl() call (Linux)
I’m trying to create a program that can open a terminal browser and navigate through a website. It works fine up until the child process is called. The following error shows up “xdotool: Unknown command: search –onlyvisible –name Terminal windowactivate keydown Down” I’ve t…
Merging two text files into new one (back and forth every new line) using C in Linux using system-calls
So the assignment is merging two text files in Linux using system calls: 1.txt: Hello, my class! 2.txt: Today is a very nice day NEW.txt: Today is Hello, a very nice my class! day Problem is I get (sorry for putting this as code sample): The + sign keeps changing between (“#”, “(“, …
Add syscalls to linux kernel
I’m new in working with kernel. I want to add a linked list to my kernel, and I try to fix it like this link : Linux Kernel Programming–Linked List here is code’s that I added to sys.c : syscall defenition: and my struct for linked list: and when I compile the kernel, I saw this error: thanks for …
Process.Start with .NET Core 2.0 on Linux
I am trying to start the default web browser open to a link with Process.Start(). I use Process.Start(“https://www.google.com”), but my .NET Core App crashes with the following: Exception has occurred: CLR/System.ComponentModel.Win32Exception An unhandled exception of type ‘System.ComponentM…