APUE7-8 Process2

Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. if (pid=fork() && pid2 = fork()) {fork();} if (pid=fork() && pid2 = fork()) {fork();} if (pid=fork() && pid2 = fork()) {fork();}
16
27
32
48
64
The new process created by fork is called the child process. This function is called once but returns ___.
None
Once
Twice
Three times
As many as needed
Given fork program as shown below, what would be the total number of processes at the end including the process running this program. for (i=1; I < nprocs; i++) { childpid = fork(); } When nprocs = 3, then the total number of processes after this code will be ____
1
2
4
8
16
This instruction ___ takes two (file descriptor) arguments, to duplicate the first one (file descriptor) to be set for the second one.
Hidden
Dup
Dup2
Fd
Pipe
This instruction ___ takes two (file descriptor) arguments, to duplicate the first one (file descriptor) to be set for the second one.
Execlp("wc","wc",(char *)0);
Execlp("ls","ls",(char *)0);
Execlp("system","wc",(char *)0);
Execlp("ls | wc",(char *)0);
After fork, the differences between the parent and child are:
The return values from fork
The process IDs
The different parent process IDs
All of the above
None of the above
When a process calls this API call (or one of these API calls), that process is completely replaced by the new program, and the new program starts executing at its main function. It merely replaces the current process its text, data, heap, and stack segments with a brand-new program from disk.
Fork
Exec
Pipe
Dup
System
What would be a proper way to set a signal handler (sig_int) for SIGINT?
SIGINT(sig_int);
Sigint(SIGINT);
SIGINT(signal, sig_int);
Signal(SIGINT, sig_int);
Signal(sig_int, SIGINT);
Consider a code segment for a pipe (e.g., to run "ls | wc") as we discussed in the classes, shown below. What would it be the code segment for the "parent" process here after the fork but before exec (of "ls" or "wc")?
Close(pfd[0]); dup2(pfd[1], 1); close(pfd[1]);
Close(pfd[0]); dup2(pfd[1], 0); close(pfd[1]);
Close(pfd[1]); dup2(pfd[0], 1); close(pfd[0]);
Close(pfd[1]); dup2(pfd[0], 0); close(pfd[0]);
By convention, UNIX System shells associate the file descriptor __ with the standard input of a process.
0
1
2
3
-1
Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. if (pid=fork()) {fork();} if (pid=fork()) {fork();} if (pid=fork()) {fork();}
8
9
16
27
32
By convention, all shells in Unix open ___ file descriptors whenever a new program is run.
0
1
2
3
4
As many as needed
Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. if (fork() < 0) {fork();}
1
2
3
4
0
After fork, the return value for the child is ___
-1
0
+1
A new process ID for the child process
The process id of the parent process
The new file descriptor returned by dup is guaranteed to be the ___ numbered available file descriptor
Lowest
Highest
Fixed
Stack
Arbitrary
Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. fork(); fork(); fork();
1
4
6
8
16
Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. If fork() fork();
1
2
3
4
0
After fork, the return value for the parent process is ___
-1
0
+1
Correct
The child process id
The process id of the parent process
___ is a type of file that points to another file.
Symbolic link
Directory file
FIFO
Pipe
Dupe
A file ___ is normally small non-negative integer that the kernel uses to identify the files accessed by a process.
Buffer
Table
Descriptor
I-node
Entry
A process may do ___ with the signal
Ignore the signal
Let the default action occur
Provide a function to handle the signal
All of the above
None of the above
For a convenience, ___ call is used to execute a command string (e.g., "ls -la | wc") within a program.
Thread
Process
Pipe
Fork
System
The ____ contains all the information about the file: the file type, the file's access permission bits, the size of the file, pointers to the file's data blocks, and so on.
Cylinder
Disk
File block
I-node
Dup
Signals provide a way of handling ___ events
Deadlocked
Racing
Asynchronous
Synchronous
Idle-process
___ will make a copy of the current process.
Spawn
Clone
Thread
Fork
Dup
{"name":"APUE7-8 Process2", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below. if (pid=fork() && pid2 = fork()) {fork();} if (pid=fork() && pid2 = fork()) {fork();} if (pid=fork() && pid2 = fork()) {fork();}, The new process created by fork is called the child process. This function is called once but returns ___., Given fork program as shown below, what would be the total number of processes at the end including the process running this program. for (i=1; i < nprocs; i++) { childpid = fork(); } When nprocs = 3, then the total number of processes after this code will be ____","img":"https://cdn.poll-maker.com/15-651323/pipeforkdup2exec1.png?sz=1200"}

More Quizzes

Welcome to the New Salem Bible Trivia contest - "Week 3 - New Testament People and Places"!     Match the person, place, or event from the New Testament with the correct response You will have 30 seconds to answer each question and you will only have one chance to answer the questions correctly.   We will post the winners each week and will keep a tabulation of scores throughout the summer. The top 3 scorers will receive awesome prizes at the end of the summer.    Please participate each week, do your best and have fun!
1680
SVES FamiliesPractice
210
Past tense - exercises
10518
Frog Embryology refers to the study of the development of frogs from the formation of the gametes to hatching of their offspring. Frog embryology has been studied extensively due to the similarities between the molecular and cellular processes of frog embryology and human embryology. One of the critical components of the frog egg is its yolk distribution, which plays a crucial role in the development of the organism. Frog egg has a moderate amount of yolk (mesolecithal) distributed unequivocally within the egg with the vegetal pole having more yolk than the animal pole. The upper hemisphere of the egg — the animal pole — is dark. The lower hemisphere — the vegetal pole — is light. Frog embryology is a complex process of fertilization, cleavage and gastrulation that leads to the formation of an adult frog
1050
Test Your Canon Camera Components Knowledge with Free
201031359
Ace SHSAT Math: Free Online Practice Test - Start Now
201027457
ATA Tournament Points System: Score Your Skills
201083948
Sun or Moon: Discover Your Celestial Side Now!
201029580
Which Electron Configuration Violates Hund's Rule? Test Now
201028623
Free Aphmau: Who's Your MyStreet Boyfriend?
201028933
Which Twilight Guy: Discover Your Perfect Match
201023950
Choral Methods for Secondary Ensembles
15828623
Make your own Survey
- it's free to start.