anyone have an idea or can explain the question better ?

This is an assignment from school. However, I cannot understand it. Can anyone explain it in a better way? Or can someone say what they understand in this question.

This program will create several timer servers (preferably 5) when it starts. All these timer servers (threads) constitute a server pool. In the front-end, a user will input timer requests in the unit of second along with a timer ID. All such requests will be stored in a request queue. If there is any timer server available in the pool (i.e. not full), that server should service one request and delete it from the request list. The timer server will count down and print out a message every second until the time counter reaches zero. The front-end will accept user input until the request queue buffer is full.


  1. When it starts, the program will create m threads as a timer server pool to serve the user request.

  2. A front-end should be always ready to accept input from a user if the request queue buffer is not full (buffer size is n).

  3. Each timer server should get one request from the queue and serve it according to the priority. When a timer server is available, it should select the request with highest priority in the queue and run it.

  4. To read one request from the list takes t second, e.g. sleep t second before a timer server leaves the critical section. After a timer server starts to service for a specific user request, it should delete that request from the queue.

  5. Timer servers in the pool can’t access the request list at the same time (i.e. accessing the request list is a critical section). Hint: Use pthread_mutex_lock and pthread_mutex_unlock.

  6. The front-end and the timer server may access the request queue at the same time. When one timer server is reading a user request from the request queue, the front-end can write a new request into this queue at the same time (i.e. one reader and one writer can access the request list at the same time since they really never access the same slot or pointer).

  7. Each timer server will print out some message to a file every second until it finishes.

Program this shouldn’t be hard. However, not understand it cannot program it.

After reading this post 3 times, I realize I don’t understand what you want to do.

In your mind, what is a timer server? You said “When a timer server is available, it should select the request with highest priority in the queue and run it”. But run what?

See the way I see it (which is why I suspect I don’t understand what you want or need to acheive) there is no need for “timer server”. OS provides timer services through Posix timers.

Unless you are looking to build a framework to start to process based on time?

Being “an assignment”, it looks like stken99 either didn’t pay attention in class, or just didn’t go, and now has no idea what to do, and is looking for an easy way out. Seems like some hard studying and research would solve the problem. At least get started and run into roadblocks before asking for help on something like this.

I hope his teacher is reading this forum :slight_smile:

Slap him hard Mitch ;-)

U know, since question 5 includes a hint, it looks like our friend just posted his homework in the hope that somebody else would do it for him.

As somebody else noted, he should try to do it before asking for help, and if he can’t invoke the compiler, or at least an editor, he should drop the class.

It’s almost as if he cut and paste his assigment -)