A signal is used in the UNIX system to notify a process that a particular event has occurred. A signal may be received either synchronously or asynchronously depending on the source and the reason for the event being signalled. A signal must follow the following pattern –
1. A signal is generated by the occurrence of a particular event.
2. A generated signal is delivered to a particular process.
3. The signal must be handled after receiving at the process.
In this problem, the message is sent from one user to another user using kill function. kill function takes two inputs – process id of the receiver process and signal type. For this purpose, we use a shared memory where we store the process id(s) of two processes. We use a handler function which will print the message received from another process. User2 will start to send message to User1 and then they will continue chatting.
- POSIX shared-memory API
- Communication between two process using signals in C
- How to implement user defined Shared Pointers in C++
- Create a shared Folder between Host OS and Guest OS ( Virtual Box)
- How to create a Shared Folder between two Local User in Linux?
- Zombie Processes and their Prevention
- Zombie and Orphan Processes in C
- Using fork() to produce 1 parent and its 3 child processes
- fork() to execute processes from bottom to up using wait()
- Program to show that Linux provides time sharing environment to processes
- unordered_multimap and its application
- C++ bitset and its application
- fesetround() and fegetround() in C++ and their application
- is_permutation() in C++ and its application for anagram search
- iscntrl() in C++ and its application to find control characters
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.