write a code for a program in which the parent had to ask from user that how many child user wants to create and then it should fork that many Childs?

Answers

Answer 1

Answer:

//same program different code

#include<stdio.h>

#include<unistd.h>

#include<stdlib.h>

int main()

{

   int pid;

   pid=fork();

   if(pid<0)

   {

       printf("\n Error ");

       exit(1);

   }

   else if(pid==0)

   {

       printf("\n Hello I am the child process ");

       printf("\n My pid is %d ",getpid());

       exit(0);

   }

   else

   {

       printf("\n Hello I am the parent process ");

       printf("\n My actual pid is %d \n ",getpid());

       exit(1);

   }

}

Explanation:

Answer 2

Following are the program to the given question:

Program Explanation:

Include header file.Defining the main method.Defining an integer variable "n, i", after defining this use "n" to the input value.In the next step, a loop is declared that uses if block that checks fork value equal to 0, in which it calls the sleep method and prints its value.At the last, it calls the wait method.  

Program:

#include<stdio.h>//header file

#include<sys/types.h>

#include<sys/wait.h>

#include<unistd.h>

int main()//defining the main method

{

   int n,i;//defining an integer variable

   printf("Enter the number of child to be created:"); //print message

   scanf("%d", &n);//input value in n

   for(i=0;i<n;i++) // defining a loop that use if block with the frok method to print value  

   {

       if(fork() == 0)//use if that check fork method value equal to 0

       {

           sleep(3);//calling sleep method

           printf("[child] pid %d from [parent] pid %d\n",getpid(),getppid());//print message

       }

   }

   wait(NULL);//calling wait method

   return 0;

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/17925458

Write A Code For A Program In Which The Parent Had To Ask From User That How Many Child User Wants To

Related Questions

Write an algorithm to output half the value for each of the five even numbers ​

Answers

There are some steps with the help of which we can easily find the output half of the value for each of 5 even numbers.

Such steps are provided below:

Step 1:

Start

Step 2:

Declare three variables such as "temp1", "temp2", "count".

Step 3:

Initialize

the count variable to zero (0), i.e., [tex]count \leftarrow 0[/tex] and

the temp variable to zero (0), i.e., [tex]temp \leftarrow 0[/tex]

Step 4:

Repeat the steps until the count will be 5 (count < 5)

[tex]temp1 = temp1+2;[/tex][tex]temp2=temp\frac{1}{2};[/tex][tex]print \ 'temp2';[/tex][tex]count \leftarrow count+1;[/tex]

Step 5:

Stop

Lean more about algorithm here:

https://brainly.com/question/14432459

In a file called amortizedAnalysis.pdf, please provide answers to the following questions: How many cost units are spent in the entire process of performing 40 consecutive append operations on an empty array which starts out at capacity 5, assuming that the array will double in capacity each time a new item is added to an already full dynamic array

Answers

Answer:

a

Explanation:

sdfghj

The word “computer” has become associated with anything related to screens and keyboard. However, these are not the only parts that makes the computer function. The Central processing unit is often referred to as the brain of the computer which practically coordinates all the activities in the computer. Briefly describe the operation of the Central Processing Unit with emphasis on its sub components.

Answers

Explanation: The CPU is the main control chip which calculates what has to be done in order for your computer to function.

(Very interesting question you had. Hope this answer helps)

You are the IT administrator for a small corporate network. You have recently experienced some problems with devices on the workstation in the Support Office. In this lab, your task is use Device Manager to complete the following:______.
The new network card you installed isn't working as expected (speed is only 1 Mbps). Until you can figure out what the problem is, disable the Broadcom network adapter and enable the Realtek network adapter. To make sure the network adapter has the latest drivers, update the driver for the Realtek network adapter by searching Microsoft Update. You recently updated the driver for your video card. However, the system experiences periodic crashes that you suspect are caused by the new driver. Roll back the driver to a previous version. Move the Ethernet cable to the integrated network port on the motherboard.

Answers

Answer:

I will fix it by my mind by thinking

Based on the above scenario, the steps to take is given below\

What is the management about?

The first thing is to Right-click Start and click on Device Manager and then you expand Network adapters.

Later you Disable the network adapter  and then Update the driver .

Learn more about Ethernet from

https://brainly.com/question/1637942

#SPJ2

Write a C++ function using recursion that returns the Greatest Common Divisor of two integers. The greatest common divisor (gcd) of two integers, which are not zero, is the largest positive integer that divides each of the integers. For example, the god of 8 and 12 is 4.

Answers

Answer:

The function is as follows:

int gcd(int num1, int num2){

   if (num2 != 0){

      return gcd(num2, num1 % num2);}

   else {

      return num1;}

}

Explanation:

This defines the function

int gcd(int num1, int num2){

This is repeated while num2 is not 2

   if (num2 != 0){

This calls the function recursively

      return gcd(num2, num1 % num2);}

When num2 is 0

   else {

This returns the num1 as the gcd

      return num1;}

}


Which of the following is not a data visualization technique?

Answers

Answer:

Normalization

Explanation:

From the options given :

Boxplot is a data visualization techniqye used for representing numerical data in the form of a box such that it adequately conveys the five number summary if the dataset which are the minimum, maximum, lower quartile, median and upper quartile, it also depicts the presence of outlines.

Scatter plot are used depict the relationship between two variables on the x and y axis of a graph. Each point is a representation of the (x, y) value pairs of the observation.

Tag clouds are usually used to represent word, metatdata and other free form text using different colors and font sizes to give information about the data.

Normalization is the odd option out as it is used to restructure data in other to promote integrity of data.

An integer is said to be a perfect number if the sum of its divisors, including 1 (but not the number itself), is equal to the number.

a. True
b. False

Answers

true

explanation: bc it is

The Federal Financial Institutions Examination Council (FFIEC) developed the Cybersecurity Assessment Tool, which can be used as a self-assessment tool for identifying a bank or financial institution's cybersecurity maturity.
a. True
b. False

Answers

Answer:

a. True

Explanation:

Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.

The Federal Financial Institutions Examination Council (FFIEC) is an interagency of government that was established on the 10th of March, 1979. FFIEC is saddled with the responsibility of developing the Cybersecurity Assessment Tool, which is then used as a self-assessment tool for identifying the maturity of a bank's or financial institution's cybersecurity.

What is the definition of: a computer network? data communications? telecommunications? a local area network? a personal area network? a metropolitan area network a wide area network? network management? convergence? g

Answers

Answer:

The answer is below

Explanation:

1. Computer Network: this is a system of interconnection of computers and computing devices that utilizes wires or radio waves over certain reachable locations.

2. Telecommunications: this is known to be the system or combination of telephones device and networks that transmit telephone signals.

3. A local area network: often referred to as LAN, is a system of networks that covers a smaller area usually within a room, floor, building, or campus.

4. Personal area network: often referred to as PAN, this is a network that covers few distances, usually between wireless devices like PDAs, laptops, and other devices.

5. Metropolitan area network: often referred to as MAN, this is a system of the network that serves quite a larger area, usually between that serve an area of 1 to 30 miles radius. For example, a typical city.

6. Wide area network: often referred to as WAN, this is a system of a large network that covers a large area such as parts of states, many states, countries, and the world at large.

7. Network management: this is defined to be a process of designing, installing, and supporting a computer network, such as computer hardware and software

8. Convergence: this is known to be a connection, combination, and integration of two or more computer technologies in a single device or system for operation.

g Add a throw statement to the processNumbers function that throws the message "An element in the list is not a number." if one of the elements in toProcess is not a number. Hint: The function isNaN() returns true if the parameter is not a number.

Answers

Answer and Explanation:

function processNumbers(alist){

var Ourarray= new array(alist);

Ourarray.foreach(

if(isNaN()){

Console.log( "An element in the list is not a number."};

break;

}

}

processNumbers(alist)

From the above, we have defined a function that takes an array parameter(the following array variable will make sure of that). We test each element in the array using foreach array function. The for each function runs the if statement and if isNan is true for each of the elements in the array.

A choropleth map is used to
Group of answer choices

do a scatter plot.

show live satellite images.

present geographical regions in 3D.

present geographical regions coloured, shaded, or graded according to some variable.

Answers

4- present geographical regions colored, shaded, or graded according to some variable :)

In the home tab under the paragraph group of options what are you unable to do?

Answers

Im not sure what this is?? Maybe add a picture or more context! ❤️

cpp Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Ex: If the input is:

Answers

Answer:

#include <iostream>

int main() {

 // The length of the list

 int l;

 // The array containing the numbers

 int *list;

 // Threshold, last value in array

 int thresh;

 

 // Read in first value and create an array with the size of that value

 scanf("%d", &l);

 list = (int*) malloc(l * sizeof(int));

 

 for(int i = 0; i < l; i++) {

   scanf("%d", &list[i]);

 }

 thresh = list[l - 1];

 // Print the values

 for(int i = 0; i < l - 1; i++) {

   if (list[i] <= thresh) {

     printf("%d ", list[i]);

   }

 }

 

 printf("\n");

 free(list);

}

Explanation:

The program assumes at least two values are provided. The length of the list and the threshold.

We first read in an integer, and find out how many more integers we need to read. We create an array with the appropriate size, and loop through to fill the array with values. We know the last value is the threshold, and so we do one more loop to compare the values in the array with the threshold.

correct single error in this. Try to appear relaxed, but not to relaxed​

Answers

Try to appear relaxed, but not to relaxed .

Write a Racket two-way selection structure that will produce a list '(1 2 3) when the first element of a list named a_lst is identical to the atom 'a and an empty list otherwise. Note that you are NOT required to write a function definition!

Answers

Answer:

A

Explanation:

The Curiosity Rover has recently landed on Mars and likes to send Twitter updates on its progress. If a tweet is posted 10 minutes after it was sent, how far is Curiosity from Earth? (Assume there is no network lag.)

Answers

Answer:

1.8 * 10^11 m

Explanation:

Given that :

Time taken for tweet to me posted after been sent, t = 10 minutes

t in seconds :

60 seconds = 1 minute

10 minutes = (10 * 60) = 600 seconds

Tweet sent will br transmitted at the speed of light, c = 3 * 10^8 m/s

Recall :

Speed = distance / time

Distance = speed * time

Distance of Curiosity from Earth = (3 * 10^8 * 600)

Distance of curiosity from earth = 1.8 * 10^11 m

2.
The force of impact is

Answers

Answer:

lực ( Tiếng Anh : force ) là bất kỳ ảnh hưởng nào làm một vật thể chịu sự thay đổi, hoặc là ảnh hưởng đến chuyển động, hướng của nó hay cấu trúc hình học của nó.

Explanation:

How does a Cloud-first strategy approach a client's migration to the Cloud?

Answers

Answer:

by focusing on a single discipline based on the client's greatest area need.

Uses of a computer load speaker

Answers

Answer:

A computer speaker is an output hardware device that connects to a computer to generate sound. The signal used to produce the sound that comes from a computer speaker is created by the computer's sound card.

I hope this will help you if not then sorry have a great day :)

