From 1596822d44a1bcf10767f45a4191868a94d2cbdb Mon Sep 17 00:00:00 2001 From: Tanvi <92842423+tanvi1110@users.noreply.github.com> Date: Wed, 12 Oct 2022 19:12:21 +0530 Subject: [PATCH] Add content for threads in Node.js (#2246) * Added content to prisma.md and native-drivers.md * Content added to forever.md * link updated to forever documentation * Content added to Nohup.md with links * Update content/roadmaps/107-nodejs/content/110-nodejs-databases/101-document/102-native-drivers.md * content added to threads readme.md * Content added to thread - readme.md * Content added to threads - child-pocess.md * Content added to threads - cluster.md * Content added to thread - worker-threads.md * update three node module threads typo * Update content/roadmaps/107-nodejs/content/114-nodejs-threads/readme.md Co-authored-by: Kamran Ahmed --- .../content/114-nodejs-threads/100-child-process.md | 13 ++++++++++++- .../content/114-nodejs-threads/101-cluster.md | 10 +++++++++- .../114-nodejs-threads/102-worker-threads.md | 10 +++++++++- .../107-nodejs/content/114-nodejs-threads/readme.md | 7 ++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/content/roadmaps/107-nodejs/content/114-nodejs-threads/100-child-process.md b/content/roadmaps/107-nodejs/content/114-nodejs-threads/100-child-process.md index c208a638e..a1497c46c 100644 --- a/content/roadmaps/107-nodejs/content/114-nodejs-threads/100-child-process.md +++ b/content/roadmaps/107-nodejs/content/114-nodejs-threads/100-child-process.md @@ -1 +1,12 @@ -# Child process \ No newline at end of file +# Child Process + +The child_process module gives the node the ability to run the child process, established through IPC (inter-process communication) by accessing operating system commands. + +The three main methods inside this module are : +`child_process.spawn()` +`child_process.fork()` +`child_process.exec()` + +Free Content + +Child Process Docs diff --git a/content/roadmaps/107-nodejs/content/114-nodejs-threads/101-cluster.md b/content/roadmaps/107-nodejs/content/114-nodejs-threads/101-cluster.md index ab0671b1f..130185a92 100644 --- a/content/roadmaps/107-nodejs/content/114-nodejs-threads/101-cluster.md +++ b/content/roadmaps/107-nodejs/content/114-nodejs-threads/101-cluster.md @@ -1 +1,9 @@ -# Cluster \ No newline at end of file +# Cluster + + The Cluster module allows you to easily create child processes that each runs simultaneously on their own single thread, to handle workloads among their application threads. + +Free Content + +Cluster Docs +How Clustering Increases Performance \ No newline at end of file diff --git a/content/roadmaps/107-nodejs/content/114-nodejs-threads/102-worker-threads.md b/content/roadmaps/107-nodejs/content/114-nodejs-threads/102-worker-threads.md index a4905f67d..7e57cfbc4 100644 --- a/content/roadmaps/107-nodejs/content/114-nodejs-threads/102-worker-threads.md +++ b/content/roadmaps/107-nodejs/content/114-nodejs-threads/102-worker-threads.md @@ -1 +1,9 @@ -# Worker threads \ No newline at end of file +# Worker Threads + +Worker thread is a continuous parallel thread that runs and accepts messages until it is explicitly closed or terminated. +With worker threads, we can achieve a much efficient application without creating a deadlock situation. Workers, unlike children's processes, can exchange memory. + +Free Content + +Worker Threads Docs + diff --git a/content/roadmaps/107-nodejs/content/114-nodejs-threads/readme.md b/content/roadmaps/107-nodejs/content/114-nodejs-threads/readme.md index 074fc502c..60af14c76 100644 --- a/content/roadmaps/107-nodejs/content/114-nodejs-threads/readme.md +++ b/content/roadmaps/107-nodejs/content/114-nodejs-threads/readme.md @@ -1 +1,6 @@ -# Nodejs threads \ No newline at end of file +# Nodejs Threads + +Node.js is a single-threaded language and gives us ways to work parallelly to our main process. +Taking note of nowadays multicore system single threading is very memory efficient. + +Single Thread vs Child Process vs Worker Threads vs Clutster in Node.js \ No newline at end of file