Skip to content
Advertisement

Tag: multithreading

Segmentation Fault on pthread_create

I am having an issue with the following C code. The code itself is supposed to create 5 threads that simulate the Dining Philosophers problem in which threads are accessing shared data. The code follows: I am on a Linux virtual machine, using gedit. The program compiles fine, but upon attempting to run it, I am getting a “Segmentation Fault”

what is “synchronising point” in multi threading?

I need to decide on how many counting semaphores needs to be used for one of the multi threaded application. I came to know, if we know synchronising points then we can decide the number of semaphores to be used. What are synchronising points? Answer A synchronization point is a place in the flow of execution where a thread must

Error in malloc while trying to create a thread

Hi everyone i post only the core of the code which create probleam and which work with threads. As we can see foo function create new thread and reallocate memory to store the pthread_t. Then it try to create a new thread with pthread_create as NULL as attr and arg and as function pointer a pointer to foo2; Now the

Alternate to setpriority(PRIO_PROCESS, thread_id, priority)

Given – Thread id of a thread. Requirement – Set Linux priority of the thread id. Constraint – Cant use setpriority() I have tried to use below pthread_setschedprio(pthread_t thread, int prio); pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param); Both the above APIs use pthread_t as an argument. I am not able to construct (typecast) pthread_t from thread id. I

Wait for popen script to terminate in C

Is that possible with C to wait until the popen subprocess is finished? I have a script launched by a C daemon which will connect to a wifi network when an external signal is triggered. Here is my code for now : However, I’m not waiting for the subprocess to finish so when I’m closing the pipe, the ressource is

Which OS / platforms implement wait morphing optimization?

Which major OS / platforms implement wait morphing? This question came up when I noticed that there’s no clearcut best practice about whether one should signal a condition variable with mutex locked or not. A typical recommendation is to signal while holding the lock unless profiling shows a substantial performance improvement overhead from unlocking (by removing an extra context switch).

Advertisement