My sites / 21S-COMSCI111-1 / Site info / Final Exam Spring 2021 – Finals week
Spring 2021 – COM SCI111-1 – EYOLFSON
Information
Question 2
Not yet answered
Points out of 5.00
Threads (25 minutes).
Consider the following code:
#define NUM_THREADS 4
void* run(void*) {
fork();
printf(“Hello\n”);
}
int main() {
pthread_t threads[NUM_THREADS];
for (int i = 0; i < NUM_THREADS; ++i) {
pthread_create(&threads[i], NULL, &run, NULL);
}
for (int i = 0; i < NUM_THREADS; ++i) {
pthread_join(threads[i], NULL);
}
return 0;
}
Assume there's an existing process that begins execution at main.
How many new processes are created when the original process exits?
Answer:
https://ccle.ucla.edu/my/
https://ccle.ucla.edu/course/view.php?id=101241
https://ccle.ucla.edu/course/view.php?id=101241§ion=0
https://ccle.ucla.edu/mod/quiz/view.php?id=3983573
Question 3
Not yet answered
Points out of 5.00
Question 4
Not yet answered
Points out of 5.00
Can one of the new processes become a zombie? If so give an example.
Can one of the new processes become an orphan? If so give an example.
Question 5
Not yet answered
Points out of 10.00
How many times does ”Hello” get printed? and most importantly, why does ”Hello” get printed that many times?
More
◀ Midterm
Jump to...
Lab 1B Week 1 ▶
https://ccle.ucla.edu/mod/quiz/view.php?id=3875405&forceview=1
https://ccle.ucla.edu/mod/kalvidres/view.php?id=3834460&forceview=1