7. Consider the following code segment: (10pts) pid t pid; pid = fork(); if (pid == 0) { /* child process */ fork(); thread create( . . .); } fork(); (15pts) a. How many unique processes are created? b. How many unique threads are created?

Respuesta :

Answer:

The answer to this question can be defined as below:

a) Number of unique process is 6.

b) Number of unique thread is 2.

Explanation:

In the given code, an if condition statement and a thread creation method is declared, where 6 unique process and 2 unique thread is used, which can be described as follows:

  • A thread is a short form of an execution thread. It is a way of a program, that divide into more or then running functions at once.  
  • The process, which is also known as a method is the instance of a program, that controls more than one threads. It includes the code and the operation of the program.

ACCESS MORE