A barrier is a point where the thread is going to wait for other threads and will proceed further only when predefined number of threads reach the same barrier in their respective programs.
Questions tagged [pthread-barriers]
32 questions
0
votes
0 answers
Using multithreads to copy a single file at the same time, outputting the same file down to the MD5 check sum
The problem I'm running into is that when the file tries to copy, it only copies part of the file and the other part is a bunch of unreadable characters. This is for an academic assignment that wants us to use barrier synchronization so we need to…
0
votes
1 answer
pthread_barrier_t in looping threads
I work with 3 different threads (t0, t1 and t2), whom I need to synchronize behaviors this way:
My main thread will be creating these 3 threads, and those will be looping through prints and barrier just like I mentionned.
I tried to write the…

Axel Carré
- 303
- 1
- 5
0
votes
1 answer
Working with pthreads and synchronization
I'm writing a toy program to help me understand how barriers work. In the program I have each thread checking to see if an element in one array is in another array. I was able to have all threads start searching simultaneously but I'd like to have…

F. Pea
- 13
- 1
- 7
0
votes
1 answer
Writing and reading from a buffer with pthread
I am trying to use pthread. In my code below I have defined two global variables (arg1 and arg2) and in the main function I start filling each element of arg2 with 1. I want the pthread to print the 101-th element of arg2 as soon as it is filled by…

zahra
- 175
- 1
- 10
0
votes
2 answers
Segmentation fault (core dumped) in C - While Using PTHREADS
Hello guys,
I have a problem in my code and i do not know how to fix it(A Segmentation fault(core dumped))!
So my teacher wants me to write a program that creates N treads and makes them do some calculations.I have 3 global 2d arrays A,B,C (i have…

george nik
- 49
- 1
- 8
0
votes
2 answers
Why does the pthread_barrier_wait does not take thread priorities into consideration?
I am using barriers to synchronise my two threads which will perform task_1 and task_2 respectively.
After they are synchronised, I would like that the task with higher priority to start executing before the tasks with lower priorities.
I was…

Bruno Pessanha
- 2,874
- 4
- 24
- 35
0
votes
2 answers
Pthread-barriers and raspberry pi
I am making an assignment for for school and the goal of the assignment is to use Pthread Barriers, to make the LEDs on the raspberry pi slowly fades from unlit to lit and vice versa. I am a beginner to C and I think I udnerstand the cocept of…

S. N
- 3,456
- 12
- 42
- 65
0
votes
1 answer
How to I make threads starts their work in order of their IDs (using semaphores)?
I have 10 threads and each has its own ID from 1 to 10; all threads have 2 Phases to do (i.e. Phase1 and phase2). I am trying to make all threads finish their Phase1 first, before any thread enter phase2, using semaphores (I did it and it works…

Mikael
- 171
- 2
- 12
0
votes
0 answers
How to create a fair multithreading double barrier?
I have a double barrier multi-thread program working, but I don't know how to create a fair mechanism (using POSIX mutex, conditional variable barrier functions) -
meaning: groups of threads will enter the first barrier by arrival time to…

user8180105
- 27
- 1
- 2
0
votes
0 answers
How can I make a thread wait on any barrier in a set of barriers?
In POSIX and Windows API have barriers that allow synchronizing n threads. When n threads waiting for the barrier they may proceed doing some work.
What I want is for threads to wait for a set of barriers. When any of the barriers have n threads…

Andreas
- 5,086
- 3
- 16
- 36
0
votes
1 answer
Implement barrier in swift3
I'm trying to upload multiple images to firebase storage, and the app needs to do something after the uploading tasks finish. I did some research, and I found barrier is useful in this case. I followed the tutorial, but it seems my code is not…

AlexBains
- 295
- 6
- 14
0
votes
1 answer
Pthread strange behavior and Segmentation fault
I am trying to write a parallel simulator, that uses threads. But I cannot find what causes segmentation fault and why threads seem to get stuck on a barrier sometimes.
#include
#include
#include
#include…

Alex Smirnov
- 21
- 1
- 9
0
votes
1 answer
Pthread-Barriers in C
I am trying to create a c code that will sort an array with multiple threads, so i need to use barriers to synchronize threats
void sort(struct ThreadArguments* args){
struct ThreadArguments* the_args= (struct ThreadArguments*)args;
…

Alex Smirnov
- 21
- 1
- 9
0
votes
1 answer
Regarding PThread's and PThread Barriers
I'm writing an SMT program, and I'm trying to workaround an interesting problem.
I need all my functions to exit together, however some of the threads get stuck at barriers, even when i don't want them to.
My question is: what happens when i delete…

Blue Granny
- 772
- 1
- 8
- 24
0
votes
0 answers
pthread_barrier works on debug but doesn't on run
I'm using a pthread_barrier_t from C/C++ on my code to synchronize 3 different threads. When I'm using the Debug, through gdb, it works just fine, but when I run the binary directly from the board, all 3 threads get stuck on the…