Go routines and thread safe data structures
Using a supermarket queuing system as an example we are going to examine what it means to write code sequentially and the benefits we can get by processing things in parallel. Luckily Go’s routines is a straightforward way to delegate responsibility of executing a piece of code away from the main thread of a program and you can use more than one at the same time!
Off course nothing is gained with zero cost so we are going to also cover what issues and pitfalls we may encounter if we do this in an “unsafe” way. Working with Wait Groups and Locks we are going to define data structures that are safe to read from, that allow us to share data between routines whilst significantly speeding up the entire processing.
Eleni is a Software Engineer with 14 years of experience in leading software teams, building applications and automating manual processes. She holds a PhD in Computer Science, lives in the UK and is the Tech Lead of Business Banking at Monzo Bank. Go is her current programming language and has also worked with PHP and Python. She is particularly interested in the challenges that come with scaling engineering teams, enjoys periodically blogging about all things technology and her experiences of leading teams and working with algorithms.