top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Where thread gets it's PC value if we create thread using pthread_create?

+3 votes
311 views

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?

posted Nov 10, 2014 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn 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

As far as I know single assignment should be atomic operation so should be OK but not sure.
Any thoughts?

+1 vote

I wrote a multi-threaded program using pthread library, but I want execution of threads in a specific order.
What I have to do ?

0 votes

I heard the term "worker thread" and other types of threads such as "system thread" and "user thread".
For me a thread is nothing but a lite weight process and multi-threaded design is chosen for a software development when there are multiple task in the application/system and those tasks can be executed independently.
I want to know when these different terms are used like worker thread, user thread and system thread ?

...