Fork function

Assignment Help Basic Computer Science
Reference no: EM1380804

Create a C program that takes an integer argument from the command line and outputs sum of all digits of the integer. For example, the result of the invocation sum of digits 12345 should be fifteen.

The program has two constraints:

Question1) Each process can do at most one addition. If you want to calculate the sum of more than two digits, you will have to fork one or more processes in order to do that, and each of the forked processes in turn can process at most one more addition before forking further more process(es) to compute the sum.

Question2) Each process can fork at most one other process.

 

Reference no: EM1380804

Questions Cloud

Question about compiler theory : Determine some common compilers available? Based on regular expressions, can all input be validated if it is correct, or not, based on compilation?
Basic forms of conducting international business : Discuss the basic forms of conducting international business, and basic international business strategies.
Demonstrate the effect of zero-padding : Write a programs in Matlab to demonstrate the effect of zero-padding and filtering the DC-component in the frequency domain.
Atr does not produce a competitive product : If Weiss adds a new plant addition and ATR does not produce a competitive product, Weiss expects a profit of $600,000; if ATR does not compete for this market
Fork function : Create a C program that takes an integer argument from the command line and outputs sum of all digits of the integer. For example, the result of the invocation sum of digits 12345 should be fifteen.
Japanese plans for expansion in east asia : What steps did he propose to avoid this danger? How did Prince Konoe's fears foreshadow the later "Reverse Course" of the US Occupation and How did the victory contribute to Japanese plans for expansion in East Asia?
Identify and analyze the perceived and real benefits : Relative advantage is the degree to which a new technology is perceived to be superior to current technology. An company is more likely to adopt new technology when it perceives greater relative benefit compared to current technology.
Estimate the marginal return : Estimating the Marginal Return to Schooling Suppose Carl's wage-schooling locus is given by the following schedule and Human Capital Investment
Calculation for programming and machine independency : Assume f is a function that returns the result of reversing string of symbols given as its input, and g is a function that returns concatenation of the 2-strings given as its input. If x is the string abcd,

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Why is internet an attractive marketing arena for business

One B2B marketer used a lot of silliness to increase its Web traffic tenfold and generate thousands of sales leads starting. Why is the Internet such an attractive marketing arena for businesses?

  Explaining slash dotted and flash crowd

What do terms slash dotted and flash crowd signify to?

  Example of weighted directed grap with weight function

Provide an example of weighted directed graph G = (V, E) with weight function ω:E→R and source vertex s such that G satisfies following property.

  How can laser be tipped before light no longer continues

If a laser is to be pointed into the end of the fibre, but is "tipped" to one side by θ degrees, how much can the laser be "tipped" before the light no longer continues down the fibre?

  How many instructions can the processor execute

Assume that we are working on a workstation with an instruction rate of 500 MIPS. How many instructions can the processor execute between the receipt of each individual bit of the message?

  Faulty terminations and excessive horizontal wiring spans

What do you consider the single most important reason to pay attention to faulty terminations and excessive horizontal wiring spans?

  Illsutrate how bound seem realistic

Sufficient to assure with 90% confidence that the learned perceptron will have true error of at most 5%. Does this bound seem realistic?

  Advantage and disadvantage of using word to work in graphics

Identify the advantages and disadvantages of using Word to work with graphics, tables, and special formatting functionality. Provide specific examples.

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

  Executing critical section in mutual exclusion protocol

In Lamport's mutual exclusion protocol, if process i is implementing critical section.

  Enforcing mandatory access control environment

Users dont seem to understand that they need to handle certain documents with more care and control than others. Which of the following will improve this situation?

  Determine integer to divide maximum number of partial sums

Now, given sequence, can you determine the integer M (L ≤ M ≤ U) which divides maximum number of partial sums of the sequence?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd