Skip to content

Commit

Permalink
Go Scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya43 committed May 29, 2021
1 parent 28381f2 commit e73696e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,21 @@ Open-sourced software licensed under the [MIT license](http:https://opensource.org/lic
wg.Wait()
```

-----------
-----------

## Goroutines And Closures:
- Goroutines execute within the **same address space** they are created in.
- Goroutines can directly modify variables in the enclosing lexical block.

-----------

## Go Scheduler:
- Go runtime has mechanism known as **MN Scheduler**.
- Fo Scheduler runs in user space.
- Go Scheduler uses OS threads to schedule Goroutines for execution.
- **Goroutine runs in the context of OS threads.**
- Go runtime creates number of worker OS threads, equals to **`GOMAXPROCS` environment variable value**.
- **`GOMAXPROCS` default value is number of processors/cores on machine.**
- It is a responsibility of Go Scheduler to distribute runnable Goroutines on over multiple OS threads that are created.

## Goroutines And Closures:
- Goroutines execute within the **same address space** they are created in.
- Goroutines can directly modify variables in the enclosing lexical block.
-----------

0 comments on commit e73696e

Please sign in to comment.