Directories ¶
Path | Synopsis |
---|---|
01-goroutines
|
|
example1
Sample program to show how to create goroutines and how the scheduler behaves.
|
Sample program to show how to create goroutines and how the scheduler behaves. |
example2
Sample program to show how the goroutine scheduler will time slice goroutines on a single thread.
|
Sample program to show how the goroutine scheduler will time slice goroutines on a single thread. |
example3
Sample program to show how to create goroutines and how the goroutine scheduler behaves with two contexts.
|
Sample program to show how to create goroutines and how the goroutine scheduler behaves with two contexts. |
exercises/exercise1
Create a program that declares two anonymous functions.
|
Create a program that declares two anonymous functions. |
exercises/template1
Create a program that declares two anonymous functions.
|
Create a program that declares two anonymous functions. |
02-race_conditions
|
|
example1
Sample program to show how to create race conditions in our programs.
|
Sample program to show how to create race conditions in our programs. |
example2
Sample program to show how to use the atomic package to provide safe access to numeric types.
|
Sample program to show how to use the atomic package to provide safe access to numeric types. |
example3
Sample program to show how to use the atomic package functions Store and Load to provide safe access to numeric types.
|
Sample program to show how to use the atomic package functions Store and Load to provide safe access to numeric types. |
example4
Sample program to show how to use a mutex to define critical sections of code that need synchronous access.
|
Sample program to show how to use a mutex to define critical sections of code that need synchronous access. |
example5
Sample program to show how to use a read/write mutex to define critical sections of code that needs synchronous access.
|
Sample program to show how to use a read/write mutex to define critical sections of code that needs synchronous access. |
exercises/exercise1
Answer for exercise 1 of Race Conditions.
|
Answer for exercise 1 of Race Conditions. |
exercises/template1
Fix the race condition in this program.
|
Fix the race condition in this program. |
03-channels
|
|
example1
Sample program to show how to use an unbuffered channel to simulate a game of tennis between two goroutines.
|
Sample program to show how to use an unbuffered channel to simulate a game of tennis between two goroutines. |
example2
Sample program to show how to use an unbuffered channel to simulate a relay race between four goroutines.
|
Sample program to show how to use an unbuffered channel to simulate a relay race between four goroutines. |
example3
This sample program demonstrates how to use a buffered channel to receive results from other goroutines in a guaranteed way.
|
This sample program demonstrates how to use a buffered channel to receive results from other goroutines in a guaranteed way. |
example4
This sample program demonstrates how to use a channel to monitor the amount of time the program is running and terminate the program if it runs too long.
|
This sample program demonstrates how to use a channel to monitor the amount of time the program is running and terminate the program if it runs too long. |
exercises/exercise1
Write a program where two goroutines pass an integer back and forth ten times.
|
Write a program where two goroutines pass an integer back and forth ten times. |
exercises/exercise2
Write a problem that uses a buffered channel to maintain a buffer of four strings.
|
Write a problem that uses a buffered channel to maintain a buffer of four strings. |
exercises/template1
Write a program where two goroutines pass an integer back and forth ten times.
|
Write a program where two goroutines pass an integer back and forth ten times. |
exercises/template2
Write a problem that uses a buffered channel to maintain a buffer of four strings.
|
Write a problem that uses a buffered channel to maintain a buffer of four strings. |
Click to show internal directories.
Click to hide internal directories.