Question: Consider the Sun Solaris operating system for user level and kernel level threading? Explain only pros and cons of Solaris OS threading approach? Question Compile

Consider the Sun Solaris operating system for user level and kernel level threading? Explain only pros and cons of Solaris OS threading approach?

Question

Compile the following program in Ubuntu Linux, attach all steps screenshots. Remover semantics and syntax errors before compilation.

#include

#include

#include

#include

// Let us create a global variable to change it in threads

int g = 0;

// The function to be executed by all threads

void *myThreadFun(void vargp)

{

// Store the value argument passed to this thread

int myid = (int *)vargp;

// Let us create a static variable to observe its changes

static int s = 0;

// Change static and global variables

++s; ++g;

// Print the argument, static and global variables

printf("Thread ID: %d, Static: %d, Global: %d", *myid, ++s, ++g);

}

int main()

{

int i;

pthread_t tid;

// Let us create three threads

for (i = 0; i < 3; i++;)

pthread_create(&tid, NULL, myThreadFun(), (void *)&tid);

pthread_exit(NULL);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Pros of Solaris OS threading approach EfficiencySolaris OS threading is very efficientas it uses a l... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!