# Threading / async questions

**URL:** <https://discourse.nodered.org/t/threading-async-questions/12879>\
**Category:** General\
**Created:** [3 July 2019 18:31 UTC](https://discourse.nodered.org/t/threading-async-questions/12879 "2019-07-03T18:31:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thatcadguy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thatcadguy/32/5273_2.png) [@thatcadguy](https://discourse.nodered.org/u/thatcadguy)\
**Post date:** [3 July 2019 18:31 UTC](https://discourse.nodered.org/t/threading-async-questions/12879/1 "2019-07-03T18:31:57Z")

</div>

I've got some heavy lifting to do and I don't want it to affect overall responsiveness. Trying to wrap my head around how everything is executed. My understanding of Node.js is that there's a single thread for the event loop and it has worker threads to execute I/O calls. So I take it that Node-RED is essentially running one node at a time, and file I/O etc. goes to those worker threads. Along those lines, some questions:

1. Is the exec node blocking? Better question, if I call something that's going to take several seconds, will it hold up everything else? Looks like I could do an async call to child\_process.exec from within a function block instead: [https://nodejs.org/dist/latest-v10.x/docs/api/child\_process.html#child\_process\_child\_process\_exec\_command\_options\_callback](https://nodejs.org/dist/latest-v10.x/docs/api/child_process.html#child_process_child_process_exec_command_options_callback)

2. What's the best way to offload work in general? Async/await? Create my own worker thread? Also seeing some 3rd party nodes: node-red-contrib-mp-function, node-red-contrib-async, etc.

Specifically, I need to zip up a large file, and also to execute numerical methods, both of which may take long enough to hold things up. TIA

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [3 July 2019 18:34 UTC](https://discourse.nodered.org/t/threading-async-questions/12879/2 "2019-07-03T18:34:23Z")

</div>

The exec node uses the callbacks available.
