1832423 Members
3940 Online
110042 Solutions
New Discussion

Setmemwindow command

 
SOLVED
Go to solution
jose-kl
Advisor

Setmemwindow command

Hi,

I tried to use Setmemwindow command as explained in /usr/share/doc/mem_wndws.txt but with no success .

steps I did :

1. set max_mem_window to 20
2. # cat /etc/services.window
database1 20
database2 30
database3 40

3. # more startDB1.sh
WinId=$(getmemwindow database1)
setmemwindow -i $WinId /Gen/test/script/startDB1 "hello"

4. /Gen/test/script/startDB1

5. # ./memwin_stats -m
Shared Memory:
T ID KEY MODE OWNER GROUP UserKey KernId
m 0 0x2f100002 --rw------- root root Global 0
m 1 0x411c061e --rw-rw-rw- root root Global 0
m 2 0x4e0c0002 --rw-rw-rw- root root Global 0
m 3 0x412048a9 --rw-rw-rw- root root Global 0
m 4 0x00000000 --rw------- root sys Global 0
m 15877 0x431c3bbf --rw-rw-rw- daemon root Global 0

Problem is that NO new shared memory (UserKey=20) created !

PHCO_23705 installed on the system ( HPUX11.0 )

What I'm doing wrong ?

Thanks,
Jose


8 REPLIES 8
Cheryl Griffin
Honored Contributor

Re: Setmemwindow command

What are the permissions on startDB1.sh?
# ll startDB1.sh

What happens when you execute it?
# ./startDB1.sh

Do you see:
writing to segment: "DB1 says hello!"
Key is 1377042728

"Downtime is a Crime."
jose-kl
Advisor

Re: Setmemwindow command

Hi Cheryl,

Thanks for reply

# ll startDB1.sh
-rwxrwxrwx 1 root sys 110 Sep 13 15:40 startDB1.sh

When i ran :
# ./startDB1.sh

I got nothing - just the prompt !

Jose
Victor BERRIDGE
Honored Contributor

Re: Setmemwindow command

Hi Jose,
Have you configured your system to allow it have memory window?
Look in /stand/system if you have a line in the configurable params calledmax_mem_window
Here is an example of what it should look like:
max_mem_window 2

If you dont, you will have to configure and generate a new kernel

All the best
Victor
jose-kl
Advisor

Re: Setmemwindow command

Hi Victor,

Thanks for the reply .

# grep -i max_mem /stand/system
max_mem_window 20

Jose
Victor BERRIDGE
Honored Contributor

Re: Setmemwindow command

Hi,
20 is quite a lot... (?)
What do you see when you type ~/memwin_stats -mw ?


Victor
jose-kl
Advisor

Re: Setmemwindow command

Hi Victor,

# ./memwin_stats -mw
Shared Memory:
T ID KEY MODE OWNER GROUP UserKey KernId
m 0 0x2f100002 --rw------- root root Global 0
m 1 0x411c061e --rw-rw-rw- root root Global 0
m 2 0x4e0c0002 --rw-rw-rw- root root Global 0
m 3 0x412048a9 --rw-rw-rw- root root Global 0
m 4 0x00000000 --rw------- root sys Global 0
m 15877 0x431c3bbf --rw-rw-rw- daemon root Global 0
Entry USER_KEY KERN_KEY QUAD2_AVAIL QUAD3_AVAIL PID REFCNT
Memory Windows:
0 Global 0 262128 261802 6066 228
1 Unused 1 262128 262144 6238 0
2 Unused 2 262128 262144 0 0
3 Unused 3 262128 262144 0 0
4 Unused 4 262128 262144 0 0
5 Unused 5 262128 262144 0 0
6 Unused 6 262128 262144 0 0
7 Unused 7 262128 262144 0 0
8 Unused 8 262128 262144 0 0
9 Unused 9 262128 262144 0 0
10 Unused 10 262128 262144 0 0
11 Unused 11 262128 262144 0 0
12 Unused 12 262128 262144 0 0
13 Unused 13 262128 262144 0 0
14 Unused 14 262128 262144 0 0
15 Unused 15 262128 262144 0 0
16 Unused 16 262128 262144 0 0
17 Unused 17 262128 262144 0 0
18 Unused 18 262128 262144 0 0
19 Unused 19 262128 262144 0 0
20 Unused 20 262128 262144 0 0

Jose
Victor BERRIDGE
Honored Contributor

Re: Setmemwindow command

Hi jose, you are not using the memory windows...
I will look and see if I still have anything on how I implemented but it was some time ago (3 years now) and no more used:
Entry USER_KEY KERN_KEY QUAD2_AVAIL QUAD3_AVAIL PID REFCNT
Memory Windows:
0 Global 0 262144 244401 0 1387
1 Private 1 0 0 0 1
2 Unused 2 262144 262144 0 0
3 Unused 3 262144 262144 0 0


