Recall & Review
beginner
What does IPC stand for in Node.js?
IPC stands for Inter-Process Communication. It allows different processes to talk and share data with each other.
Click to reveal answer
beginner
Name two common ways Node.js processes communicate using IPC.
1. Using child process's built-in messaging with
process.send() and process.on('message').<br>2. Using sockets or named pipes for more complex communication.Click to reveal answer
beginner
How do you send a message from a parent process to a child process in Node.js?
Use
child.send(message) where child is the child process object created by fork().Click to reveal answer
beginner
What event do you listen to in a child process to receive messages from the parent?
Listen to the
'message' event on process inside the child process, like process.on('message', (msg) => { ... }).Click to reveal answer
beginner
Why is IPC useful in Node.js applications?
IPC helps split work into multiple processes to improve performance and reliability. Processes can share data and coordinate tasks without blocking each other.
Click to reveal answer
Which Node.js method sends a message from a child process to its parent?
✗ Incorrect
In a child process, use process.send() to send messages to the parent.
What event should a parent process listen to receive messages from a child?
✗ Incorrect
The parent listens to the 'message' event on the child process object to get messages.
Which Node.js module is commonly used to create child processes for IPC?
✗ Incorrect
The child_process module provides methods like fork() to create child processes.
What does the fork() method do in Node.js?
✗ Incorrect
fork() creates a child process with a communication channel for IPC.
Why might you use IPC instead of sharing variables directly between processes?
✗ Incorrect
Processes have separate memory, so IPC is needed to exchange data safely.
Explain how a parent and child process communicate using IPC in Node.js.
Think about how messages are sent and received between processes.
You got /5 concepts.
Describe why IPC is important when working with multiple Node.js processes.
Consider what happens when processes run independently but need to work together.
You got /5 concepts.