Today's Topics: - System V Interprocess Communication (IPC) Mechanism
Today's Topics: - System V Interprocess Communication (IPC) Mechanism
Today's Topics: - System V Interprocess Communication (IPC) Mechanism
• Pipes/sockets
• FIFO semantics
• Signals: sending flags
• Sometimes, we want something beyond FIFO
• FIFO with tags (message queue)
• File semantics: the content is always there unless it
is modified explicitly. (shared memory)
•Once concurrency is allowed in shared data, we will
need a way to protect (lock) the data. (semaphore)
Shared Memory
(unique key)
Create
ptr ptr
Attach 0 Attach
Proc. 1 Proc. 2
Example:
key_t key;
int shmid;
Example:
key_t key;
int shmid;
char *data;
shmdt(data);
Here’s an shm_attach.c
Example: Shm_delete.c
• ipcs
– Lists all IPC objects owned by the user
• ipcrm
– Removes specific IPC object
• Using Semaphores
– Creation: semget( … )
– Incr/Decr/Test-and-set : semop(…)
Online tutorial
http://www.ecst.csuchico.edu/~beej/guide/ipc/semaphores.html
• IO redirection
• Pipes
• Background execution
• “arrow” functions
• ‘cd’ command
– Why is this command different from other
commands?
• PATH environment variable.