- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- semop problem on hp-ux 11.23 for itanium(rx2600 se...
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
07-08-2004 02:47 PM
07-08-2004 02:47 PM
semop problem on hp-ux 11.23 for itanium(rx2600 server)
Any body can figure out the problem. thanks.
source code please attachment.
- Tags:
- semop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2004 03:14 AM
07-09-2004 03:14 AM
Re: semop problem on hp-ux 11.23 for itanium(rx2600 server)
Your problem is the semctl() call is not setting the semaphore to 1 in the first place. (I tracked this down by using q4 while the process was stalled and looking at the sleep channel for the parent and child (the fact that they were both sleeping [and therefore in a P() op was a big clue, the semaphore value being 0 confirmed it] ).
The reason the PA code works and the IPF code doesn't seems to be due to a change in the header. The 11.0 header states:
/* The fourth argument to semctl() varies depending on the value of
its first argument. If desired, "union semun" can be declared
by the user, but this is not necessary since the individual
member can just be passed as the argument. */
This is what you do... and it worked (presumably the semun structure gets added somewhere in the compilation [haven't tracked this exact sequence down]).
For 11.20 and later (and the fact that it came in with 11.20 makes it rather hard for me to track down exactly why / where this was changed, sorry), the header now states:
/* The fourth argument to semctl() is optional and varies depending
* on the value of its first argument. If required, it is of type
* "union semun" which the application program must explicitly declare:
*
* union semun {
* int val;
* struct semid_ds *buf;
* unsigned short *array;
* } arg;
*/
And it means it. When I changed your source code to the following:
#define array_size 1000 /* number of elements in shared memory*/
typedef union semun {
int val;
struct semid_ds *buf;
ushort *array;
} arg;
arg init_sem_value;
init_sem_value.val = 1;
The code works.
# cc +DD32 -o odd odd.c
# ./odd
process pid=0,partial_sum=250000
process pid=6859,partial_sum=250500
the sum of 1 to 1000 is 500500
# uname -a
HP-UX vmialp14 B.11.23 U ia64 1634551262 unlimited-user license
The semctl() man page shows the union being defined... so I believe this is the intended behavior.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2004 06:29 AM
07-09-2004 06:29 AM
Re: semop problem on hp-ux 11.23 for itanium(rx2600 server)
The union addresses difference in PA vs. IPF argument passing down into the kernel (and the Aries emulator is doing the switch for you).
- Tags:
- Aries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2004 12:35 PM
07-09-2004 12:35 PM
Re: semop problem on hp-ux 11.23 for itanium(rx2600 server)
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2004 01:21 PM
07-09-2004 01:21 PM
Re: semop problem on hp-ux 11.23 for itanium(rx2600 server)
Thank you very much. You are a great help.
It really work, and one of my message comunicate program also has the same problem, i have worked it out. Thanks again!
- Tags:
- hpux semaphore