Skip to content

nyu-cs201-s17/recitation13-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Recitation 13: Solutions

Fork & Signals

Question 1

Outputs:

  • 32040 - This is a possible output.
  • 34002 - N
  • 30402 - Y
  • 23040 - Y
  • 40302 - N

As long as 30 is printed before 40, the output is possible. The 2 can be pretty much anywhere.

Question 2

Answers:

Part I

  • 1 - 10 times
  • 2 - The value is 1
  • 3 - The value is 2

Part II

counter = 1

counter = 3

counter = 3

Part III

  • 1 - No, it is different
  • 2 - counter = 1,2,3,4,5 (1 is also possible - this would happen if all child processes termintated before the control was returned to the parent process; when the parent process runs the handler, the value is incremented to 1 and then no more child processes would terminate to cause the handler to run again)

Question 3

Output:

Hello 0 1 Bye 2 Bye

OR

Hello 1 0 Bye 2 Bye

Question 4

  • a) 8
  • b) 3
  • c) 5
  • d) counter = 2

Question 5

Answer: val = 15

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published