What is a flush? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is a flush?

26th Jun 2020, 9:58 AM
Carlos
Carlos - avatar
13 Answers
+ 3
It is a construct to minimize traffic between layers. So uday kiran told you that not every key is directly sent to program but first gathered and transported on demand. That idea is used in different contexts. Especially in graphics programmming not each change is sent to front end. That would lead to very high traffic between backend and front end. All changes go to front end on flush. Also in real life: If u buy on Amazon u dont directly buy each single item but put it into a basket. Only if you click buy, you buy all your basket. That buy click is similiar to flush.
26th Jun 2020, 11:10 AM
Oma Falk
Oma Falk - avatar
+ 4
Oma Falk 10 Real-life examples of flushing. Note last one is optional to look. 1. People gathering at bus stop and get flushed in the bus when it arrives. 2. Storing your pocket money and flushing it when you want to buy something. 3. Flushing/throwing the garbage (gathered in house) all at once. 4. Gathering a lots of trust for a person, then flushing it all when that person turns against you. 5. Postponing holiday's homework and doing it on the last day. 6. Wasting your whole year at school and learning for exams on prior to the latter day. 7. [Science] Storing and releasing of potential energy in an elastic. 8. Freeing all your negative thoughts by meditation. 9. sys.stdout.flush() 10. Remember, how dinosaurs got flushed off from the universe. #11. Loo [Sorry, I really don't want to mention this๐Ÿ™๐Ÿ™๐Ÿ™]
26th Jun 2020, 11:57 AM
Carlos
Carlos - avatar
+ 3
Carlos great!!!! not all examples are completely fitting, but u got spirit of flush!
26th Jun 2020, 12:02 PM
Oma Falk
Oma Falk - avatar
+ 3
I wish to add that flushing a keyboard buffer, a data stream, or an interprocess communication pipe means to empty the queue without processing any pending data. An example would be the "Press any key to continue" prompt. Before showing the prompt, the program should flush any keypresses held in the keyboard buffer. Otherwise, the next key waiting in the queue will close the prompt immediately.
26th Jun 2020, 1:22 PM
Brian
Brian - avatar
+ 2
Carlos yes Sometimes hidden but....yes Brainteaser: Find 10 examples in real world๐Ÿ˜Ž
26th Jun 2020, 11:18 AM
Oma Falk
Oma Falk - avatar
+ 2
Carlos i forgot to mention, that the basket and any other buffer are cleared after flush. It seemed clear to me.
26th Jun 2020, 11:26 AM
Oma Falk
Oma Falk - avatar
+ 2
Intention of flush is to avoid traffic. 1,3,9 do it. Other examples are missing this aspect.
26th Jun 2020, 12:44 PM
Oma Falk
Oma Falk - avatar
+ 2
A bufferย flushย is the transfer of computer data from a temporary storage area to the computer's permanent memory. For instance if we make any changes in a file, the changes we see on one computer screen are stored temporarily in a buffer.
27th Jun 2020, 11:16 PM
LOKESH CHAUHAN
LOKESH CHAUHAN - avatar
+ 1
In c language we have function fflush(stdin); which removes the whatever buffer that is present in keyboard
26th Jun 2020, 10:41 AM
uday kiran
uday kiran - avatar
0
uday kiran keyboard????
26th Jun 2020, 10:43 AM
Carlos
Carlos - avatar
0
Oma Falk so flush is everywhere?
26th Jun 2020, 11:16 AM
Carlos
Carlos - avatar
0
Oma Falk can you point out the errors?
26th Jun 2020, 12:06 PM
Carlos
Carlos - avatar