All Questions
Tagged with concurrency c
473
questions
1
vote
0
answers
27
views
STM32H747I-Disco Hard fault in Core M4 after Creating Thread on Core M7 in ThreadX
I am developing synchronization libraries on top of ThreadX for an STM32 project. My libraries work perfectly when used on ONLY either the M4 or M7 core while the other core is idling. However, when I ...
2
votes
0
answers
56
views
Performance bottleneck in multihreaded process
I'm making a program that parses a graph from an .mtx file. I'm using a thread to read from the file, every line of the file contains two vertexes (representing an edge). The thread inserts the edge ...
0
votes
0
answers
38
views
Bit array for thread synchronization
i'm writing a concurrent implementation of the pageranking algorithm. I got some matrix market files that represent graphs, and i want to traspose the graphs from the file using a struct;
The struct ...
3
votes
0
answers
57
views
How can one thread portably wait for something to happen in another in a way that's reliably interruptible by a signal handler running?
POSIX supports lots of ways for threads in concurrent programs to wait for things to happen in other threads, e.g., mutexes, condition variables, and semaphores. Unfortunately, none of those ...
0
votes
0
answers
61
views
Lock implementation via futex
I read ostep book. I stopped at the chapter about thread locks. There is implementation of mutex via futex:
void mutex_lock(int *mutex)
{
int v;
if (atomic_bit_test_set(mutex, 31) == 0)
...
0
votes
0
answers
42
views
How can I create and reassign threads based on user input?
So I am trying to improve my sudoku validator and test it's performance, I wanted to know that how I can reassign threads, I changed up the code a bit but when I am specifying the number of threads, ...
0
votes
1
answer
79
views
Wrong approximation of PI with concurrent program
I'm trying to solve this concurrent programming problem:
The points on a unit circle centered at the origin are defined by the function f(x) = sqrt(1-x2). Recall that the area of a circle is pi*r2, ...
0
votes
0
answers
61
views
ncurses and multiprocessing
I'm experiencing a problem with getch()(ncurses library). I need to continuosly print an "object" (a child process that sends data to the parent through a pipe; the child is the one that ...
1
vote
1
answer
83
views
c threads don't print correctly
I'm trynig to implement a simple program in C with some threads. In details, i want that each thread read only a part of a CSV file (that contain only four float numbers per row) and put the read ...
0
votes
0
answers
35
views
Race condition in file struct in xv6 OS
I'm doing MIT labs for RISK-V xv6 and was working with files in the kernel/file.c. I was wondering about how I should arrange spinlocks to safely concurrently modify file struct (see kernel/file.h for ...
1
vote
1
answer
53
views
Running concurrent process in C and measure running time
I'm creating a program in C that loads a matrix from a file, divides it in N segments to be given to N processes.
Each process should count every 0 element in that segment of the matrix.
I should ...
0
votes
1
answer
51
views
Are these codes(concurrent C codes) necessary to use memory barrier?
I found these codes in project libuv 1.3.0. But I can't understand that why memory barriers(for compiler) are need.
static int uv__async_make_pending(int* pending) {
/* Do a cheap read first. */
...
3
votes
1
answer
418
views
Atomic 64 bit counter on ARM 32 bit MCU without locks
On a ARM Cortex M 32 bit, under C, I need to maintain a 64 bit counter. I want to avoid a race condition like:
start:
count = 0x00000000 ffffffff
threadA: increment count_low
count =...
0
votes
1
answer
115
views
N-body simulation using openMP in C
I have programmed a simulation for the n-body simulation using openMP, where each process represents a single mass Point.
The program compiles fine at the moment, but as you can see, I have several ...
0
votes
0
answers
346
views
Implementing Monitors in Producer/Consumer Problem in C
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#define NUM_PROD 4
#define NUM_CONS 4
#define STORAGE_SPACE 3
int ...