Golang

Software Infrastructure
5 de Jul de 2017
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
Golang
1 de 48

Más contenido relacionado

La actualidad más candente

Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageAniruddha Chakrabarti
Go Language presentationGo Language presentation
Go Language presentationGh-Mohammed Eldadah
Go Programming language, golangGo Programming language, golang
Go Programming language, golangBasil N G
Go language presentationGo language presentation
Go language presentationparamisoft
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventuremylittleadventure
Introduction to Go programming languageIntroduction to Go programming language
Introduction to Go programming languageSlawomir Dorzak

Similar a Golang

Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCTim Burks
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4Max Kleiner
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP PerspectiveBarry Jones
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)goccy
Go fundamentalsGo fundamentals
Go fundamentalsRon Barabash
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using SwiftDiego Freniche Brito

Más de Software Infrastructure

KotlinKotlin
KotlinSoftware Infrastructure
NoSqlNoSql
NoSqlSoftware Infrastructure
Stream AnalyticsStream Analytics
Stream AnalyticsSoftware Infrastructure
Quartz SchedulerQuartz Scheduler
Quartz SchedulerSoftware Infrastructure
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentSoftware Infrastructure
Deep Learning Deep Learning
Deep Learning Software Infrastructure

Último

Unit 4 Food packaging materials and testing.pptxUnit 4 Food packaging materials and testing.pptx
Unit 4 Food packaging materials and testing.pptxDr P DINESHKUMAR
manorma presentation.ppsxmanorma presentation.ppsx
manorma presentation.ppsxAshoka instittute of technology and management
Airbus A321 Aircraft Airport & Maintenance Planning Manual PDF.pdfAirbus A321 Aircraft Airport & Maintenance Planning Manual PDF.pdf
Airbus A321 Aircraft Airport & Maintenance Planning Manual PDF.pdfTahirSadikovi
Design HVAC System for Hospital Design HVAC System for Hospital
Design HVAC System for Hospital Mohammed Abdulhabeb Ahmed
North American YAT-28 Turbo Trojan.pdfNorth American YAT-28 Turbo Trojan.pdf
North American YAT-28 Turbo Trojan.pdfTahirSadikovi
Bricks.pptxBricks.pptx
Bricks.pptxSubhamSharma20947

Golang

