1- 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. (Hint: use ln file [login to view URL] to lock the data file.)
(Threads must run concurrently, i.e. solutions spinning up a thread, let it do its work, and when it’s finished, spin up a new thread and repeat until finished will not receive credit.)
Hello Sir. I have 5 years of experience in development. This is a very easy task I am interested to work for you on this project. Just message me so that we can start
waiting for your positive response :)