Which Windows installation method requires the use of Windows deployment services (WDS)?
1. Network Installation
2. Repair Installation
3. Bootable flash drive installation
4. Unattended installation​

Answers

Answer:

1. Network Installation

Explanation:

Given

Options (1) to (4)

Required

Which requires WDS for installation

WDS are used for remote installations where users do not have to be physically present before installations can be done; in other words, it is necessary for network based installations.

Of all the given options, (a) is correct because without WDS, network installation cannot be done.

python is an example of a low level programming language true or false?​

Answers

False- python is an example of a high level language. Other high levels are c++, PHP, and Java

Essay on "Impact of Digitalization"​

Answers

Answer:

Digitization has a proven impact on reducing unemployment, improving quality of life, and boosting citizens' access to public services. Finally, digitization allows governments to operate with greater transparency and efficiency

Which is not a MARKETING impact of technology?

Social
Cultural
Economic
Environmental

Answers

Answer:

the answer is environmental

is a security design principle to direct the selection of control layers for an organization's computing enclave to ensure its resilience against various methods of attack. This also reduces the likelihood of a single point of failure in the security of the overall system.

Answers

Answer:

Defense in Depth (DiD).

Explanation:

Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.

Defense in Depth (DiD) can be defined as a concept or framework in cyber security that typically involves the process of layering multiple defensive mechanisms and security control throughout an information technology (IT) system, so as to prevent data theft or an unauthorized access to user data.

