lundi 28 décembre 2020

Mutex Functionality for Networked Hardware

I have a network-accessible hardware resource in my lab. Various pieces of software want to use this single resource for testing, experiments, etc. The hardware does not support "concurrent" users. Because of this, I need to make sure only one application is accessing it at a time and is not interrupted by another application (so state is maintained on the hardware).

If this were purely a software problem, I might look to implementing a Mutex to get this mutually-exclusive access control implemented. However, I cannot seem to find a multi-application, networkable solution.

For clarity, the general setup is this:

  • Hardware Asset, Application 1, and Application 2 exist at three different locations on the same network.
  • Application 1 and 2 are implemented using different (arbitrary) programming languages (consider C++ and Python) but both wish to interact with Hardware.
  • Application 1 and 2 are running on different computers under different operating systems.
  • "Hardware" is provided by a third party. It has an API but is otherwise a black box that I have no ability to modify.

For clarity, the workflow would ideally be:

  • Application 1 acquires a mutex for the Hardware over the network.
  • Application 1 holds the mutex and begins doing work.
  • Application 2 queues up over the network for the hardware mutex, but it is not yet available.
  • Application 1 finishes its work (perhaps a few minutes to a few hours later) and releases the Mutex.
  • Application 2 acquires the Mutex and begins its work.

(I don't have any specific requirements for notification vs. polling when it comes to acquiring a Mutex.)

I do not want to reinvent the wheel, but I'm also afraid I don't know what this type of Mutex control is called. I could see a helper-application doing the work here and blocking access by other applications as well. Any help here would be appreciated.

Aucun commentaire:

Enregistrer un commentaire