Home > Net >  Package for MSYS2 to resolve shmget Error
Package for MSYS2 to resolve shmget Error

Time:07-16

I have compiled a string matching tool SMART in windows using MSYS2, the tool is implemented in C programming language. The instruction was (in the the instruction set):

makefile is the bash file used for compiling the C source files of the tool. Run the command ./makefile in order to compile the smart tool. The code of each string matching algorithm is compiled an tested separately.

The problem now is, each algorithm is compiled properly but tested unsuccessfully.

Also, when the following command is given to execute (see how to run experimental tests):

./smart -text englishTexts

I get the following error:

shmget: Function not implemented

I doubt both issues are related/due to the failure of managing shared memory, note that author created the system on a POSIX system (whereas I am trying to run this on a Windows system). Author wrote about the Manage shared memory on LINUX:

In order to configure shared memory on linux you have to login as root, then edit the file

/etc/sysctl.conf.

The kernel.shmax parameter defines the maximum size in bytes for a shared memory segment. Determine the value of kernel.shmax by performing the following:

cat /proc/sys/kernel/shmmax
33554432

The kernel.shmall parameter sets the total amount of shared memory in pages that can be used at one time on the system. Set the value of both of these parameters to the amount physical memory on the machine. As in the previous case you can determine the value of kernel.shmax by performing the following:

cat /proc/sys/kernel/shmmall
2097152

Set the values of kernel.shmax and kernel.shmall, as follows:

echo MemSize > /proc/sys/shmmax
echo MemSize > /proc/sys/shmall

where MemSize is the number of bytes. For example, to set both values to 2GB, use the following:

echo 2147483648 > /proc/sys/kernel/shmmax
echo 2147483648 > /proc/sys/kernel/shmall

Then reboot the machine using. Shared memory can be viewed with the ipcs command and you can delete shared memory segments with the ipcrm command.

But there is nothing specific about Windows (though there is a paragraph for "Manage shared memory on WINDOWS VISTA").

At this point I ask your help, to inform me whether there is a package for MSYS2 to solve shmget error mentioned above? Or there are other ways to solve this problem?

CodePudding user response:

Unfortunately I think you're out of luck with msys2. msys2 takes out cygserver from cygwin, which is required for shared memory.

  • Related