49.7k views
4 votes
Consider a text editor that saves a file whenever you click a save button. Suppose that when you press the button, the editor simply (1) animates the button "down" event (e.g., by coloring the button grey), (2) uses the write() system call to write your text to your file, and then (3) animates the button "up" event (e.g., by coloring the button white). What bad thing could happen if a user edits a file, saves it, and then turns off her machine by flipping the power switch (rather than shutting the machine down cleanly)

1 Answer

3 votes

Answer:

The answer to this question can be defined as follows:

Step-by-step explanation:

  • The write() method guarantees you to updates the memory of both the kernel, and may not ensure which updates were flushed through stable storage.
  • Unless the client instead switches on either the monitor but views the file, it displays the file, to combines from older and newer versions will be shown.
  • The very first two cases will be deemed "bad" because the user probably can not expect them after completing the save.
User Thibault Dumas
by
3.6k points