answersLogoWhite

0

Why output of fork command in unix varies?

Updated: 8/20/2019
User Avatar

Vijay496

Lvl 1
12y ago

Best Answer

Hi friends,

help me out

Generally If the call to fork() is executed successfully Unix will create identical copies address spaces and the execution starts from the next statement of the fork()

So, in such case

output of the following prog must be

#include<stdio.h>

{

printf("\nwelcome to");

fork();

printf("\nanswers.com");

}

O/P as per the theory:

------------

answers.com

welcome to

answers.com

but O/p coming is

welcome to

answers.com

welcome to

answers.com

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why output of fork command in unix varies?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a filter in Unix?

A Unix filter is a command pattern that allows the output of one command to be "piped" into the input of the next command. Commands like 'ls' which list a directory are not filters since they only generate output. Filter examples are grep, sed, sort, uniq, awk. Commands in Unix are usually filters unless they only create output, like 'ls', 'vi', etc.


What is the use of execute command in unix?

There is no traditional 'execute' command in Unix.


Define the term cat in unix?

'cat' is short for concatenation; it is a Unix utility program to print the contents of 1 or more files on the standard output. It is similar to the 'type' command in Windows.


Brief description of format command in unix?

There is no standard 'format' command in Unix.


What do CD command do in unix?

The 'CD' command is not standard for Unix. The 'cd' command, however, will change directories (folders). It is a means of navigating the Unix file system.


Why can't you run PHP from the command line?

There is no problems with running php from the command line be it unix or windows. However the output of the command will be to stdout in the form of HTML text output. This HTML output is infact what is displayed with formatting and graphics by a web browser. In addition php run by the webbrowser and from the command line maybe at different user privileges and display differently.


Which is the most commonly used command for referencing detailed information about a particular command in UNIX?

In Unix, use the 'man' command.


What is Tee Command in unix?

The Unix/Linux tee command permits the forking of a data pipe in a shell script or at the command line. The teecommand does this by both writing it's standard input to a file and to it's standard output simultaneously. Most implementations of tee provide for both file overwrite/creation and file appends by command line switch options.


How do you trim the output in unix?

It is difficult to answer the question without knowing "what" you want to trim. A common command would be 'cut' to cut out columns you don't want.


What is the Unix command to check to see who is logged in?

The "who" command.


What is the command to get the Unix version?

cat /proc/version The above answer will only work on certain systems. For most Unix systems, use the 'uname' command to get the Unix version. AIX uses the oslevel command.


Show the advantages of redirection with example in unix?

I/O Redirection is used when you don't want the output to go to the standard output location, e.g., the screen. It can be very helpful in capturing information to be used in a later process. For example, if the command 'ls' is used the output goes to the screen. But if the command 'ls &gt; ls.out' is used, then the ls command output will be redirected to a file called ls.out, which can be examined, edited, or used in a later process.