Skip to content
Advertisement

Tag: pthreads

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

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

Centos 7 with PHP 7.2 Pthreads unable to load redis.so

I recently setup a new Centos 7 system with php 7.2 and Redis. This is working fine. This was my yum install of the php packages. yum install php72.x86_64 php72-php-cli.x86_64 php72-php-common.x86_64 php72-php-devel.x86_64 php72-php-fpm.x86_64 php72-php-gd.x86_64 php72-php-json.x86_64 php72-php-mbstring.x86_64 php72-php-mysqlnd.x86_64 php72-php-pdo.x86_64 php72-php-pecl-http.x86_64 php72-php-pecl-http-devel.x86_64 php72-php-pecl-igbinary.x86_64 php72-php-pecl-memcached.x86_64 php72-php-pecl-msgpack.x86_64 php72-php-pecl-propro.x86_64 php72-php-pecl-raphf.x86_64 php72-php-xml.x86_64 php72-php-xmlrpc.x86_64 php72-runtime.x86_64 php72-php-pecl-redis.x86_64 php php-devel Then I installed pthreads as explained in these directions

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

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”

PHP Thread compilation not working

I am attempting to use pthreads with Apache FPM. Step 1. After installing and recompiling php according to: https://blog.programster.org/ubuntu16-04-compile-php-7-2-with-pthreads The server works as expected and I can run pthreads from CLI. Step 2. Then I need to run threads from a web server so I followed the instructions from: https://antrecu.com/blog/run-php7-fpm-apache-mpmevent-ubuntu-1604 After sudo service apache2 restart && sudo service php7.0-fpm restart:

Advertisement