# Programming Kotlin: Difference between SupervisorJob() and supervisorScope (324, 325)

**URL:** <https://forum.devtalk.com/t/programming-kotlin-difference-between-supervisorjob-and-supervisorscope-324-325/7810>\
**Category:** PragProg Customers\
**Tags:** question, book-programming-kotlin\
**Created:** [12 March 2021 14:31 UTC](https://forum.devtalk.com/t/programming-kotlin-difference-between-supervisorjob-and-supervisorscope-324-325/7810 "2021-03-12T14:31:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![venkats](https://forum.devtalk.com/user_avatar/forum.devtalk.com/venkats/32/508_2.png) [@venkats](https://forum.devtalk.com/u/venkats)\
**Post date:** [14 March 2021 03:10 UTC](https://forum.devtalk.com/t/programming-kotlin-difference-between-supervisorjob-and-supervisorscope-324-325/7810/2 "2021-03-14T03:10:18Z")

</div>

Hi @HarryDeveloper,

Thank you for the query.

The supervisorScope is a syntax sugar or a convenience function for creating a SupervisorJob. If the child coroutines run in a different SupervisorJob than the parent, then the cancellation of a Chile does not propagate to the parent.

It is much better to use supervisorScope than to use SupervisorJob, but from the curiosity point of view, you may try to create a SupervisorJob, something like this:

val job = launch([Dispatchers.IO](http://Dispatchers.IO) + SupervisorJob() + handler) {

```
val supervisor = SupervisorJob()

launch(coroutineContext + supervisor) { fetchResponse(200, 5000) }
launch(coroutineContext + supervisor) { fetchResponse(200, 1000) }
launch(coroutineContext + supervisor) { fetchResponse(200, 3000) }

supervisor.children.forEach { it. join() }

/*
supervisorScope {
  launch { fetchResponse(200, 5000) }
  launch { fetchResponse(200, 1000) }
  launch { fetchResponse(200, 3000) }
}
*/

```

}

job.join()

Hope that answers your question.

Regards,

Venkat

---

_[View the full topic](https://forum.devtalk.com/t/programming-kotlin-difference-between-supervisorjob-and-supervisorscope-324-325/7810)._