Notas del editor

  1. 1.9v is expected to released in August, 2017. Now Rc2 Parallel Compilation  The Go compiler now supports compiling a package's functions in parallel, taking advantage of multiple cores. This is in addition to the go command's existing support for parallel compilation of separate packages. Parallel compilation is on by default, but can be disabled by setting the environment variable GO19CONCURRENTCOMPILATIONto 0.
  2. Go team ( https://www.youtube.com/watch?v=sln-gJaURzk )
  3. https://talks.golang.org/2012/splash.article
  4. C, C++ written build server takes 45 minutes. ( include library ), With Go takes 5 minutes (Splash 2012 conf) C open header file recursively so I/O so much
  5. https://play.golang.org/
  6. Syntax ( Hello SGM )
  7. Every time the function foo is called, eight megabytes of memory has to be allocated on the stack. Then the value of the array, all eight megabytes of memory, has to be copied into that allocation. Go can handle this copy operation, but there’s a better and more efficient way of doing this. You can pass a pointer to the array and only copy eight bytes, instead of eight megabytes of memory on the stack This time the function foo takes a pointer to an array of one million elements of type integer. The function call now passes the address of the array, which only requires eight bytes of memory to be allocated on the stack for the pointer variable.
  8. // Contains a length of 2 and capacity of 4 elements. newSlice := slice[1:3] (20,30) For slice[i:j] with an underlying array of capacity k Length: j - i Capacity: k – I For slice[1:3] with an underlying array of capacity 5 Length: 3 - 1 = 2 Capacity: 5 - 1 = 4 The append operation is clever when growing the capacity of the underlying array. Capacity is always doubled when the existing capacity of the slice is under 1,000 elements. Once the number of elements goes over 1,000, the capacity is grown by a factor of 1.25, or 25%. This growth algorithm may change in the language over time.
  9. This in itself isn't enough to replace inheritance, as embedding provides no form of polymorphism. In other languages, inheritance hierarchies need to be carefully designed because changes are wide sweeping and therefore hard to do. Go avoids these pitfalls while providing a powerful alternative. Shadowing: defining another function or field with the same name Type Base struct { X.A //int A string X.Base.A //string B float64 X.B //float64 } Type Derived struct { Base A int }
  10. To implement an interface in Go, we just need to implement all the methods in the interface. Here we implement geometry on rects.
  11. When an import statement uses the dot identifier (.) for an import path, it causes members of the imported package to be merged in scope with that of the importing package. Therefore, imported members may be referenced without additional qualifiers
  12. Sometimes a running goroutine may need to perform a blocking syscall, such as opening a file. When this happens, the thread and goroutine are detached from the logical processor and the thread continues to block waiting for the syscall to return. In the meantime, there’s a logical processor without a thread. So the scheduler creates a new thread and attaches it to the logical processor. Then the scheduler will choose another goroutine from the local run queue for execution. Once the syscall returns, the goroutine is placed back into a local run queue, and the thread is put aside for future use. If a goroutine needs to make a network I/O call, the process is a bit different. In this case, the goroutine is detached from the logical processor and moved to the runtime integrated network poller. Once the poller indicates a read or write operation is ready, the goroutine is assigned back to a logical processor to handle the operation There’s no restriction built into the scheduler for the number of logical processors that can be created. But the runtime limits each program to a maximum of 10,000 threads by default. This value can be changed by calling the SetMaxThreads function from the runtime/debug package. If any program attempts to use more threads, the program crashes.
  13. Concurrency is not parallelism. Parallelism can only be achieved when multiple pieces of code are executing simultaneously against different physical processors. Parallelism is about doing a lot of things at once. Concurrency is about managing a lot of things at once. In many cases, concurrency can outperform parallelism, because the strain on the operating system and hardware is much less, which allows the system to do more If you want to run goroutines in parallel, you must use more than one logical processor. When there are multiple logical processors, the scheduler will evenly distribute goroutines between the logical processors. This will result in goroutines running on different threads It’s not recommended to blindly change the runtime default for a logical processor. The scheduler contains intelligent algorithms that are updated and improved with every release of Go
  14. An unbuffered channel is a channel with no capacity to hold any value before it’s received. These types of channels require both a sending and receiving goroutine to be ready at the same instant before any send or receive operation can complete. If the two goroutines aren’t ready at the same instant, the channel makes the goroutine that performs its respective send or receive operation first wait In step 1 the two goroutines approach the channel, but neither have issued a send or receive yet. In step 2 the goroutine on the left sticks its hand into the channel, which simulates a send on the channel. At this point, that goroutine is locked in the channel until the exchange is complete. In step 3 the goroutine on the right places its hand into the channel, which simulates a receive on the channel. That goroutine is now locked in the channel until the exchange is complete. In steps 4 and 5 the exchange is made and finally, in step 6, both goroutines are free to remove their hands, which simulates the release of the locks.
  15. A buffered channel is a channel with capacity to hold one or more values before they’re received. These types of channels don’t force goroutines to be ready at the same instant to perform sends and receives. There are also different conditions for when a send or receive does block. A receive will block only if there’s no value in the channel to receive. A send will block only if there’s no available buffer to place the value being sent. This leads to the one big difference between unbuffered and buffered channels: An unbuffered channel provides a guarantee that an exchange between two goroutines is performed at the instant the send and receive take place. A buffered channel has no such guarantee. In step 1 the goroutine on the right is in the process of receiving a value from the channel. In step 2 that same goroutine is able to complete the receive independent of the goroutine on the left sending a new value into the channel. In step 3 the goroutine on the left is sending a new value into the channel while the goroutine on the right is receiving a different value. Neither of these two operations in step 3 are in sync with each other or blocking. Finally, in step 4 all the sends and receives are complete and we have a channel with several values and room for more.
  16. Two types of garbage collector: Reference Counting: Each object has a count of other objects referencing it Sensitive to cycle referencing Not real-time Must be atomic Increasing space overhead Tracing garbage collector: Determine which objects are reachable from a certain «root» object Unreachable objects are considerable as garbage