Basically, this cyber security technique is designed such that when a layer of the defensive mechanism fails, another security layer step in to mitigate and prevent the attack. Thus, it causes redundancy when an attacker exploits a vulnerability in a system, a breach of security or when one of the security layers fail.

Why use LinkedIn Sales Navigator?

Answers

Answer:

Salespeople and marketers waste tons of their time finding the right leads.

A lot of people think that LinkedIn Sales Navigator is only for advanced search but there are plenty of other perks as well. Its features and capabilities help you find the right people so you don’t waste your time and energy on manual searching.

Using sales navigator, you get access to a lot more features that are not present in the free version. You get limited searching with the free version.

With this LinkedIn automation tool, you can:

Search target audience with advanced filters Get recommendations for sales leads and track all the reports Use advanced filters anywhere else on the platform Get specific keyword mentions, job alerts, etc.

Write a program named lastname_firstname_cities.py that works with information about large cities. Your program will open the cities.txt downloadfile. Each line in the file has the name of a city, its country, and its population. The first few lines of the file look like this:

Answers

Answer and Explanation:

Open your text editor and open new file. Save new file file as lastname_firstname_cities.py. The program will open the file cities.txt downloadfile hence :

dfile= open(cities.txt, "r")

If we write this into our lastname_firstname_cities.py file it will open our cities.txt downloadfile in read mode and text mode(by default unless we specify binary mode which is for images)

Which of the given assertion methods will return true for the code given below? Student student1 = new Student(); Student student2 = new Student(); Student student3 = student1;
The Student class is as follows.
public class Student{
private String name;
}
a. assertEquals(student1, student2);
b. assertEquals(student1, student3);
c. assertSame(student 1, student3);
d. assertSame(student1, student2);

