Managing IPC Resources

Understanding and maintaining Xi-Batch shared memory, message queues, and semaphores

How Xi-Batch Uses IPC

Xi-Batch uses System V IPC (Inter-Process Communication) resources to coordinate between the scheduler and client commands. These include:

  • Shared memory segments - For rapid data exchange
  • Message queues - For command/response communication
  • Semaphores - For synchronization and locking

Xi-Batch uses the IPC key 0x5869b to identify its resources.

Normal Operation

During normal operation, you should see a small number of IPC resources (typically 1-3) associated with the running scheduler. These are automatically created when the scheduler starts and should be cleaned up when it stops gracefully.

Checking IPC Resources

bash

# View shared memory segments
ipcs -m | grep "0x5869b"

# View message queues
ipcs -q | grep "0x5869b"

# View semaphores
ipcs -s | grep "0x5869b"

When Resources Need Cleanup

After a system restart, power failure, or abnormal scheduler termination, IPC resources may remain allocated. The scheduler needs these cleaned up before it can create fresh resources.

Symptoms indicating stale resources:

  • Scheduler won't start, reporting resources already in use
  • Commands hang or timeout
  • Multiple IPC entries visible when scheduler isn't running

Cleanup Procedure

Stop the scheduler and remove all IPC resources:

bash

# Stop the scheduler gracefully
btquit -y
sleep 2

# Verify it stopped
ps aux | grep btsched

# If still running, force termination
pkill -9 btsched

# Clean up IPC resources
# If xb-ripc utility is available:
xb-ripc -d

# Alternative manual cleanup:
# Remove shared memory segments
ipcs -m | grep "0x5869b" | awk '{print $2}' | while read shmid; do ipcrm -m $shmid; done

# Remove message queues
ipcs -q | grep "0x5869b" | awk '{print $2}' | while read msgid; do ipcrm -q $msgid; done

# Remove semaphores
ipcs -s | grep "0x5869b" | awk '{print $2}' | while read semid; do ipcrm -s $semid; done

# Verify cleanup completed
ipcs -m | grep "0x5869b"  # Should return nothing
ipcs -q | grep "0x5869b"  # Should return nothing
ipcs -s | grep "0x5869b"  # Should return nothing

# Restart scheduler with clean resources
btstart
sleep 3

# Verify scheduler is responding
btjlist -H

After cleanup, the scheduler creates fresh IPC resources and normal operations resume.

Labels
Checking File and Directory Permissions
Understanding Xi-Batch spool directory ownership and access requirements