What is buffered output?


 
Thread Tools Search this Thread
Special Forums UNIX Desktop Questions & Answers What is buffered output?
# 1  
Old 08-18-2008
What is buffered output?

ie: man cat
....
- u The output is not buffered
# 2  
Old 08-18-2008
Writes bytes from the input file to standard
output without delay as each is read

that means normal cat without -u option first read the full file in sequence as it read it store it in buffer and display the buffer one's its done..
with -u option you can avoid it
# 3  
Old 08-18-2008
it's like a standard exchange buffer in windows?
where can i poke around
# 4  
Old 08-18-2008
I don't know what a "standard exchange buffer in Windows" is but it seriously sounds like it's not at all the same thing.

With input/output buffering you have a cache of sorts between two devices. Say, a disk: the driver reads a sector of data into a buffer, then passes it to the program which displays it. You can not read a partial sector from the disk; at end of file, you get a partially filled buffer, and a flag which tells you how much of it is actually real data.

Line buffering works on lines instead of disk sectors. Line buffered I/O reads through the next newline, then passes on the buffer.

By running tail -f on a file which is slowly being written by another program, you can see block buffering in action. The output pauses in the middle of a line, then all of a sudden, after a longish wait, you get another burst of text as another buffer of multiple lines of output is completed and written out to disk (and then read and displayed by tail). cat -u prevents this behavior, and forces unbuffered output even if the output device would call for block-buffered or line-buffered output.

Unbuffered output is much less efficient, so unless you really need unbuffered output, go for buffered.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Command understanding the output file destination in case of standard output!!!!!

I ran the following command. cat abc.c > abc.c I got message the following message from command cat: cat: abc.c : input file is same as the output file How the command came to know of the destination file name as the command is sending output to standard file. (3 Replies)
Discussion started by: ravisingh
3 Replies

2. Shell Programming and Scripting

Displaying log file pattern output in tabular form output

Hi All, I have result log file which looks like this (below): from the content need to consolidate the result and put it in tabular form 1). Intercomponents Checking Passed: All Server are passed. ====================================================================== 2). OS version Checking... (9 Replies)
Discussion started by: Optimus81
9 Replies

3. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

4. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

5. UNIX for Dummies Questions & Answers

Difference between buffered disk reads and cached reads?

I was analyzing the Disk read using hdparm utility. This is what i got as a result. # hdparm -t /dev/sda /dev/sda: Timing buffered disk reads: 108 MB in 3.04 seconds = 35.51 MB/sec # hdparm -T /dev/sda /dev/sda: Timing cached reads: 3496 MB in 1.99 seconds = 1756.56 MB/sec... (1 Reply)
Discussion started by: pinga123
1 Replies

6. Shell Programming and Scripting

Perl's buffered I/O is causing me to miss latest log file entries in log colorizer. How to fix?

I've been finding myself using a log file colorizer written in perl to reformat and colorize the output from many different programs. Mainly, however, I use it to make the output from "tail -f" commands more readable. The base perl script I use is based on "colorlogs.pl" available from the... (1 Reply)
Discussion started by: rcsteiner
1 Replies

7. Programming

Why must flush all line-buffered output streams?

Hi, Mentioned in Stevens & Rago "Advanced Programming in the UNIX" I don't understand why must flush all line-buffered output streams when (a)an unbuffered or (b)a line-buffered stream require data from kernel? (2 Replies)
Discussion started by: Edward114
2 Replies

8. HP-UX

changing col(1) command stdout as fully buffered?

Hi All, I am talking about unix col(1) command used for some reverse line filtering etc. And I notice that the stdout of this command is line buffered i.e. the stdout will flush the data in its buffer line by line. So the number of writes performed by stdout are more. So now if I make stdout... (0 Replies)
Discussion started by: sunilsbjoshi
0 Replies

9. UNIX for Advanced & Expert Users

changing col(1) command stdout as fully buffered?

Hi All, I am talking about unix col(1) command used for some reverse line filtering etc. And I notice that the stdout of this command is line buffered i.e. the stdout will flush the data in its buffer line by line. So the number of writes performed by stdout are more. So now if I make stdout... (0 Replies)
Discussion started by: sunilsbjoshi
0 Replies

10. Shell Programming and Scripting

Help capturing and reformatting buffered and unbuffered output

Ok, so I have a shell script which runs a specific command, and that command sends it's output to the display. At certain times, the command sends buffered output, and at other times, the command sends unbuffered output in the form of a % progress bar, so if I run the command, the output I receive... (0 Replies)
Discussion started by: vikingshelmut
0 Replies
Login or Register to Ask a Question