(WIP) Go Channel and Scheduler

Contents
go channel and scheduler
1. Go channels
Understanding Channels
Make channel
- G1, G2
- channel has mutex
- copy elements
If full?
P: context for scheduling
- P는 context를 들고 있으며, channel buffer가 full 되면 full된 버퍼로 task를 send하는 goroutine은 pausing되며 (receiver goroutine이 pause되는게 아니다.)
- go runtime scheduler로
gopark
이 호출하여, pause를 진행한다. - sender goroutine은 waiting state가 되며, 해당 고루틴의 os thread (M)과의 association을 지운다.
- Q. wait되는 goroutine은 어디에 저장되는가? (https://www.linkedin.com/pulse/golang-how-does-goroutine-parks-chung-yi-kao/ ) gobuf는 g struct안의 sched에서 사용된다.
- P가 들고있던 run queue에서 runnable goroutine을 pop한다.
2. Go scheduler
Go scheduler: Implementing language with lightweight concurrency