Help me!! ( Shared moemory )

Help me!! ( Shared moemory )

Post by ±è??1 » Wed, 31 Oct 2001 10:57:36



I use AIX Version 4.3.

A Processor can attach just 11 shared memories.
How can I increace number of attaching  shared memory?

[ Test source ]
-------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/ipc.h>
#include <fcntl.h>

#define MY_SHM_SIZE 10

/*----------------------------------------------------------------*/
main(int ac, char **av)
{
    char    *shm_ptr[100];
    int     shmid, ii;
    int      BASE_KEY = 0x22220000;
    int     File_fd[100];
    char    fname[1024];

    for ( ii = 0; ii < 30 ; ii++)
    {
        errno = 0;
        if((shmid = shmget(BASE_KEY + ii, MY_SHM_SIZE, 66|IPC_CREAT))<0)
        {
            printf ("shmget failed errno -> [%d]\n", errno);
            break;
        }
        if ((shm_ptr[ii] = (char *)shmat(shmid,NULL,0)) == NULL )
        {
            printf ("shmat failed errno -> [%d]\n", errno);
            break;
        }
        printf("ATTACH SUCCESS [%d] SHM_ID [%d] errno [%d] [%x] [%x]\n",
                    ii, shmid, errno, shm_ptr[ii], NULL);
      }

Quote:}

----------------------- END -------------------------------------------

[RESULT]
------------------------------------------------------------------
ATTACH SUCCESS [0] SHM_ID [9830450] errno [0] [30000000] [0]
ATTACH SUCCESS [1] SHM_ID [8650791] errno [0] [40000000] [0]
ATTACH SUCCESS [2] SHM_ID [1572923] errno [0] [50000000] [0]
ATTACH SUCCESS [3] SHM_ID [1572947] errno [0] [60000000] [0]
ATTACH SUCCESS [4] SHM_ID [1572943] errno [0] [70000000] [0]
ATTACH SUCCESS [5] SHM_ID [2228273] errno [0] [80000000] [0]
ATTACH SUCCESS [6] SHM_ID [1179736] errno [0] [90000000] [0]
ATTACH SUCCESS [7] SHM_ID [1048665] errno [0] [a0000000] [0]
ATTACH SUCCESS [8] SHM_ID [1048666] errno [0] [b0000000] [0]
ATTACH SUCCESS [9] SHM_ID [1048667] errno [0] [c0000000] [0]
ATTACH SUCCESS [10] SHM_ID [1048668] errno [0] [e0000000] [0]
ATTACH SUCCESS [11] SHM_ID [1048669] errno [24] [ffffffff] [0]
ATTACH SUCCESS [12] SHM_ID [1572930] errno [24] [ffffffff] [0]
ATTACH SUCCESS [13] SHM_ID [786537] errno [24] [ffffffff] [0]
ATTACH SUCCESS [14] SHM_ID [786538] errno [24] [ffffffff] [0]
ATTACH SUCCESS [15] SHM_ID [786539] errno [24] [ffffffff] [0]
ATTACH SUCCESS [16] SHM_ID [786540] errno [24] [ffffffff] [0]
ATTACH SUCCESS [17] SHM_ID [786541] errno [24] [ffffffff] [0]
ATTACH SUCCESS [18] SHM_ID [786542] errno [24] [ffffffff] [0]
ATTACH SUCCESS [19] SHM_ID [786543] errno [24] [ffffffff] [0]
ATTACH SUCCESS [20] SHM_ID [4849736] errno [24] [ffffffff] [0]
ATTACH SUCCESS [21] SHM_ID [12189728] errno [24] [ffffffff] [0]
ATTACH SUCCESS [22] SHM_ID [3932246] errno [24] [ffffffff] [0]
ATTACH SUCCESS [23] SHM_ID [7864358] errno [24] [ffffffff] [0]
ATTACH SUCCESS [24] SHM_ID [7864335] errno [24] [ffffffff] [0]
ATTACH SUCCESS [25] SHM_ID [4718688] errno [24] [ffffffff] [0]
ATTACH SUCCESS [26] SHM_ID [17956962] errno [24] [ffffffff] [0]
ATTACH SUCCESS [27] SHM_ID [917579] errno [24] [ffffffff] [0]
ATTACH SUCCESS [28] SHM_ID [917580] errno [24] [ffffffff] [0]
ATTACH SUCCESS [29] SHM_ID [2621467] errno [24] [ffffffff] [0]

 
 
 

Help me!! ( Shared moemory )

Post by Tao Che » Thu, 01 Nov 2001 12:03:58


Define this envrionment variable:

export EXTSHM=on


> I use AIX Version 4.3.

> A Processor can attach just 11 shared memories.
> How can I increace number of attaching  shared memory?

> [ Test source ]
> -------------------------------------------------------
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <errno.h>
> #include <sys/ipc.h>
> #include <fcntl.h>

> #define MY_SHM_SIZE 10

> /*----------------------------------------------------------------*/
> main(int ac, char **av)
> {
>     char    *shm_ptr[100];
>     int     shmid, ii;
>     int      BASE_KEY = 0x22220000;
>     int     File_fd[100];
>     char    fname[1024];

>     for ( ii = 0; ii < 30 ; ii++)
>     {
>         errno = 0;
>         if((shmid = shmget(BASE_KEY + ii, MY_SHM_SIZE, 66|IPC_CREAT))<0)
>         {
>             printf ("shmget failed errno -> [%d]\n", errno);
>             break;
>         }
>         if ((shm_ptr[ii] = (char *)shmat(shmid,NULL,0)) == NULL )
>         {
>             printf ("shmat failed errno -> [%d]\n", errno);
>             break;
>         }
>         printf("ATTACH SUCCESS [%d] SHM_ID [%d] errno [%d] [%x] [%x]\n",
>                     ii, shmid, errno, shm_ptr[ii], NULL);
>       }
> }

> ----------------------- END -------------------------------------------

> [RESULT]
> ------------------------------------------------------------------
> ATTACH SUCCESS [0] SHM_ID [9830450] errno [0] [30000000] [0]
> ATTACH SUCCESS [1] SHM_ID [8650791] errno [0] [40000000] [0]
> ATTACH SUCCESS [2] SHM_ID [1572923] errno [0] [50000000] [0]
> ATTACH SUCCESS [3] SHM_ID [1572947] errno [0] [60000000] [0]
> ATTACH SUCCESS [4] SHM_ID [1572943] errno [0] [70000000] [0]
> ATTACH SUCCESS [5] SHM_ID [2228273] errno [0] [80000000] [0]
> ATTACH SUCCESS [6] SHM_ID [1179736] errno [0] [90000000] [0]
> ATTACH SUCCESS [7] SHM_ID [1048665] errno [0] [a0000000] [0]
> ATTACH SUCCESS [8] SHM_ID [1048666] errno [0] [b0000000] [0]
> ATTACH SUCCESS [9] SHM_ID [1048667] errno [0] [c0000000] [0]
> ATTACH SUCCESS [10] SHM_ID [1048668] errno [0] [e0000000] [0]
> ATTACH SUCCESS [11] SHM_ID [1048669] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [12] SHM_ID [1572930] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [13] SHM_ID [786537] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [14] SHM_ID [786538] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [15] SHM_ID [786539] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [16] SHM_ID [786540] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [17] SHM_ID [786541] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [18] SHM_ID [786542] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [19] SHM_ID [786543] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [20] SHM_ID [4849736] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [21] SHM_ID [12189728] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [22] SHM_ID [3932246] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [23] SHM_ID [7864358] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [24] SHM_ID [7864335] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [25] SHM_ID [4718688] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [26] SHM_ID [17956962] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [27] SHM_ID [917579] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [28] SHM_ID [917580] errno [24] [ffffffff] [0]
> ATTACH SUCCESS [29] SHM_ID [2621467] errno [24] [ffffffff] [0]


 
 
 

