Concurrency

Netcap is written in Golang, a language known for its powerful concurrency features and memory safety.

Go, commonly referred to as Golang, is a statically typed and compiled imperative systems programming language released by Google in 2009. It is syntactically similar to the C programming language, but adopted lots of ideas from other languages, such as Python and Erlang, in order to improve readability and productivity. Commonly used for network programming and backend implementation, Golang is known for its extremely fast compile time and generation of statically linked binaries, which are independent of any libraries on the execution environment.

Go is currently available in version 1.11.2 and provides a built- in model for concurrent execution and coordination of asynchronous processes, which was inspired by the Communicating Sequential Processes (CSP) paper. A asynchronous process is called a goroutine, which should not be confused with an operating system (OS) thread. Goroutines are multiplexed onto threads of the OS as required. In case a goroutine blocks, the corresponding OS thread blocks as well, but no other goroutine is affected. Goroutines are less computationally expensive compared to a thread and allocate resources dynamically as needed. For synchronization and messaging, Go offers channels as a lightweight way to communicate between goroutines. This design decision was inspired by the idea of sharing memory by communicating, instead of communicating by sharing memory.

Additionally, multi-way concurrent control is provided through select statements, which are used to receive data from channels. Another important aspect of Go is its rich platform and architecture support, which will be described in detail below. Besides that, the language offers a garbage collected runtime, and stack management, in order to combat memory corruptions. However, this should not be confused with the virtual machine approach of the Java runtime.

Although Go is not an object oriented programming language, it provides interfaces and the ability to define methods on structures. Go also enforces a uniform programming style for formatting the source code, which greatly helps increasing readability across code from different authors. It is noteworthy that Go provides functionality to circumvent the type system and runtime checks, by reading and writing to arbitrary memory addresses via the unsafe package. As of version 0.3.4 Netcap does not make use of this package.

Try the go tour: https://tour.golang.org/welcome/1