For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > September 2004 > Buffer of stdio and pty









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Buffer of stdio and pty
cherico

2004-09-19, 3:58 pm

IIRC, stdio is full buffered and pseudo-terminal is line-buffered.

When a process calls pty_fork() to spawn a child process, they
communicate through line-buffered pseudo-terminal and both the stdio
descriptors of the child process are associated with the pty.

My question is:

If stdio is full-buffered, does the pty's line-buffered policy help
with deadlocks?

full-buffered stdio + line-buffered pty = full-buffered foo?

It that right?
Rich Teer

2004-09-19, 8:58 pm

On Sun, 19 Sep 2004, cherico wrote:

> IIRC, stdio is full buffered and pseudo-terminal is line-buffered.


It's not that simple. It depends which I/O stream you're talking
about, and what it's connected to.

> When a process calls pty_fork() to spawn a child process, they
> communicate through line-buffered pseudo-terminal and both the stdio
> descriptors of the child process are associated with the pty.


Which version of pty_fork? It's not a standard function.

> If stdio is full-buffered, does the pty's line-buffered policy help
> with deadlocks?
>
> full-buffered stdio + line-buffered pty = full-buffered foo?


There's some discussion of this in my book, Solaris Systems
Programming. But yes, a pty can be used to avoid deadlock
between coprocesses that use standard I/O.

HTH,

--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming",
published in August 2004.

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
Jonathan Adams

2004-09-19, 8:58 pm

In article <afc115ec.0409191056.6539b193@posting.google.com>,
cherico@bonbon.net (cherico) wrote:

> IIRC, stdio is full buffered and pseudo-terminal is line-buffered.
>
> When a process calls pty_fork() to spawn a child process, they
> communicate through line-buffered pseudo-terminal and both the stdio
> descriptors of the child process are associated with the pty.


It's polite to give background information or code for any non-system
provided routines. My system doesn't provide pty_fork().

> My question is:
>
> If stdio is full-buffered, does the pty's line-buffered policy help
> with deadlocks?
>
> full-buffered stdio + line-buffered pty = full-buffered foo?
>
> It that right?


No. You might consider reading stdio(3) in full. And think about what
you mean by "line-buffered pty".

Cheers,
- jonathan
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com