Discussion:
Shell display for background processes
(too old to reply)
cs412017
2005-09-16 00:30:35 UTC
Permalink
Hi,
In discussion one of the slides said to not wait on a background
process to complete in shell.c. However, when we do not wait for a
background process, say for example b.exe to complete before passing
control back to the shell, then the shell could display the "$" prompt
before the newly spawned background process finishes executing. In the
case of b.exe, this looks rather ugly with the shell just waiting for
user input on a blank line as the $ sign is displayed somewhere in the
middle of the output for b.exe.
Is this okay?
c***@CSIC.UMD.EDU
2005-09-16 02:18:19 UTC
Permalink
are we not suppose to wait on any background processs or just
those background processes that have been spawned by the process
that is trying to wait ?
cs412017
2005-09-17 00:11:21 UTC
Permalink
Post by c***@CSIC.UMD.EDU
are we not suppose to wait on any background processs or just
those background processes that have been spawned by the process
that is trying to wait ?
Quote from Project 1 Description: "A parent process will not be able to
Wait on any process it spawns in the background; the Sys_Wait system
call will return -1 in this case"
c***@CSIC.UMD.EDU
2005-09-17 00:16:06 UTC
Permalink
Yeah it says, the parent process will not be able to wait on any background
process that "it" spawns, the question was whether it should be able to wait on
background processes that are not spawned by it.

But on closely looking at the code, i think such a situation will not be possible
as of now in geekos.
Iulian Neamtiu
2005-09-17 04:37:51 UTC
Permalink
Post by cs412017
Hi,
In discussion one of the slides said to not wait on a background
process to complete in shell.c. However, when we do not wait for a
background process, say for example b.exe to complete before passing
control back to the shell, then the shell could display the "$" prompt
before the newly spawned background process finishes executing. In the
case of b.exe, this looks rather ugly with the shell just waiting for
user input on a blank line as the $ sign is displayed somewhere in the
middle of the output for b.exe.
Is this okay?
Yes, that's okay, you get intermixed output in Unix as well. The shell
and the background process are sharing the terminal, so that 'ugly'
output is normal.

You can hit <ENTER> in the shell and then it'll go to a new line.

Iulian

Loading...