Running Code
5. What happens when you run the following piece of code:
main(int argc, char ** argv)
{
for(;;)
fork();
}
Given the following piece of code:
main(int argc, char ** argv)
{
int child = fork();
int c = 5;
if(child == 0)
{
c += 5;
}
else
{
child = fork();
c += 10;
if(child)
c += 5;
}
}
How many different copies of the variable c are there? What are their values?
Given the following piece of code
main(int argc, char ** argv)
{
forkthem(5)
}
void forkthem(int n)
{
if(n > 0)
{
fork();
forkthem(n-1);
}
}
How many processes are created if the above piece of code is run?
Most round-robin schedulers use a fixed size quantum. Give an argument in favor of and against a small quantum.
By OTA: Sandeep Kumar, MTech
OTA Rating: 4.8/5
Your Price: $2.19 (original value ~$15.96)
What's included:
Page generated in 0.016 seconds