Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Pros of Solaris OS threading approach EfficiencySolaris OS threading is very efficientas it uses a l... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Value at Risk The New Benchmark for Managing Financial Risk

Authors: Philippe Jorion

3rd edition

0070700427, 71464956, 978-0071464956

More Books

Students also viewed these Operating System questions

Question

Experimental mortality: Did participants drop out during the study?

Answered: 1 week ago

Question

What manages cache in Windows XP? How is cache managed?

Answered: 1 week ago