Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pthreads]

Pthreads (POSIX Threads) is a standardised C-based API for creating and manipulating threads on a POSIX-compliant system. It is defined by the standard "POSIX.1c, Threads extensions (IEEE Std 1003.1c-1995)", and subsequently by the Single Unix Specification.

Filter by
Sorted by
Tagged with
3 votes
1 answer
117 views

Multithread execution times are slow on Ubuntu and fast on Windows

I'm working on a project accelerating the execution of a Genetic Algorithm both on multiple cores and on a GPU. The algorithm is specifically suited for the solution of the Traveling Salesman Problem ...
Pietro Pianigiani's user avatar
2 votes
3 answers
136 views

Simple rwlock implementation in C

Can someone please review my rwlock implementation to see if there are any issues with correctness (hopefully not), give any feedback on how to write good C code etc, design patterns which could be ...
Tejas Anand's user avatar
2 votes
2 answers
248 views

Circular Queue Producer Consumer with Mutex and Condition Variable vs. Sempahore

How can I optimize the performance of the code below? Destruction of the condition variable at the end of main blocks, not sure why this behavior is occurring. Is it possible to remove some of the ...
Darnoc Eloc's user avatar
0 votes
0 answers
112 views

binary semaphores implementation pthread

Can someone see if have not made some stupid mistakes in the binary semaphore implementation? I know that some more checks have to be added but I have eventually lost the initial idea in the details. <...
0___________'s user avatar
2 votes
2 answers
196 views

Wait for child while polling file descriptor with self-pipe controlled by different threads

I am working on a personal project, and one of the things it does is to call a blocking operation on a file descriptor while a forked+exec'ed child process is running. It needs to know when the ...
Seninha's user avatar
  • 171
4 votes
3 answers
472 views

Implementation of pthread multithreading and mutex

I am trying to implement a "proper" pthread multithreading program with pthread mutex. I want it to be as C-standard-conforming and POSIX-conforming as possible. The below is my ...
D.J. Elkind's user avatar
7 votes
2 answers
4k views

Proper implementation of signal handler and multithreading (pthread)

I am trying to implement a "proper" signal handler that works correctly for multiple threads, and to be as C-standard-conforming and POSIX-conforming as possible. The below is my ...
D.J. Elkind's user avatar
8 votes
2 answers
1k views

Event functionality in C

I am beginner to intermediate and wanted to write a little event code in c. It's one header file with 108 line pure code and it does what I was thinking it should be like for me. EventListener.h ...
mortytheshorty's user avatar
1 vote
2 answers
187 views

semaphore barriers exercise os three easy pieces

I am reading the book OS three easy pieces, In the semaphore chapter I am going through barrier.c question. Below is the code that needs to be completed for the desired output: ...
Hackaholic's user avatar
15 votes
2 answers
1k views

A multithreaded implementation of the 'which' command

Here is an implementation of the 'which' command which can tell where programs are located. ...
JohnScott's user avatar
  • 171
6 votes
3 answers
981 views

A priority based timer using priority queue

I am trying to implement a priority-based timer where certain events are fired out based on their expiry and the priority. So if there are 3 timers with the following expiry time and priorities Timers ...
xyf's user avatar
  • 508
4 votes
1 answer
864 views

A tiny threads pool in C

I'm a newbie in C, and currently following Stanford CS107 - Programming Paradigms. For assignment 6, I find it'd be better to isolate the threads management from the service logic. The following code ...
weiShen's user avatar
  • 205
3 votes
1 answer
378 views

Time slice for thread check

A code to check the time slice for each thread separately, it will receive an integer number from the command line for the number of threads to run simultaneously. Would love some feedback on what is ...
SA.93's user avatar
  • 143
4 votes
2 answers
382 views

Thread Synchronization - CPU Usage exceeds 200 - C program

I have a working program that reads user input keys and echoes them back to the screen using the producer/consumer paradigm (the project requires you to use threads). While this program does work, it ...
user232489's user avatar
3 votes
2 answers
340 views

Implementing metropolis algorithm in C

This is my second C program (an improved version of the first one). I want to optimize this simulation. Algorithm The simulation algorithm is: The system can go from \$i\$ to \$i+1\$ with probability ...
Kartik Chhajed's user avatar

15 30 50 per page
1
2 3 4 5 6
Morty Proxy This is a proxified and sanitized view of the page, visit original site.