- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- program in background and foreground
Operating System - HP-UX
1821638
Members
3127
Online
109633
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 11:32 PM
тАО02-02-2004 11:32 PM
program in background and foreground
Hi,
What is the difference between running a program (a shell script or an executable) in the background versus in the foreground? It would be good to know all the technicalities involved.
In our case we are facing a major problem where a client gets an unknown exception(sometime even hang) when the server program is run in foreground and everything works when the server program is run in the background.
Client is an RPC client and we have an HP DCE RPC only configuration.
thanx in advance
What is the difference between running a program (a shell script or an executable) in the background versus in the foreground? It would be good to know all the technicalities involved.
In our case we are facing a major problem where a client gets an unknown exception(sometime even hang) when the server program is run in foreground and everything works when the server program is run in the background.
Client is an RPC client and we have an HP DCE RPC only configuration.
thanx in advance
never give up
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2004 11:44 PM
тАО02-02-2004 11:44 PM
Re: program in background and foreground
For unix, there is no real difference between both modes of a proces. But sometimes a shell sends signals to processes running in foreground when a user does something (think off the ^Z in ksh, for instance, or a ^C in most shells). Per default it is best to run a daemon in background or have the daemon itself force this by starting with a fork and exiting the main process.
Every problem has at least one solution. Only some solutions are harder to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2004 12:07 AM
тАО02-03-2004 12:07 AM
Re: program in background and foreground
Ravi,
A process run in the background is only one in which the shell doesn't wait for the execution to finish. As far am I am aware, that is the only difference apart from the fact that processes running in the background, by default, stop if they attempt to read from the terminal.
What exactly do you mean by running it in the foregorund? Do you mean that if you start the application from the shell it just sits there and everntually starts to experience problems or do you mean that "cron" or startup scripts start it and it only works nice if you put a "&" at the end of the command.
A process run in the background is only one in which the shell doesn't wait for the execution to finish. As far am I am aware, that is the only difference apart from the fact that processes running in the background, by default, stop if they attempt to read from the terminal.
What exactly do you mean by running it in the foregorund? Do you mean that if you start the application from the shell it just sits there and everntually starts to experience problems or do you mean that "cron" or startup scripts start it and it only works nice if you put a "&" at the end of the command.
Never preceed any demonstration with anything more predictive than "watch this"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2004 03:11 AM
тАО02-04-2004 03:11 AM
Re: program in background and foreground
Different people attach different meaning to foreground and background, so "your mileage may vary".
Shells such as posix shell will put background jobs in a different process group. That is discussed in "man setsid", "man setpgid", and "man termio". Processes in a background process group can't read from the controlling terminal. They may also be prevented from writing to the controlling terminal. Only the processes in the foreground process group receive termio signals such as SIGINT and SIGTSTP.
Shells often reduce the priority of background processes by using nice(). See "man 2 nice". That could affect the timing of operations in a troubled program. A coding error could cause a problem when an application runs more quickly, attempting to use some resource before it is ready.
Shells such as posix shell will put background jobs in a different process group. That is discussed in "man setsid", "man setpgid", and "man termio". Processes in a background process group can't read from the controlling terminal. They may also be prevented from writing to the controlling terminal. Only the processes in the foreground process group receive termio signals such as SIGINT and SIGTSTP.
Shells often reduce the priority of background processes by using nice(). See "man 2 nice". That could affect the timing of operations in a troubled program. A coding error could cause a problem when an application runs more quickly, attempting to use some resource before it is ready.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP