- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- why i cant' shmget() more then 1GB?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 02:55 AM
02-21-2007 02:55 AM
[... cut ...]
const size_t size = (size_t)1024*1024*1024*1+1; // 2GB + 1byte
shm_handle = shmget(IPC_PRIVATE, size, 0600);
if ( shm_handle < 0 ) {
perror("shmget()");
return 1;
}
printf("sucessfully allocated shm %dMB\n",size/1024/1024);
[... cut ...]
when i try to run prog, i get:
sergey@archer:~/work$ uname -a
HP-UX archer B.11.23 U ia64 3177107281 unlimited-user license
sergey@archer:~/work$ kctune shmmax
Tunable Value Expression Changes
shmmax 8556150784 8556150784 Immed
sergey@archer:~/work$ ./shmmem
shmget(): Not enough space
why?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 03:12 AM
02-21-2007 03:12 AM
Re: why i cant' shmget() more then 1GB?
Perhaps (from the shmget()' manpages:
[ENOSPC] - A shared memory identifier is to be created but the system-imposed limit on the maximum number of allowed shared memory identifiers system wide would be exceeded.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 03:27 AM
02-21-2007 03:27 AM
Solutionfile shmmem
EL32 or ELF64?
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 03:28 AM
02-21-2007 03:28 AM
Re: why i cant' shmget() more then 1GB?
So this is a 64-bit application.
You already show shmmax having been set large enough.
What about maxdsiz_64bit and swap space?
Google for: +hpux +shmmax +64-bit ?
Nit picking...
const size_t size = (size_t)1024*1024*1024*1+1; // 2GB + 1byte
Looks like 1GB + 1 to me.
You might want to change the test to print out the MB amount rain or shine.
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 03:31 AM
02-21-2007 03:31 AM
Re: why i cant' shmget() more then 1GB?
Maybe shmmax is set to 1 GB?
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 03:35 AM
02-21-2007 03:35 AM
Re: why i cant' shmget() more then 1GB?
what are your ulimit values ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 08:17 AM
02-21-2007 08:17 AM
Re: why i cant' shmget() more then 1GB?
# cat pig2.c
#include
#include
#include
#include
#include
int
main(int argc, char *argv[])
{
int shmid;
void *shmaddr;
shmid = shmget(IPC_PRIVATE,
(size_t)((1L * 1024L * 1024L * 1024L) + 1L),
IPC_CREAT);
printf("shmget returned id: %d.\n", shmid);
if ( shmid == -1 ) {
fprintf(stderr, "shmget errno: %d.\n", errno);
perror("shmget: ");
exit(EXIT_FAILURE);
}
shmaddr = shmat(shmid, NULL, 0);
if ( shmaddr == SHM_FAILED ) {
perror("shmat: ");
exit(EXIT_FAILURE);
}
while ( shmaddr != SHM_FAILED ) {
bzero(shmaddr, (size_t)(1L * 1024L * 1024L * 1024L));
sleep(5);
}
exit(0);
}
#kctune shmmax
Tunable Value Expression Changes
shmmax 4398046511104 4398046511104 Immed
# ./pig2
shmget returned id: -1.
shmget errno: 12.
shmget: : Not enough space
And yeah -- that's because you can't create a segment larger than 1Gb in the default 32-bit address space layout. Default layout has 2Gb (on IPF) or 1.75 Gb (PA) available for shared address space, but 1Gb of that is intended for "Global" objects which must be shared across all Memory Windows clients (except those with a Private 4th Quadrant) and with 64-bit clients. That's the upper 1Gb on IPF.
That will be used when it has to be, but the lower 1Gb lives in a different address space depending on what Memory Window you're in... and as such, objects are not allowed to cross that boundary. Even for applications using an address space model where their 2nd quadrant is also shared still have discrete boundaries between each 1Gb... you can't cross them.
For >1Gb as a single segment, you need to go 64-bit. Your only alternative in 32-bit is to use multiple segments (which aren't guaranteed to be contiguous).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 02:53 PM
02-21-2007 02:53 PM
Re: why i cant' shmget() more then 1GB?
how are you compiling the program
if you do a cc myprog.c -o myprog
you probably get a 32 bit program.. If you compile it with +DA2.0W
you will get a 64 bit executible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 05:57 PM
02-21-2007 05:57 PM
Re: why i cant' shmget() more then 1GB?
also my simple memory grabber that doing simple malloc()'ing chubnks of 1MB was able to get around 3GB instead of 811MB in 32bit.