Answers

Answer:

The true statements are :

A. assertEquals(student1,student2)  

C. assertSame(student1,student3)

Explanation:

AssertEquals() asserts that the objects are equal, but assertSame() asserts that the passed two objects refer to the same object or not, if found same they return true, else return false.

Methods are collections of named code segments that are executed when evoked

The assertion method that will return true for the given code is: assertEquals(student1,student2)  

The code segment is given as:

Student student1 = new Student();

Student student2 = new Student();

Student student3 = student1;

In Java, the assertEquals() method returns true if two objects have equal values.

Assume student1 and student2 have equal values, the statement assertEquals(student1,student2) will return true

Read more about java methods at:

https://brainly.com/question/15969952

d. Which of the following computer has complex system? i. Hybrid computer ii. IBM computer iii. Mainframe computer iv. Analog computer​

Answers

Answer:

Hybrid computer has complex system

How many cost units are spent in the entire process of performing 40 consecutive append operations on an empty array which starts out at capacity 5, assuming that the array will grow by a constant 2 spaces each time a new item is added to an already full dynamic array

Answers

Answer:

Explanation:

260 cost units, Big O(n) complexity for a push

Explain how data structures and algorithms
are useful to the use of computers in
data management (10 marks)


Explain how data structure and uses of computer in data management

Answers

Answer:

Data management is a important tool for data handling.

Explanation:

A good knowledge about the data stricture and data management is a prerequisite for working with codes and algorithms. It helps to identify the techniques for designing the algorithms and data storage in the system. It helps to find out the data hierarchy. Thereby allowing the data management in an efficient and effective way. It can increase the skills in computer programming
Other Questions
Explain The Garden by Ezra Pounder Help!! What is a virus? What is an equation of the line that passes through the points (-6, 5) and (6, -7)?Plz answer plz help! ill give brainlyest to whoever gets this correct!Two carts move directly toward one another on an air track. Cart 1 has a mass of 0.35 kg and a speed of 1.2 m>s. Cart 2 has a mass of 0.61 kg and a speed of 0.85 m>s. What is the total momentum of the system, assuming that cart 1 moves in the positive direction? 10. The overall levels of income, employment, and prices are determined by the spending and production decisionsof all except which of the following.A. HouseholdsB. BusinessesC. GovernmentD. Foreign Sectors What is?..1. 8 4/7 divided by 15?2. How many 1/4-pound hamburgers can you make from 3 1/2 pounds of ground beef ?(In simplest form)3. 3 divided by 1 1/5 plus 1/3? (Evaluate the expression. Write the answer in simplest form.)4. 2/5 plus 2 1/6 divided by 5/6? (Evaluate the expression. Write the answer in simplest form.)5. 6 1/2 - 7/8 divided by 5 11/16? (Evaluate the expression. Write the answer in simplest form.)HURRYYYYYY PLEASEEEE. Alyssa has fifty-quarters and dimesShe has a total of $9.80How many dimes does she have?a.)32b.)30c.)20d.)18 Directions: Write two adjectives or descriptive phrases that describe the term.1. Abolition: 2. American Anti-Slavery Society:3. Elihu Embree:4. Angelina and Sarah Grimk:5. Frederick Douglass:6. Harriet Tubman:7. the Liberator:8. Underground Railroad:9. William Lloyd Garrison: Which characteristic of living organisms is similar to burning fuel in a car engine when asked to describe himself, sidd says that hes a younger brother, a son, and sometimes a good coder. sidd likely has a _____ self. One ward to tell what the sentence is about theA.complete subjectB.simple subject C.complete predicate D.simple predicate Simplify:(2/d^2)^3Please help :) Laura is training to run a race. She keeps track of the number of miles she runs. She has been training for 7 weeks, and she has run a total of 63 miles. At what rate has she been running, in miles per week? analyze why is scrooge happy at the end of the play What is meant by doing gender, and how does this both perpetuate gender roles and change them? What is shown in the diagram? (Refer attachment for diagram) The roots of the equation 0 = x^3+ 2x^2 3x are: _________. These are the x-intercept values at these points: _________. Caitlin is impulsive, has an unstable sense of self, and is intensely fearful of abandonment. She wants to have close relationships, but her emotions are often inappropriate and excessive with a pattern of self-destructiveness, chronic loneliness, and disruptive anger. Caitlin is suffering from __________ personality disorder. Which best describes the relationship between respiratory and circulatory system. Consider the equation 6 x 3 y = 9. Which equation, when graphed with the given equation, will form a system with infinitely many solutions? y 2 x = 3 y 2 x = 9 y = 2 x 3 y = negative 2 x 9.