Tagged Questions
0
votes
1answer
37 views
Segmentation Fault or SizeOf not used correctly
So I am working on a program where I am using pthreads to solve a problem in parallel. Right now, I am getting a seg fault when I run the following code in the function: average_power.
This is the ...
1
vote
2answers
49 views
C/C++ implementation of a mailbox for inter-thread communication
I'm wondering if anyone has previously implemented a mailbox class for interthread communication using the POSIX library. For reference, I'm looking similar to mailboxes used in SystemVerilog: ...
0
votes
2answers
56 views
Partition a lifegame-like program for parallel computing with load balance
Consider a lifegame-like computing on a m*n matrix, it takes O(m*n) to develop each cycle.
I'm going to modify this program to a parallel version using Pthread and MPI. The simplest way is static ...
0
votes
1answer
59 views
How to parallelize my n queen puzzle with Pthreads?
I have the following Pthreads code for n-queen puzzle. It compiles successfully, but I get wrong answer. Whatever value I type I get as an answer zero. I guess I have some kind of logic error in my ...
1
vote
1answer
78 views
Share 3D array between threads using pThreads
I am quite new in parallel programming and I am trying to parallelize an application using pThreads. I have a function that browse a 3D array, compute some things and store the result into another 3D ...
3
votes
2answers
272 views
How to parallelize monte carlo estimation of pi using pthreads?
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char **argv)
{
unsigned long long in = 1;
...
0
votes
2answers
131 views
thread scheduling and yielding
If I have 4 working threads and 1 I/O thread running on a quad-core, one of the threads will be overlapped with another. How do i make sure that it is the input thread that is always overlapped with ...
2
votes
2answers
193 views
writing a parallel quick sort using p threads in c
I am trying to implement a parallel quick sort algorithm but i am not so sure how to make use of pthreads inside the quick sort function.
This is a link to my code on paste bin ...
2
votes
1answer
137 views
Use of pthread increases execution time, suggestions for improvements
I had a piece of code, which looked like this,
for(i=0;i<NumberOfSteps;i++)
{
for(k=0;k<NumOfNodes;k++)
{
mark[crawler[k]]++;
r = rand() % ...
2
votes
1answer
113 views
PThreads: Cores vs Threads
I'm using a complex C code that has parallel support through posix threads. It was written before hyperthreading existed.
I am running the code on a Macbook i5 (2 Cores 4 Threads). Since the code has ...
1
vote
3answers
122 views
thread building block combined with pthreads
I have a queue with elements which needs to be processed. I want to process these elements in parallel. The will be some sections on each element which need to be synchronized. At any point in time ...
2
votes
2answers
93 views
3by3 thread synchronization : how to avoid overhead
Let's say I'm running N threads.
Every thread needs to be sync with the next and the previous one.
for (i = 0 ; i < NITER; i++){
do_something ();
sync_with_neighbours (tId - 1, tId ...
0
votes
1answer
142 views
Pthread program always run slower than normal
I build in Ubuntu 12.04 with command
g++ -pthread hello.cpp
But I run parallel mode always slows than normal . Here's my code
#include <iostream>
#include <pthread.h>
#include ...
0
votes
1answer
341 views
PThreads for visual studio express 2010
Recently i started learning parallel programming using PThreads , but i have a problem with the compilation "how to include the library into visual studio" , please any help
Thanks in advance
0
votes
0answers
71 views
What makes parallel code sections and sequential code sections different?
We do have the parallel programs which in turn has the critical section which runs sequentially. Basically the size of the critical section is small but do you think this small piece of code behaves ...