Till then,
All the best
Victor
Victor BERRIDGE
Honored Contributor
Solution

Re: Setmemwindow command

Jose,
I just tried, using your informations, here is what I get:
wilhelm:/home/vbe $ more memwin_test
WinId=$(getmemwindow database1)
setmemwindow -i $WinId /home/vbe/memwin_test "DB1 says hello!"
wilhelm:/var/adm $ more /etc/services.window
#
# File: /etc/services.window
# @(#)B.11.11_LR
#
# The format of this file is name followed by a space/tab followed by
# a unique user key. A memory window application uses the
# getmemwindow(1M) command to extract the user key and then passes that
# key to the setmemwindow(1M) command. Using the same key places
# those applications in the same memory window.
#
# For example:
#
# winid=getmemwindow database1
# setmemwindow -i $winid startup_script arg1 arg2 arg3.
#
database1 20
database2 30
database3 40
wilhelm:/sm/bin $ ./memwin_stats -mw
Shared Memory:
T ID KEY MODE OWNER GROUP UserKey KernId
m 0 0x411c275e --rw-rw-rw- root root2013202240 2013202240
m 1 0x4e0c0002 --rw-rw-rw- root root2013202240 2013202240
m 2 0x41200040 --rw-rw-rw- root root2013202240 2013202240
m 3 0x301c5765 --rw-rw-rw- root root2013202240 2013202240
m 516 0x0c6629c9 --rw-r----- root root2013202240 2013202240
m 5 0x06347849 --rw-rw-rw- root root2013202240 2013202240
m 6 0x49180029 --rw-r--r-- root root2013202240 2013202240
m 7 0x00000000 D-rw------- root root2013202240 2013202240
m 8 0x00000000 D-rw------- www other2013202240 2013202240
Entry USER_KEY KERN_KEY QUAD2_AVAIL QUAD3_AVAIL PID REFCNT
Memory Windows:
0 Global 0 262144 253421 0 237
1 Private 1 0 0 0 1
2 Unused 2 262144 262144 23447 0
3 Unused 3 262144 262144 0 0

Now I execute after chmod 755 memwin_test:
wilhelm:/home/vbe $ ./memwin_test

And here is the new output of memwin_stats:
wilhelm:/sm/bin $ ./memwin_stats -mw
Shared Memory:
T ID KEY MODE OWNER GROUP UserKey KernId
m 0 0x411c275e --rw-rw-rw- root root2013202240 2013202240
m 1 0x4e0c0002 --rw-rw-rw- root root2013202240 2013202240
m 2 0x41200040 --rw-rw-rw- root root2013202240 2013202240
m 3 0x301c5765 --rw-rw-rw- root root2013202240 2013202240
m 516 0x0c6629c9 --rw-r----- root root2013202240 2013202240
m 5 0x06347849 --rw-rw-rw- root root2013202240 2013202240
m 6 0x49180029 --rw-r--r-- root root2013202240 2013202240
m 7 0x00000000 D-rw------- root root2013202240 2013202240
m 8 0x00000000 D-rw------- www other2013202240 2013202240
Entry USER_KEY KERN_KEY QUAD2_AVAIL QUAD3_AVAIL PID REFCNT
Memory Windows:
0 Global 0 262144 253421 0 240
1 Private 1 0 0 0 1
2 20 2 262144 262144 24367 747
3 Unused 3 262144 262144 0 0
wilhelm:/sm/bin $

I had to do a Ctrl_c to quit the memwin_test and the result :
wilhelm:/home/vbe $ ./memwin_test

wilhelm:/home/vbe $ ^C
wilhelm:/sm/bin $ ./memwin_stats -mw
Shared Memory:
T ID KEY MODE OWNER GROUP UserKey KernId
m 0 0x411c275e --rw-rw-rw- root root2013202240 2013202240
m 1 0x4e0c0002 --rw-rw-rw- root root2013202240 2013202240
m 2 0x41200040 --rw-rw-rw- root root2013202240 2013202240
m 3 0x301c5765 --rw-rw-rw- root root2013202240 2013202240
m 516 0x0c6629c9 --rw-r----- root root2013202240 2013202240
m 5 0x06347849 --rw-rw-rw- root root2013202240 2013202240
m 6 0x49180029 --rw-r--r-- root root2013202240 2013202240
m 7 0x00000000 D-rw------- root root2013202240 2013202240
m 8 0x00000000 D-rw------- www other2013202240 2013202240
Entry USER_KEY KERN_KEY QUAD2_AVAIL QUAD3_AVAIL PID REFCNT
Memory Windows:
0 Global 0 262144 253421 0 239
1 Private 1 0 0 0 1
2 Unused 2 262144 262144 29380 0
3 Unused 3 262144 262144 0 0
wilhelm:/sm/bin $

Good luck
Victor