0
0
Node.jsframework~5 mins

IPC communication between processes in Node.js - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aprocess.emit()
Bprocess.send()
Cchild.send()
Dchild.emit()
What event should a parent process listen to receive messages from a child?
A'message' event on process object
B'data' event on process object
C'send' event on child process
D'message' event on child process object
Which Node.js module is commonly used to create child processes for IPC?
Afs
Bhttp
Cchild_process
Devents
What does the fork() method do in Node.js?
ACreates a new child process with IPC channel
BCreates a new thread
CStarts a web server
DReads a file asynchronously
Why might you use IPC instead of sharing variables directly between processes?
ABecause processes do not share memory
BBecause IPC is faster than variables
CBecause variables are deprecated
DBecause IPC uses global variables
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.