{"type": "session", "harness": "deepseek-harness", "id": "sys-0030", "name": "Linux IPC mechanisms"} {"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}} {"type": "message", "message": {"role": "user", "content": "What are the Linux IPC mechanisms?"}} {"type": "message", "message": {"role": "assistant", "content": "```\n1. Pipes (anonymous):\n pipe() -> read/write\n One-way, parent-child only\n\n2. Named Pipes (FIFO):\n mkfifo /tmp/fifo 0666\n echo \"data\" > /tmp/fifo # writer\n cat /tmp/fifo # reader\n\n3. Shared Memory:\n shmget() -> shmat() -> shmdt() -> shmctl()\n Fastest IPC, needs synchronization\n\n4. Message Queues:\n msgget() -> msgsnd() -> msgrcv()\n Structured messages, priority\n\n5. Semaphores:\n semget() -> semop()\n Synchronization primitive\n\n6. Unix Domain Sockets:\n socket(AF_UNIX, SOCK_STREAM, 0)\n bind(), listen(), accept(), connect()\n Bidirectional, can pass file descriptors\n\n7. D-Bus:\n High-level message bus\n Used by desktop environments\n gdbus call --session --dest org.freedesktop.DBus --object-path / --method org.freedesktop.DBus.ListNames\n\n8. Signals:\n kill(pid, SIGTERM)\n signal(SIGINT, handler)\n Asynchronous notifications\n\nExample (shared memory):\n```c\nint shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT | 0666);\nvoid *ptr = shmat(shmid, NULL, 0);\nstrcpy(ptr, \"Hello from parent\");\n// Child reads from same shmid\nshmdt(ptr);\nshmctl(shmid, IPC_RMID, NULL);\n```\n```"}}