top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Linux: In which scenarios, we should use pthread_detach function ?

+1 vote
26 views

I know the basics of pthread but looking for more information on uses of pthread_detach library function.

posted May 26 by Vikram Singh

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

Similar Questions
+2 votes

You are given two processes and each process is having four threads. One of the thread is having performance issue. How will you find out that thread which is having problem.

+1 vote

I need to create two child processes each of which calls its own execvp on fork and the executable share common POSIX semaphores between them.
So do I need to create a shared memory or just implement named semaphores?

+3 votes

My question is regarding the PC register value of which is giving to the created thread.

if I create a new process with fork() the PC value will be copied from parent to child as PC value is the next command in the code.

However if I create a new thread as following

#include <pthread.h>
int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*start_rtn)(void), void *restrict arg)

with:

err = pthread_create(&thready, NULL, &mythread, NULL);

Now the question is where the created thread gets it's PC value. How does the PC value set to the first line of mythread code?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...