Re: [PATCH] kern: simple futex for gnumach (version 4)

2013-12-24 Thread Richard Braun
On Tue, Dec 24, 2013 at 05:38:59PM +0100, Marin Ramesa wrote: > I have read in "Futexes are tricky" that futex() is used with INT_MAX > argument. I want to keep that usage. So, if a number of threads to > wake is greater than number of threads in a futex I wake all. And it also says everything els

Re: [PATCH] kern: simple futex for gnumach (version 4)

2013-12-24 Thread Marin Ramesa
On 12/24/2013 05:20:41 PM, Richard Braun wrote: On Tue, Dec 24, 2013 at 04:55:47PM +0100, Marin Ramesa wrote: > I use a recursive futex_wake(). It first scans all the futexes if > they are on the same offset and if they share the same vm_object. > If they do, recursion is used to wake a number of

Re: [PATCH] kern: simple futex for gnumach (version 4)

2013-12-24 Thread Richard Braun
On Tue, Dec 24, 2013 at 04:55:47PM +0100, Marin Ramesa wrote: > I use a recursive futex_wake(). It first scans all the futexes if > they are on the same offset and if they share the same vm_object. > If they do, recursion is used to wake a number of threads in those > futexes. The number of threads

Re: [PATCH] kern: simple futex for gnumach (version 4)

2013-12-24 Thread Marin Ramesa
On 12/24/2013 03:25:15 PM, Richard Braun wrote: > 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 ? I use a recursive futex_wake(). It first scans all the futexes if they are on the same offset and if

Re: [PATCH] kern: simple futex for gnumach (version 4)

2013-12-24 Thread Richard Braun
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 c

Re: [PATCH] kern: simple futex for gnumach (version 4)

2013-12-24 Thread Marin Ramesa
On 12/24/2013 11:41:40 AM, Richard Braun wrote: Obviously, you rushed your work without trying to understand what you were doing, and this is becoming frustrating. Don't blindly and mindlessly copy the first thing you see around... 1/ A simpleroutine is a one-way RPC, without a return value othe

Re: [PATCH] kern: simple futex for gnumach (version 4)

2013-12-24 Thread Richard Braun
On Sun, Dec 22, 2013 at 03:58:55PM +0100, Marin Ramesa wrote: > +simpleroutine futex_rpc( > + thread : thread_t; > + address : pointer_t; > + value : int; > + operation : int); > + > +simpleroutine futex_wait_rpc( > +

[PATCH] kern: simple futex for gnumach (version 4)

2013-12-22 Thread Marin Ramesa
GPL license included, more bugs fixed and RPCs defined. --- Makefrag.am | 2 + include/mach/gnumach.defs | 26 +++ kern/futex.c | 405 ++ kern/futex.h | 108 + 4 files changed, 541 insertions(+) cr