Help me!! ( Shared moemory )

Post by Urban A. Haa » Fri, 02 Nov 2001 01:11:55


Or go to 64-bit environment in AIX 5.1.

Urban A. Haas


> Define this envrionment variable:

> export EXTSHM=on




Quote:> > I use AIX Version 4.3.

> > A Processor can attach just 11 shared memories.
> > How can I increace number of attaching  shared memory?

> > [ Test source ]
> > -------------------------------------------------------
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <unistd.h>
> > #include <errno.h>
> > #include <sys/ipc.h>
> > #include <fcntl.h>

> > #define MY_SHM_SIZE 10

> > /*----------------------------------------------------------------*/
> > main(int ac, char **av)
> > {
> >     char    *shm_ptr[100];
> >     int     shmid, ii;
> >     int      BASE_KEY = 0x22220000;
> >     int     File_fd[100];
> >     char    fname[1024];

> >     for ( ii = 0; ii < 30 ; ii++)
> >     {
> >         errno = 0;
> >         if((shmid = shmget(BASE_KEY + ii, MY_SHM_SIZE, 66|IPC_CREAT))<0)
> >         {
> >             printf ("shmget failed errno -> [%d]\n", errno);
> >             break;
> >         }
> >         if ((shm_ptr[ii] = (char *)shmat(shmid,NULL,0)) == NULL )
> >         {
> >             printf ("shmat failed errno -> [%d]\n", errno);
> >             break;
> >         }
> >         printf("ATTACH SUCCESS [%d] SHM_ID [%d] errno [%d] [%x] [%x]\n",
> >                     ii, shmid, errno, shm_ptr[ii], NULL);
> >       }
> > }

> > ----------------------- END -------------------------------------------

> > [RESULT]
> > ------------------------------------------------------------------
> > ATTACH SUCCESS [0] SHM_ID [9830450] errno [0] [30000000] [0]
> > ATTACH SUCCESS [1] SHM_ID [8650791] errno [0] [40000000] [0]
> > ATTACH SUCCESS [2] SHM_ID [1572923] errno [0] [50000000] [0]
> > ATTACH SUCCESS [3] SHM_ID [1572947] errno [0] [60000000] [0]
> > ATTACH SUCCESS [4] SHM_ID [1572943] errno [0] [70000000] [0]
> > ATTACH SUCCESS [5] SHM_ID [2228273] errno [0] [80000000] [0]
> > ATTACH SUCCESS [6] SHM_ID [1179736] errno [0] [90000000] [0]
> > ATTACH SUCCESS [7] SHM_ID [1048665] errno [0] [a0000000] [0]
> > ATTACH SUCCESS [8] SHM_ID [1048666] errno [0] [b0000000] [0]
> > ATTACH SUCCESS [9] SHM_ID [1048667] errno [0] [c0000000] [0]
> > ATTACH SUCCESS [10] SHM_ID [1048668] errno [0] [e0000000] [0]
> > ATTACH SUCCESS [11] SHM_ID [1048669] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [12] SHM_ID [1572930] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [13] SHM_ID [786537] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [14] SHM_ID [786538] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [15] SHM_ID [786539] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [16] SHM_ID [786540] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [17] SHM_ID [786541] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [18] SHM_ID [786542] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [19] SHM_ID [786543] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [20] SHM_ID [4849736] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [21] SHM_ID [12189728] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [22] SHM_ID [3932246] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [23] SHM_ID [7864358] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [24] SHM_ID [7864335] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [25] SHM_ID [4718688] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [26] SHM_ID [17956962] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [27] SHM_ID [917579] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [28] SHM_ID [917580] errno [24] [ffffffff] [0]
> > ATTACH SUCCESS [29] SHM_ID [2621467] errno [24] [ffffffff] [0]