Skip to content
Advertisement

Tag: multithreading

output in Line A and Line B?

What would be the output in Line A and Line B? Do you think there is synchronization problem in updating the variable value? Answer Child value is 200 and Parent value is 300 always. pthread_join causes the main thread to wait until the other thread finishes executing. Both threads are acting on the same global variable. So the thread_prog thread

Multithreaded word count in C

I know I said I would try to figure it out on my own and I really did, and then I looked elsewhere first before posting here again but then I just ended up with this mess: How best should I fix this? Specifically these errors and warnings: I think the part for counting words from the buffer is okay,

mmap: performance when using multithreading

I have a program which performs some operations on a lot of files (> 10 000). It spawns N worker threads and each thread mmaps some file, does some work and munmaps it. The problem I am facing right now is that whenever I use just 1 process with N worker threads, it has worse performance than spawning 2 processes

Rails task not running unless rails runner has been executed in the command prompt since the linux server machine’s bootup

I’m trying to execute this task to update a large amount of data from a controller so that when an administrator user accesses this method it will run the said task. I’ve confirmed that there aren’t any issues with the task itself, but I’m not so sure about the way it’s being called. The problem I’m running into is that

Thread Program on Linux (Posix Thread)

I want to modify the multithread program on the Linux operating system using this Pthread API. I want to change that program into a program that has 2 threads that work together to add a number. But i don’t know how to change it, Thanks again for any help that can be offered. I am sorry,because I’m not good at

How does pthread_cond_wait (conditon variable) unblock all threads only once, not multiple times?

I have successfully implemented a producer thread and 2 worker threads or consumer threads. The producer thread broadcasts condition using pthread_cond_broadcast. And the worker threads are blocked by pthread_cond_wait. The code looks something likes this: Thread 1 (Producer Thread): Thread 2 (Worker/Consumer Thread): Thread 3 (Worker/Consumer Thread): My question is why does Thread 2 or Thread 3 does not re-execute

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 having three major problems. Problem 1: If we start the consumer first he sometimes

Advertisement