Write a shell script that produces a file of sequential numbers by reading the last number in

Question:

Write a shell script that produces a file of sequential numbers by reading the last number in the file, adding 1 to it, and then appending it to the file. Run one instance of the script in the background and one in the foreground, each accessing the same file. How long does it take before a race condition manifests itself? What is the critical region? Modify the script to prevent the race.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Modern Operating Systems

ISBN: 978-0133591620

4th edition

Authors: Andrew S. Tanenbaum, Herbert Bos

Question Posted: