Lets take a simple thread which is declared in the following fashion:
Code: Select all
int test_thread(void *args,unsigned long signal)
{
//do work
}
The runtime part is the new idea. When a thread signals this test_thread, the scheduler simply adds one more thread to the system with the same entry point ('test_thread') passing the signal to it. This happens asynchronously even when the actual test_thread is running. The only difference as far as kernel threads are concerned is the stack that the new thread uses which is different from the thread that the actual test_thread is using. So to handle the signal we just have to write the following code:
Code: Select all
int test_thread(void *args,unsigned long signal)
{
if(signal) {
//handle the signal
return 0;
}
//do work
}
So how do you find this architecture?