Hi,
Firstly, forgive us for posting such noob question, we are still new at PHP/web development.

We are not sure what's the proper approach for the problem we are working on. Basically we are building a system where user could program their hardware board online: The user will upload their binary file straight to the hardware board, and they will get to see the result via the live video feed.

Our issue here is that we are not sure about how we should implement the resource allocation part for each user. We only have 1 board, but multiple/concurrent user accessing it.

Initially, we thought of allocating the resource based on the first come first serve basis (with queue), but we are not sure if we are heading towards the right direction:

1) We plan to add additional table in the database to keep track of the queue list of the resource.

2) Once a user request for the use of the resource, the PHP will check the database for the following condition: if there are any users in the queue list and if the resource is in use. If condition is true, then that particular user will be placed in the queue and a countdown timer will be shown so that the user will know the time left before they get to use that particular resource. If its false then, the current user will get the resource allocation.

We hope we could get some suggestion on this! Thanksss in advance

To run these kind of events consider to use Gearman, Beanstalkd or other work queues:

It enables you to perform parallel and background tasks in local or remote servers, and does not limit you to PHP, you can use Python or other supported languages. For example: the client in PHP, the worker in C.

The queues can be persistent and in that case will be logged to a database table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.