Multithreading

Multithreading

Improve my multithreading example as follows:

(for both, reader and writer):

  1. While not available do:
    Enter the sleep modeWake and check the resources</code></pre></li>

End:

  1. Acquire the lock on the resourece
  2. Check if still available (It may be taken from you in the process between you checked for the resources and tried to set the lock
    Think what you do if that becomes inavailable.
  3. Read/write the file
  4. Do not forget to properly clean up after yourself: In my code I did not close the file; that is an error, esp in this app.
  5. Release the lock
  6. Done with the thread.

Main should wait for both threads to complete, and output some status message.

Edit question’s body

The post Multithreading appeared first on cheapcustomwriting.com.

Looking for this or a Similar Assignment? Click below to Place your Order Instantly!

Scroll to Top