Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged fork-system-call
1
votes
1
answer
1
fork() system call
Consider the following pieces of codes for fork( ) system call. Solve and explain how many child processes are created upon execution of this program? Snippet 1: void main( ) { fork( ); fork( ); exit( ); } Snippet 2: int main( ) { int i; for (i = 0; i < 4; i++) fork(); return 0; } Learning Outcomes. Understand the working of fork ( ) system call.
Consider the following pieces of codes for fork( ) system call. Solve and explain how many child processes are created upon execution of this program? Snippet 1:void main...
Sparkboy
85
views
Sparkboy
asked
Apr 4
Operating System
operating-system
fork-system-call
+
–
1
votes
2
answers
2
#OS-FORK Output
Q23. The following C program is executed on a Unix/Linux system: main() { int i=0; while (i<20) if (i%2==0) fork(); i++; return 0; } Calculate how many number of processes will be created after executing the above program. Options: 1.1023 2.Infinite 3.1024 4.2048
Q23. The following C program is executed on a Unix/Linux system: main(){ int i=0; while (i<20) if (i%2==0) fork(); ...
BitMask
389
views
BitMask
asked
Mar 3
Operating System
operating-system
fork-system-call
gate-preparation
programming-in-c
usermod
+
–
5
votes
2
answers
3
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 41
Assume the following code is compiled and run on a modern Linux machine. Assuming $\textsf{fork()}$ never fails, how many times will the message $\textsf{ Hello }$ will be displayed? #include <stdio.h> #include <unistd.h> int ... else { printf("Hello"); } printf("Hello"); return 0; } $2$ $3$ $4$ $6$
Assume the following code is compiled and run on a modern Linux machine.Assuming $\textsf{fork()}$ never fails, how many times will the message $\textsf{“Hello”}$ wil...
GO Classes
844
views
GO Classes
asked
Jan 21
Operating System
goclasses2024-mockgate-12
goclasses
operating-system
fork-system-call
2-marks
+
–
2
votes
3
answers
4
System Call FORK()
Int main () { fork(); printf("a"); fork(); printf("b"); return 0; } How many distinct outputs are possible of above code? And also give outputs
Int main (){fork();printf("a");fork();printf("b");return 0;}How many distinct outputs are possible of above code? And also give outputs
Philosophical_Virus
882
views
Philosophical_Virus
asked
Dec 10, 2023
Operating System
operating-system
fork-system-call
+
–
3
votes
1
answer
5
fork
Consider the following code segment : int main (void) { for (int i=2; i<=5; i++) { fork( ); } printf (“GOCLASSES”); How many times “GOCLASSES” is printed by the above code?
Consider the following code segment :int main (void) { for (int i=2; i<=5; i++) { fork( ); }printf (“GOCLASSES”);How many times “GOCLASSES” is printed by the ab...
24aaaa23
772
views
24aaaa23
asked
Oct 1, 2023
Operating System
operating-system
fork-system-call
+
–
0
votes
0
answers
6
fork
Consider the following pseudo code that uses fork–join constructs – S1 ; fork(L1); // fork(L) : Creates new process and execution starts from L. S2 ; S4 ;join( ) : Combines all processes able to execute join. fork(L2); L1 : S3 ; L2 join( ); S5 ; Draw correct precedence graph for the above code fragment?
Consider the following pseudo code that uses fork–join constructs –S1 ;fork(L1); // fork(L) : Creates new process and execution starts from L.S2 ;S4 ;join( ) : C...
24aaaa23
404
views
24aaaa23
asked
Oct 1, 2023
Operating System
operating-system
fork-system-call
+
–
1
votes
2
answers
7
OS handout
For following code how many times the '*' will printed? main() { int i,n ; for(i = 1 ; i<=n ; ++i) { fork(); printf("*"); } }
For following code how many times the '*' will printed?main(){ int i,n ; for(i = 1 ; i<=n ; ++i) { fork(); printf("*"); }}
Aniket1710
810
views
Aniket1710
asked
Jul 20, 2023
Operating System
fork-system-call
+
–
0
votes
2
answers
8
Unacademy practice question from OS
#include <stdio.h> void main() { int i = 3; while(i>0) { i--; if(fork()||fork()) { printf("Hi"); } } } How many times “Hi” will be printed ?? #include <stdio.h> void main() { int i = 2; while(i>0) { i--; if(fork()||fork()) { printf("Hi"); } } } How many times “Hi” will be printed ??
#include <stdio.h>void main(){ int i = 3; while(i>0) { i ; if(fork()||fork()) { printf("Hi"); } }}How many times “Hi�...
vivek1211
875
views
vivek1211
asked
Jul 5, 2023
Operating System
operating-system
fork-system-call
+
–
0
votes
3
answers
9
#CPCB
How many helloWorld lines are printed by the program: #include <stdio.h> #include <stdlib.h> void myFunc() { if (fork() == 0) { fork(); printf(“helloWorld\n”); exit(0); } return ; } int main(){ printf(“helloWorld\n”); myFunc(); printf(“helloWorld\n”); return 1; }
How many helloWorld lines are printed by the program:#include <stdio.h>#include <stdlib.h void myFunc(){ if (fork() == 0){ fork(); printf(“helloWorld\n”); exit(0); } ...
amit166
562
views
amit166
asked
Jun 30, 2023
Operating System
fork-system-call
+
–
0
votes
1
answer
10
Fork() system call doubt
void main() { int n = 1; if(fork()==0) { n = n<<1; printf(“%d, “, n); n = n <<1; } if(fork()==0) n=n+700; printf(“%d, “,n); } Which of the following output is not possible? 2,4,1,701,704 1,2,4,704,701 2,704,4,701,1 1,704,2,4,701
void main() { int n = 1; if(fork()==0) { n = n<<1; printf(“%d, “, n); n = n <<1; } if(fork()==0) n=n+700; printf(“%d, “,n); }Which of the following output is not ...
Erwin Smith
781
views
Erwin Smith
asked
Apr 11, 2023
Operating System
fork-system-call
operating-system
programming-in-c
+
–
3
votes
3
answers
11
GO Classes 2023 | IIITH Mock Test 1 | Question: 27
When a process creates a new process using the $\textsf{fork()}$ operation, which of the following are shared between the parent process and the child process? Stack Heap Shared memory segments Page table
When a process creates a new process using the $\textsf{fork()}$ operation, which of the following are shared between the parent process and the child process?StackHeapSh...
GO Classes
814
views
GO Classes
asked
Mar 26, 2023
Operating System
goclasses2023-iiith-mock-1
goclasses
operating-system
fork-system-call
1-mark
+
–
2
votes
1
answer
12
GO Classes 2023 | IIITH Mock Test 1 | Question: 28
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 $\textsf{c}$ are there? $2$ $3$ $4$ $1$
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...
GO Classes
728
views
GO Classes
asked
Mar 26, 2023
Operating System
goclasses2023-iiith-mock-1
goclasses
operating-system
fork-system-call
1-mark
+
–
12
votes
4
answers
13
GATE CSE 2023 | Question: 13
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode? Function Call malloc Call Page Fault System Call
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?Function Callmalloc CallPage FaultSystem Call
admin
11.5k
views
admin
asked
Feb 15, 2023
Operating System
gatecse-2023
operating-system
fork-system-call
multiple-selects
1-mark
+
–
0
votes
1
answer
14
Fork() | OS
int doWork(){ fork(); fork(); printf("Hello world!\n"); } int main() { doWork(); printf("Hello world!\n"); exit(0); }
int doWork(){ fork(); fork(); printf("Hello world!\n");}int main() { doWork(); printf("Hello world!\n"); exit(0);}
abhinowKatore
1.5k
views
abhinowKatore
asked
Jan 13, 2023
Operating System
fork-system-call
operating-system
+
–
1
votes
3
answers
15
Unacademy AIMT question on Fork()
Given the following piece of code : Main() { Int child = fork(); Int c = 5; if (child == 5) { C + = 5; } Else { Child = fork(); C + = 5; } } What are the different values of the variable c? First of all checking child == ... a pseudocode as some of the syntaxes are wrong. Also I am getting the answer as 10,10,10. Given answer is 20,10,15. Can someone please check?
Given the following piece of code :Main(){Int child = fork();Int c = 5;if (child == 5){C + = 5;}Else{Child = fork();C + = 5;}}What are the different values of the variabl...
Sunnidhya Roy
1.1k
views
Sunnidhya Roy
asked
Dec 14, 2022
Operating System
operating-system
fork-system-call
programming-in-c
+
–
1
votes
0
answers
16
Fork System Call and Threads | OS | MSQ
MSQ Consider the following statements, which one of the following is/are TRUE In fork() system call, child process inherits all the open file descriptors of parent process In fork() system call, child process copies the code of the ... system call, child process shares the code of the parent process User level threads shares the code segment of the process
MSQ Consider the following statements, which one of the following is/are TRUEIn fork() system call, child process inherits all the open file descriptors of parent process...
Souvik33
787
views
Souvik33
asked
Nov 28, 2022
Operating System
operating-system
fork-system-call
unix
process-and-threads
threads
multiple-selects
+
–
2
votes
1
answer
17
gateforum
h4kr
320
views
h4kr
asked
Nov 8, 2022
Operating System
gateforum-test-series
operating-system
fork-system-call
+
–
0
votes
1
answer
18
made easy test series
When a process create a child, which of the following is/are correct possibility/situation? A) Parent process can execute parallely with children. B) Parent process can wait until some or all of its children have terminated. C)Child process can only be the duplicate of parent process. D) Child process can only loaded with program other than parent program.
When a process create a child, which of the following is/are correct possibility/situation?A) Parent process can execute parallely with children.B) Parent process can wai...
viral8702
945
views
viral8702
asked
Oct 12, 2022
Operating System
made-easy-test-series
fork-system-call
+
–
4
votes
2
answers
19
GO Classes Test Series 2023 | Operating Systems | Test 4 | Question: 8
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? (Hint: It may be easier to solve this problem by induction/recursion.)
Given the following piece of codemain(int argc, char argv) { forkthem(5) } void forkthem(int n) { if(n 0) { fork(); forkthem(n-1); } }How many processes are created if...
GO Classes
412
views
GO Classes
asked
Oct 9, 2022
Operating System
goclasses2024-os-4-weekly-quiz
numerical-answers
goclasses
operating-system
fork-system-call
2-marks
+
–
Page:
1
2
3
4
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register