OT: Semaphore Interview Question
OT: Semaphore Interview Question
- Subject: OT: Semaphore Interview Question
- From: Abdulla Kamar <email@hidden>
- Date: Fri, 18 Dec 2009 17:46:29 +1100
Hi guys
I guess, this one is directed at Terry Lambert, as he said previously: "I sometimes pose how to resolve the conflicting goals involved as an interview question."[1] This was in relation to implementing unnamed semaphore support.
I was thinking about this for a second, and wanted to know whether I'd came up with a reasonable solution. My solution would be to ensure that all named semaphores returned an FD in the range of [0, lowest inaccessible address), making sure that "normal" FDs were allocated so that there was a hole in that region reserved for the maximum number of "special" FDs, such as named semaphores. Then all semaphore routines could compare the address given to them, so that if the pointer was in that region it could be cast to an FD and handled as a named semaphore, otherwise treated as a pointer to a sem_t and used as an unnamed semaphore.
Would this be a reasonable solution?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden