# Goroutine 기초 (Go) > Goroutine, go 키워드, sync.WaitGroup, runtime.GOMAXPROCS, goroutine 누수 - 20 면접 질문 - Junior - [면접 질문: Go](https://sharpskill.dev/ko/technologies/go/interview-questions.md) ## 1. Go에서 goroutine이란 무엇입니까? **답변** goroutine은 다른 함수와 동시에 실행되는 함수로, OS가 아닌 Go 런타임이 관리합니다. OS 스레드(수 MB)에 비해 매우 가볍습니다(초기 스택이 수 KB). Go 스케줄러는 수천, 심지어 수백만 개의 goroutine을 제한된 수의 OS 스레드에 멀티플렉싱할 수 있어 Go에서 동시성을 매우 쉽게 다룰 수 있습니다. ## 2. Go에서 새로운 goroutine을 시작하려면 어떻게 합니까? **답변** go 키워드 뒤에 함수 호출을 붙이면 새로운 goroutine이 시작됩니다. 예를 들어 'go myFunction()' 또는 익명 함수의 경우 'go func() { ... }()' 와 같이 작성합니다. goroutine은 호출하는 코드와 병렬로 즉시 실행됩니다. 주의: main 함수는 실행한 goroutine이 끝나기를 자동으로 기다리지 않습니다. ## 3. goroutine과 OS 스레드의 주요 차이점은 무엇입니까? **답변** goroutine은 초기 스택으로 약 2 KB를 사용하지만 OS 스레드는 일반적으로 1~2 MB가 필요합니다. Go runtime은 사용자 공간에서 goroutine의 scheduling을 관리하며(M:N scheduling), 수천 개의 goroutine을 몇 개의 OS 스레드에 멀티플렉싱합니다. 이를 통해 리소스에 의해 제한되는 OS 스레드와 달리 시스템에 부담을 주지 않고 수백만 개의 goroutine을 생성할 수 있습니다. ## 17개 추가 질문 이용 가능 - 메인 프로그램이 goroutine이 끝나기 전에 종료되면 어떻게 됩니까? - Go runtime은 goroutine 실행을 어떻게 관리합니까? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 Go 면접 주제 - [Go 기초](https://sharpskill.dev/ko/technologies/go/interview-questions/go-basics.md): 25개 질문, Junior - [Go 데이터 구조](https://sharpskill.dev/ko/technologies/go/interview-questions/go-data-structures.md): 20개 질문, Junior - [Go 인터페이스](https://sharpskill.dev/ko/technologies/go/interview-questions/go-interfaces.md): 18개 질문, Junior - [에러 처리](https://sharpskill.dev/ko/technologies/go/interview-questions/error-handling.md): 20개 질문, Junior - [Channels](https://sharpskill.dev/ko/technologies/go/interview-questions/channels.md): 22개 질문, Junior - [Go Modules](https://sharpskill.dev/ko/technologies/go/interview-questions/go-modules.md): 18개 질문, Mid-Level - [HTTP 서버](https://sharpskill.dev/ko/technologies/go/interview-questions/http-server.md): 24개 질문, Mid-Level - [HTTP 클라이언트](https://sharpskill.dev/ko/technologies/go/interview-questions/http-client.md): 18개 질문, Mid-Level - [JSON 인코딩](https://sharpskill.dev/ko/technologies/go/interview-questions/json-encoding.md): 20개 질문, Mid-Level - [Database/SQL](https://sharpskill.dev/ko/technologies/go/interview-questions/database-sql.md): 22개 질문, Mid-Level - [context 패키지](https://sharpskill.dev/ko/technologies/go/interview-questions/context-package.md): 20개 질문, Mid-Level - [Testing](https://sharpskill.dev/ko/technologies/go/interview-questions/testing.md): 22개 질문, Mid-Level - [동시성 패턴](https://sharpskill.dev/ko/technologies/go/interview-questions/concurrency-patterns.md): 24개 질문, Mid-Level - [동기화 프리미티브](https://sharpskill.dev/ko/technologies/go/interview-questions/sync-primitives.md): 22개 질문, Mid-Level - [Go 웹 프레임워크](https://sharpskill.dev/ko/technologies/go/interview-questions/go-web-frameworks.md): 20개 질문, Mid-Level - [REST API 설계](https://sharpskill.dev/ko/technologies/go/interview-questions/rest-api-design.md): 20개 질문, Mid-Level - [gRPC](https://sharpskill.dev/ko/technologies/go/interview-questions/grpc.md): 22개 질문, Mid-Level - [Reflection](https://sharpskill.dev/ko/technologies/go/interview-questions/reflection.md): 20개 질문, Senior - [메모리 관리](https://sharpskill.dev/ko/technologies/go/interview-questions/memory-management.md): 24개 질문, Senior - [성능 최적화](https://sharpskill.dev/ko/technologies/go/interview-questions/performance-optimization.md): 22개 질문, Senior - [Generics](https://sharpskill.dev/ko/technologies/go/interview-questions/generics.md): 20개 질문, Senior - [Go Design Patterns](https://sharpskill.dev/ko/technologies/go/interview-questions/design-patterns.md): 24개 질문, Senior - [Microservices](https://sharpskill.dev/ko/technologies/go/interview-questions/microservices.md): 24개 질문, Senior - [보안 및 인증](https://sharpskill.dev/ko/technologies/go/interview-questions/security-authentication.md): 24개 질문, Senior - [Docker & Containerization](https://sharpskill.dev/ko/technologies/go/interview-questions/docker-containerization.md): 20개 질문, Senior - [Kubernetes Basics](https://sharpskill.dev/ko/technologies/go/interview-questions/kubernetes-basics.md): 22개 질문, Senior - [고급 Go](https://sharpskill.dev/ko/technologies/go/interview-questions/advanced-go.md): 20개 질문, Senior - [CLI 개발](https://sharpskill.dev/ko/technologies/go/interview-questions/cli-development.md): 20개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/go/interview-questions/goroutines-basics