Go Routines - LogeshVel/go_programs GitHub Wiki

image

image

image

image

image

Synchronization - WaitGroup

image

image

image

Goroutine Communication

image

Channels

image

image

image

image

Buffered channel

image

image

image

image

Iterating through channel

image

image

Select statement

image

image

image

image

Default select

image

sharing resources

image

image

image

Interleaving happens at the machine code instructions. Since a simple source code instruction has many machine code instructions

image

image

Mutex

image

image

image

image

Once Synchronization

image

Sync.Once

image

image

image

*Note: Ignore the capitalization typo in the next slide

image

Deadlock

image

image

image

image

image

image

Quiz

image

image

image

image

deadlock cannot always be detected by the Golang runtime. The First level of dead locks can be detected by the runtime. but the subset of deadlocks cannot be detected. Subset means a go routine calls another go routine and that go routine depends on another go routine made some daedlock in the second hierarchy level

image