Re: Unix error 17 on nqueens example

Gerd Stolpmann <[email protected]> Fri, 02 Mar 2012 19:01:42 +0100
Newsgroups gmane.comp.lang.ocaml.lib.net.devel
Message-ID <1330711302.2826.219.camel@thinkpad>
Am Donnerstag, den 01.03.2012, 14:57 +0100 schrieb Pierre-Alexandre
Voye:
> Hello, after installing new version 3.5.1, I have new issues :
> /private/tmp/multicore$ ./nqueens -n 13 -mp
> Problem size: 13
> [Thu Mar  1 14:52:48 2012] [netmcore_0] [err] Exception in worker
> process 0: Invalid_argument("format_camlbox (no POSIX semaphores)")

OSX does not support unnamed POSIX semaphores. See e.g.
http://macosx.com/forums/software-programming-web-scripting/49458-semaphores-alternatives.html

What might be possible here is to provide a scheme to replace them with
named semaphores (which are available). The name would just be derived
from the address of the semaphore (e.g. "<prefix>_<address>"). The
not-so-simple part is to ensure that all processes open the semaphores
before their first use (that's the reason why unnamed semaphores work
better here). There could be a process-wide hash table for this, but
this would mean every semaphore operation needs a hash table lookup.

Destruction of semaphores is even worse. In order to do it cleanly, one
needs a special management table (in shared memory or as file), and keep
track which semaphores are still in use.

> Time: 0.025
> |/private/tmp/multicore$ ./nqueens -n 13 -mp2
> Problem size: 13
> Fatal error: exception Unix.Unix_error(34, "lseek", "")

This could be an lseek of shared memory. I've no idea why OSX complains
about this.

Gerd

> |/private/tmp/multicore$ ./nqueens -n 13 -sht
> Problem size: 13
> Fatal error: exception Unix.Unix_error(34, "lseek", "")
> |/private/tmp/multicore$ ./nqueens -n 13 -sht2
> Problem size: 13
> Fatal error: exception Unix.Unix_error(34, "lseek", "")
> |/private/tmp/multicore$ d
> 
> Doc says error 34 (ESPIPE) is "Invalid seek e.g. on a pipe"
> 
> 2012/2/29 Pierre-Alexandre Voye <[email protected]>
>         
>         
>         2012/2/29 Gerd Stolpmann <[email protected]>
>                 Am Sonntag, den 26.02.2012, 23:45 +0100 schrieb
>                 Pierre-Alexandre Voye:
>                 > Hi list,
>                 >
>                 > In my mac (Lion, 10.7) I'm unable to make nqueens
>                 example work with
>                 > -mp or even -sht flags
>                 > Here my attempts :
>                 >
>                 > $ time ./nqueens -n 3 -mp > /dev/null
>                 > Fatal error: exception Unix.Unix_error(17, "",
>                 >
>                 "/Users/ontologiae/Documents/Projets/COWEBO/CoweboDev/Etudes/ocamlnet-3.5/examples/multicore/run_nqueens/netplex.controller/admin")
>                 
>                 
>                 Unix error 17 = ENAMETOOLONG. You can find this out by
>                 running in the
>                 toploop:
>                 
>                 # (Obj.magic 17 : Unix.error);;
>                 - : Unix.error = Unix.ENAMETOOLONG
>         
>         Thank you ! I didn't knew that, it will help me to investigate
>         more by myself. 
>         
>                 
>                 This refers to the path name of the Unix domain
>                 socket. Because of
>                 historical reasons, such paths are limited to 108
>                 bytes. You can work
>                 around by e.g. creating a symlink to your working
>                 directory in /tmp.
>                 
>                 > time ./nqueens -n 3 -sht > /dev/null
>                 > Fatal error: exception Unix.Unix_error(12, "fchmod",
>                 "")
>                 >
>                 >
>                 > $ time ./nqueens -n 3 -mp2 > /dev/null
>                 > Fatal error: exception Unix.Unix_error(12, "fchmod",
>                 "")
>                 >
>                 > Is it a mac/BSD linked problem ?
>                 
>                 
>                 The fchmod problem probably is. fchmod is here called
>                 on a file
>                 descriptor referring to shared memory. This is strange
>                 because fchmod is
>                 part of the POSIX API for shared memory.
>                 
>                 Anyway, I'll just catch EINVAL and ignore it.
>         
>         It's probably a good idea :
>         /tmp/multicore$ ./nqueens -mp
>         Problem size: 8
>         [Wed Feb 29 15:48:46 2012] [netmcore_0] [err] Exception in
>         worker process 0: Unix.Unix_error(EINVAL, "fchmod", "")
>         Time: 0.023 
>         
>                 
>                 Gerd
>                 
>                 >
>                 > Regards
>                 >
>                 > Pierre-Alexandre
>                 >
>                 > --
>                 > ---------------------
>                 > https://twitter.com/#!/ontologiae/
>                 > http://linuxfr.org/users/montaigne
>                 >
>                 
>                 
>                 
>                 
> 
> 
> 
> -- 
> ---------------------
> https://twitter.com/#!/ontologiae/
> http://linuxfr.org/users/montaigne
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    [email protected]
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.
------------------------------------------------------------


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/