System-Calls
Question 1 |
A process executes the code
fork(); fork(); fork();The total number of child processes created is
3 | |
4 | |
7 | |
8 |
Question 1 Explanation:
The no. of child process created = 2n -1 = 23 -1 = 7 (where n is number of fork() statements)
7 are child processes.
7 are child processes.
Question 2 |
A process executes the following code for (i =0; i < n; i + +) for ( );
The total number of child processes created is
n | |
(2n) - 1
| |
2n | |
(2n+1) - 1
|
Question 2 Explanation:
Fork is a system call, implements in kernel.
It is a operation where process creates a copy of itself.
1,3,7,15,31,... ⇒ 2n-1
It is a operation where process creates a copy of itself.

1,3,7,15,31,... ⇒ 2n-1
Question 3 |
Consider the following code fragment:
if (fork() == 0) { a = a + 5; printf(“%d,%dn”, a, &a); } else { a = a –5; printf(“%d, %dn”, a, &a); }Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is TRUE?
u = x + 10 and v = y
| |
u = x + 10 and v is ≠ y
| |
u + 10 = x and v = y
| |
u + 10 = x and v ≠ y
|
Question 3 Explanation:
u, v values printed by parent process.
u=a-5; v be address of a
a=u+5;
x, y values printed by child process.
x=a+5; y be the address of a
x=u+5+5; v=y
x=u+10
u=a-5; v be address of a
a=u+5;
x, y values printed by child process.
x=a+5; y be the address of a
x=u+5+5; v=y
x=u+10
Question 4 |
System calls are usually invoked by using
a software interrupt | |
polling | |
an indirect jump | |
a privileged instruction |
Question 4 Explanation:
Software interrupts are implementing device drivers (or) transitions between protected mode of operations, such as system calls.
There are 4 questions to complete.