Skip to content
Advertisement

Tag: c++

POSIX threads vs parallelism

Do POSIX threads (managing by pthread library) works parallelly? My lecturer has told us that this library creates only user threads, that are not managed by Linux kernel. I wrote some code that fill large matrix and compared times of execution for threads and whole program and it seems to works parallelly. Can I use this library to creating parallel

How to extract taskid(tid) of a pthread from the parent thread?

I’m using std::thread to launch threads. Also, I need stats for the worker thread available at /proc/[pid]/tasks/[tid]. I need tid to be able to monitor thread stats. I was wondering if there was a way to extract tid from the parent thread. I know that syscall gettid() from the worker returns its id, but I want the threadId from the

Many-to-one two-way communication of separate programs

I’m trying to make two-way many-to-one communication between programs in Linux. My plan is the following: One program called “driver” that talks with the hardware needs to communicate with an unknown number of applications in Linux. I read that one of the most common ways for inter process communication is “named pipes”. The question I haven’t found yet is: How

can’t access my inherited class attributes

I am working on a project for my job to encode/decode into buffers DNS Records objects in C++. Some records have the same infos, so I created a class Dns message with theses basic infos: The DnsClass and DnsTypes are enum with the differents class/types I use. Then I have my sub-classes for each record, I will take A for

Shell append redirection replaces existing text?

For our school assignment, we have to implement input/output redirection. I managed to get the input and output redirection work, but I am facing an issue with append redirection. I am using testfile.txt: When the user types ls >> testfile.txt, I expect the output from ls to be added to the testfile. At this moment, the test lines get replaced

Is checking the existence of file or folder blocking or non-blocking?

Is checking the existence of file or folder blocking or non-blocking? Is opening dir / file blocking or non-blocking? Is list dir blocking or non-blocking? By block, I mean take a long time to return. Answer (I assume that you mean “block” in the sense that it’s usually used in Unix manpages and related documentation: that is, you are asking

Automatic variable not expanding properly in Makefile

I am using the following code: However, when I run the code, I receive the following error, implying that $< is not evaluating to anything: When I use the following code… …the Makefile evaluates to the following command… …which is precisely what I would like. However, I do not want to use addsuffix twice. I would like to use $<

Advertisement