On Tue, Dec 24, 2013 at 12:52:23PM +0100, Marin Ramesa wrote: > I need to start somewhere. I really want to learn how kernels are > programmed. > This task was listed in the small hacks entry, I really thought it > would be a > small hack.
That's probably a mistake on our part. > There is a one call to vm_map lookup to retrive the offset and the > object. Simple How do you implement cross address space synchronization ? > locks are used and there are calls to thread_resume() and > thread_suspend(). I don't > see anything so much difficult that I can't learn while doing it. Well, using thread_resume/thread_suspend might work for non preemptible kernels, but not for a preemptible one, or a multiprocessor one like Mach was. Look at your call to thread_suspend. If thread_resume is called after the futex lock is released (it can't be called before since it's called with that same lock reacquired), but before thread_suspend is called, the thread will miss its wakeup. This is why interlocks (usually hidden in wait queues) are normally used. See assert_wait(). > But I won't work on this if it's frustrating. I don't want to cause > any trouble. For now, I'm the only one reacting to this, not much of a trouble. But I'm pretty sure we would all like contributors to pay great care to what they're doing, whatever their technical level. -- Richard Braun