
Advanced Go
Compiler internals, runtime, scheduler, cgo, unsafe package, assembly, build tags
1Which Go toolchain tool allows inspecting the assembly code generated by the compiler?
Which Go toolchain tool allows inspecting the assembly code generated by the compiler?
Resposta
The go tool compile -S command displays the assembly code generated by the Go compiler. This tool is essential for understanding compiler optimizations and analyzing performance-critical code. It is also possible to use go build -gcflags=-S to achieve the same result during a standard build.
2What is the main purpose of the unsafe package in Go?
What is the main purpose of the unsafe package in Go?
Resposta
The unsafe package allows bypassing Go's type system to perform low-level memory operations. It exposes functions like Pointer, Sizeof, Alignof, and Offsetof that enable direct memory address manipulation. Its use is discouraged except for specific cases like interoperability with C code or critical optimizations.
3How does the Go scheduler (GPM) organize goroutine execution?
How does the Go scheduler (GPM) organize goroutine execution?
Resposta
The Go scheduler uses the GPM model: G represents goroutines, P represents logical processors (GOMAXPROCS), and M represents system threads. Each P has a local run queue of goroutines. When an M is blocked on a syscall, the P can be detached and associated with another M to continue goroutine execution. This design enables efficient scheduling with minimal context switches.
What is cgo and in which context should it be used?
Which directive allows conditionally compiling code based on target OS or architecture?
+17 perguntas de entrevista
Outros temas de entrevista Go
Go Basics
Go Data Structures
Go Interfaces
Error Handling
Goroutines Basics
Channels
Go Modules
HTTP Server
HTTP Client
JSON Encoding
database/sql
Context Package
Testing
Concurrency Patterns
Sync Primitives
Go Web Frameworks
REST API Design
gRPC
Reflection
Memory Management
Performance Optimization
Generics
Go Design Patterns
Microservices
Security & Authentication
Docker & Containerization
Kubernetes Basics
CLI Development
Domine Go para sua proxima entrevista
Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.
Comece gratis