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
Step: 1
Pros of Solaris OS threading approach EfficiencySolaris OS threading is very efficientas it uses a l...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started