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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- 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 and Orphan Processes in C
- Zombie Processes and their Prevention
- fork() to execute processes from bottom to up using wait()
- Using fork() to produce 1 parent and its 3 child processes
- Program to show that Linux provides time sharing environment to processes
- C++ bitset and its application
- unordered_multimap and its application
- fesetround() and fegetround() in C++ and their application
- is_permutation() in C++ and its application for anagram search
- Synchronous Chatting Application using C++ boost::asio
- iscntrl() in C++ and its application to find control characters
- isspace() in C/C++ and its application to count whitespace characters
- Full screen OpenCV / GtK application in C++ running on Raspberry PI
- C++ File Writer-Reader application using Windows Threads
- What is Dynamic Memory Allocation?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.