I wanted to implement it as part of an assignment. Anyways, I back off my last statement that there is no functionality to do a selective wake up. I could find a function called wake_up_process that takes a task_struct pointer and wakes up the corresponding process. All I am doing in my system call is just tracking which thread is calling on which character ( pseudo - semaphore) and which thread needs to be woke up.
Functions that I am using -
wait_event_interruptible () - to put a process / thread to sleep and also a condition which when made true, the slept process is woke up.
wake_up_process() - when passed a pointer of struct task_struct type wakes up that particular process.
I would share the code once my assignment's deadline is over. I think it is currently very limited to number of pseudo semaphores and not quite general.
Thanks for your comment.
Regards,
Onkar Deshpande
On Fri, May 1, 2009 at 2:31 AM, Daniel Baluta <daniel.baluta@xxxxxxxxx> wrote:
> Hi,
>
> I am writing a system call which is called as rendezvous_wait(). This system
> call is passed a character which would act as a kind of identifier. My
> application program will create threads and each thread will call
> rendezvous_wait with a character. Consider thread1 calls the system call
> passing x. Since it is the first one to call that system with parameter x,
> thread1 will be pushed on a wait list. i.e. kernel should force it to sleep.
> Whenever any other thread calls rendezvous_wait() with same parameter x,
> thread1 should be taken out from the wait queue and put on the run queue,
> which could later be scheduled by the scheduler. This system call is called
> as rendezvous_wait because it is much similar to meeting where one person
> waits for other and when other comes, they both live for some another
> location.
Hi,
Have you considered using condition variables? ([1]).
Why do you need a new system call?
thanks,
Daniel.
[1]https://computing.llnl.gov/tutorials/pthreads/#ConditionVariables