mersenneforum.org  

Go Back   mersenneforum.org > Other Stuff > Archived Projects > NFSNET Discussion

 
 
Thread Tools
Old 2003-08-28, 22:12   #1
dsouza123
 
dsouza123's Avatar
 
Sep 2002

2×331 Posts
Default What is the & for in nfsnetclient &

In the text file UsingCommandLine.txt it gives an example
of a the command to to start the nfsnet program and has
an & after the program name.
What is the & for ?
Is it needed ?
I don't always use it and the program works,
I haven't noticed any difference with or without it.

Or is it just a stray character ?

--==from the text file==--
=======================================
Stopping and Starting the NFSNET Client
=======================================

You start the siever client with the command
./nfsnetclient &
and stop it by creating the file called stop.txt
in the NFSNET/processors/p0/ folder.

--==from the text file==--
dsouza123 is offline  
Old 2003-08-28, 22:16   #2
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

8,167 Posts
Default

The "&" puts the program into the background so you get the prompt back...

I like to run with...

nohup ./program &

Which keeps the program alive even if you log out accidently...

You can also start the program without the "&", and if you are using the Bash shell hit CTRL+Z to suspend it and then "bg" to move it into the background... To bring it back to the foreground type "fg"...
Xyzzy is offline  
Old 2003-08-28, 22:23   #3
Wacky
 
Wacky's Avatar
 
Jun 2003
The Texas Hill Country

21018 Posts
Default Re: What is the & for in nfsnetclient &

Quote:
Originally Posted by dsouza123
What is the & for ?
Is it needed ?
You should read the manual about the shell (csh, bash, etc.)

Normally, when a command is started, the shell "hangs" while it waits for the command to execute. (Synchronous execution) When the comand completes, you get the next command prompt.

The "&" tells the shell to run the command asynchronously. The shell starts the command and then immediately returns to give you the next prompt for another command.

Such asynchronous execution is appropriate because the siever runs for a very long time and you might wish to use the shell while if is running. In particular, you should not kill the siever with Ctrl-C (or equivalent) but rather by creating the "stop.txt" file. Having the shell ready and waiting is appropriate.
Wacky is offline  
Old 2003-08-28, 22:54   #4
dsouza123
 
dsouza123's Avatar
 
Sep 2002

29616 Posts
Default

Under Win98SE it doesn't seem to make a difference.
I usually start a windowed DOS prompt.
Go to C:\NFSNET
nfsnetclient
it takes over the DOS prompt until stop.txt is created.

The nfsnetclient.exe always starts a second program linesiever.exe
so there are 3 programs running

WINOA386.MOD the name for the DOS prompt
NFSNETCLIENT.EXE
LINESIEVER.EXE

Only the linesiever uses any significant amount of CPU time.
It's priority seems the same either way process idle 4, thread idle 1

If the DOS prompt is minimized it doesn't affect it.

linesiever and nfsnetclient are 32 bit windows console programs.

I'll have to try the other way using the desktop shortcut to the nfsnetclient.exe to see if the priority changes or if there is any other
discernable difference.

nohup doesn't seem to be part of W98SE
maybe it is a port of a *NIX utility in other versions of windows.

Just like the touch mentioned in UsingCommandLine.txt
touch ./processors/p0/stop.txt

I wrote a 2K program in Delphi ( NFS_STOPNOW ) to create the stop.txt file. Wrote another one ( NFS_ALLOW ) to delete it.
And a third in MASM ( NFS_STOPDONE ) to create the stop.txt immediately after it completes the assignment, but before it can request a new one.
dsouza123 is offline  
Old 2003-08-28, 23:01   #5
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

8,167 Posts
Default

Yes, "&", "nohup" and "touch" are Unix commands...

If you want them on Windows, visit here...

http://www.cygwin.com/
Xyzzy is offline  
 

Thread Tools


All times are UTC. The time now is 17:30.

Sat May 15 17:30:42 UTC 2021 up 37 days, 12:11, 0 users, load averages: 2.59, 2.11, 2.01

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.