Skip to content

Basic example of accessing a shared resource in a concurrent environment with Go

Notifications You must be signed in to change notification settings

santiagobenitez/go-concurrency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

#Golang concurrency example I am getting started with Go language and as a first example I wanted to try the concurrency model of Go. The idea of this code is to have a shared resource, in this case is the people variable which is a slice of Person. It's simulating the access to a database to get all of the persons only once and then caching them in memory. Next calls to get the all the persons will read from memory instead of db.

In order to simulate concurrency I created several goroutines running in parallel and asking continously for all of the persons. The output will print the number of operations done, the number of db reads done and the number of cache reads.

About

Basic example of accessing a shared resource in a concurrent environment with Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages