πŸ’»
Albert's Til
GitHub
  • 맀일맀일 μ‘°κΈˆμ”© μ„±μž₯ν•˜κΈ°
    • README
    • CS
      • Network
      • HTTP
        • NO-CACHE
      • 였λ₯˜ μ½”λ“œ
      • ORM 도ꡬ
      • Design Pattern
        • CQRS Pattern
          • Event Sourcing and CQRS pattern
        • Builder Pattern
    • DB
      • MySQL
        • Timeline
        • Pagination
        • Index
        • Database Performance Optimization Strategies
        • B+ tree
        • MySQL Connectors VS MySQL Shell(Scripting) VS MySQL Workbench
        • MySQL Storage Engine Architecture
      • Normalization & Denormalization
      • JPA
        • @Transactional
        • Why JPA?
        • About JPA
        • N+1 Issue
        • Index
        • ElementCollection&CollectionTable
        • orphanRemoval
        • CascadeType
        • Use Subselect
        • Dynamic Instance Creation
        • Paging
        • Order
        • Spefication
        • mappedBy
      • MongoDB
        • ObjectId
      • Why MySQL?
      • ACID properties of transactions
      • Between JPA and JDBC
      • Identifiers in Hibernate/JPA
    • Java
      • Jackson de/serialize
      • Collections.singletonList() vs List.of()
      • Manage dependencies in Gradle
      • Logging Level
      • Bean Validation
      • JVM Internals
        • Threads
          • Frame
        • Shared Between Threads
          • Classloader
            • Class Loader Hierarchy
            • Loading Linking Initialization
      • Java Collection Framework
      • Annotation
      • Generic
      • λ””λ―Έν„° 법칙
    • Spring
      • Caching
      • Spring Integration Overview
        • ThreadPollTaskExecutor
        • Messaging Bridge
        • Channel Adapter
        • Poller
        • Configuration and @EnableIntegration
        • Message Endpoints
        • Message Channels
      • HATEOAS
      • @Autowired vs Constructor Dependency Injection
      • Spring Security
        • JWT 토큰 μ‚¬μš©ν•œ 인가
        • OAuth 2 Login
        • OAuth 2 인증
        • 인가
        • 인증
        • PasswordEncoder
      • IoC Container
      • Filter,Interceptor,AOP,Argument Resolver
      • Spring Annotation
      • About Spring
    • Kafka
      • Error Channel
    • Infra
      • Scale Up || Scale Out
      • Docker
        • Dockerfile
        • Docker Hub Deploy
        • Command
      • Cloud μœ ν˜•
        • Infrastructure as a Service
        • Platform as a Service
        • Software as a Service
      • 무쀑단 배포
        • μ—”μ§„μ—‘μŠ€(Nginx)
      • μ½”λ“œ μžλ™ 배포
        • Technical
      • AWS EC2
        • PEM(Privacy Enhanced Mail) ν‚€
      • AWS RDS
      • AWS S3
    • CodeSquad
      • Spring Boot Project 1μ£Όμ°¨ 회고
      • Spring Boot Project 2μ£Όμ°¨ 회고
      • Spirng Boot Project 3μ£Όμ°¨ 회고
      • Spring Boot Project 4μ£Όμ°¨ 회고
    • Foody Moody ν”„λ‘œμ νŠΈ
      • Query Performance Comparison
      • HeartCount Asynchronous Issue
      • DeferredResult
      • ResponseBodyEmitter
      • SseEmitter (Spring)
      • Server-Sent Events (SSE)
      • 기술 μŠ€νƒ 적용 이유
      • NO-CACHE(HTTP)
      • Transactional
    • DDD
      • AggregateId
    • Test
      • RestAssured
    • Coding and Algorithmic Problems
      • 819. Most Common Word
      • 344. Reverse String
      • 125. Valid Palindrome
      • 937. Reorder Data in Log Files
    • Node
      • Async... Await...
      • Custom Transactional Decorator Challenger
    • Python
      • Python Basic Grammar
        • Comments and Input/Output
        • Variable
        • Data type
        • Operations and syntax
        • List,Tuple,Dictionary,Set
        • Function
        • Conditional statement
        • Loop
    • HTML
      • HTML Basic
      • HTML Basic Tags
      • HTML Form Tags
      • HTML Table Tags
    • CSS
      • CSS Basic
      • CSS Practice
Powered by GitBook
On this page
  • Each frame contains:
  • Local Vairable Array
  • Operand Stack
  • Dynamic Linking

Was this helpful?

  1. 맀일맀일 μ‘°κΈˆμ”© μ„±μž₯ν•˜κΈ°
  2. Java
  3. JVM Internals
  4. Threads

Frame

λͺ¨λ“  λ©”μ„œλ“œ ν˜ΈμΆœμ— λŒ€ν•΄ μƒˆ frame이 μƒμ„±λ˜κ³  stack 맨 μœ„μ— μΆ”κ°€(ν‘Έμ‹œ)λ©λ‹ˆλ‹€. λ©”μ„œλ“œκ°€ μ •μƒμ μœΌλ‘œ λ°˜ν™˜λ˜κ±°λ‚˜ λ©”μ„œλ“œ 호좜 쀑에 ν¬μ°©λ˜μ§€ μ•Šμ€ μ˜ˆμ™Έκ°€ λ°œμƒν•˜λ©΄ frame이 제거(팝)λ©λ‹ˆλ‹€. μ˜ˆμ™Έ μ²˜λ¦¬μ— λŒ€ν•œ μžμ„Έν•œ λ‚΄μš©μ€ μ•„λž˜ μ˜ˆμ™Έ ν…Œμ΄λΈ” μ„Ήμ…˜μ„ μ°Έμ‘°ν•˜μ„Έμš”.

Each frame contains:

  • Local variable array - μ§€μ—­ λ³€μˆ˜ λ°°μ—΄

  • Return value - λ°˜ν™˜ κ°’

  • Operand stack - ν”Όμ—°μ‚°μž μŠ€νƒ

  • ν˜„μž¬ λ©”μ„œλ“œμ˜ ν΄λž˜μŠ€μ— λŒ€ν•œ λŸ°νƒ€μž„ μƒμˆ˜ 풀에 λŒ€ν•œ μ°Έμ‘°

Local Vairable Array

둜컬 λ³€μˆ˜μ˜ λ°°μ—΄μ—λŠ” this에 λŒ€ν•œ μ°Έμ‘°, λͺ¨λ“  λ©”μ„œλ“œ 맀개 λ³€μˆ˜ 및 기타 둜컬둜 μ •μ˜λœ λ³€μˆ˜λ₯Ό ν¬ν•¨ν•˜μ—¬ λ©”μ„œλ“œ μ‹€ν–‰ 쀑에 μ‚¬μš©λ˜λŠ” λͺ¨λ“  λ³€μˆ˜κ°€ ν¬ν•¨λ©λ‹ˆλ‹€. 클래슀 λ©”μ†Œλ“œ(즉, 정적 λ©”μ†Œλ“œ)의 경우 λ©”μ†Œλ“œ λ§€κ°œλ³€μˆ˜λŠ” 0λΆ€ν„° μ‹œμž‘ν•˜μ§€λ§Œ μΈμŠ€ν„΄μŠ€ λ©”μ†Œλ“œμ˜ 경우 this μœ„ν•΄ 0 슬둯이 μ˜ˆμ•½λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

μ§€μ—­ λ³€μˆ˜λŠ” λ‹€μŒκ³Ό 같을 수 μžˆμŠ΅λ‹ˆλ‹€

  • boolean

  • byte

  • char

  • long

  • short

  • int

  • float

  • double

  • reference

  • returnAddress

long 및 double을 μ œμ™Έν•˜κ³  λͺ¨λ“  μœ ν˜•μ€ μ§€μ—­ λ³€μˆ˜ λ°°μ—΄μ—μ„œ 단일 μŠ¬λ‘―μ„ μ‚¬μš©ν•©λ‹ˆλ‹€. long 및 double은 두 λ°° λ„ˆλΉ„(32λΉ„νŠΈ λŒ€μ‹  64λΉ„νŠΈ)이기 λ•Œλ¬Έμ— λ‘˜ λ‹€ 두 개의 연속 μŠ¬λ‘―μ„ μ‚¬μš©ν•©λ‹ˆλ‹€.

Operand Stack

ν”Όμ—°μ‚°μž stack은 λ²”μš© λ ˆμ§€μŠ€ν„°κ°€ native CPUμ—μ„œ μ‚¬μš©λ˜λŠ” 것과 μœ μ‚¬ν•œ λ°©μ‹μœΌλ‘œ λ°”μ΄νŠΈ μ½”λ“œ λͺ…λ Ήμ–΄ μ‹€ν–‰ 쀑에 μ‚¬μš©λ©λ‹ˆλ‹€. λŒ€λΆ€λΆ„μ˜ JVM λ°”μ΄νŠΈ μ½”λ“œλŠ” 값을 μƒμ„±ν•˜κ±°λ‚˜ μ†ŒλΉ„ν•˜λŠ” μž‘μ—…μ„ ν‘Έμ‹œ, νŒν•‘, 볡제, κ΅ν™˜ λ˜λŠ” μ‹€ν–‰ν•˜μ—¬ ν”Όμ—°μ‚°μž stack을 μ‘°μž‘ν•˜λŠ” 데 μ‹œκ°„μ„ λ³΄λƒ…λ‹ˆλ‹€. λ”°λΌμ„œ 둜컬 λ³€μˆ˜ λ°°μ—΄κ³Ό ν”Όμ—°μ‚°μž μŠ€νƒ 간에 값을 μ΄λ™ν•˜λŠ” λͺ…령은 λ°”μ΄νŠΈ μ½”λ“œμ—μ„œ 맀우 자주 μ‚¬μš©λ©λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄ κ°„λ‹¨ν•œ λ³€μˆ˜ μ΄ˆκΈ°ν™”λ‘œ 인해 ν”Όμ—°μ‚°μž μŠ€νƒκ³Ό μƒν˜Έ μž‘μš©ν•˜λŠ” 두 개의 λ°”μ΄νŠΈ μ½”λ“œκ°€ μƒμ„±λ©λ‹ˆλ‹€.

int i;

λ‹€μŒ λ°”μ΄νŠΈ μ½”λ“œλ‘œ μ»΄νŒŒμΌλ©λ‹ˆλ‹€.

iconst_0      // ν”Όμ—°μ‚°μž stack 맨 μœ„λ‘œ 0 ν‘Έμ‹œ
istore_1      // ν”Όμ—°μ‚°μž stack 맨 μœ„μ—μ„œ 값을 νŒν•˜κ³  둜컬 λ³€μˆ˜ 1둜 μ €μž₯

둜컬 λ³€μˆ˜ λ°°μ—΄, ν”Όμ—°μ‚°μž μŠ€νƒ 및 λŸ°νƒ€μž„ μƒμˆ˜ ν’€ κ°„μ˜ μƒν˜Έ μž‘μš©μ— λŒ€ν•œ μžμ„Έν•œ μ„€λͺ…은 μ•„λž˜ 클래슀 파일 ꡬ쑰 μ„Ήμ…˜μ„ μ°Έμ‘°ν•©λ‹ˆλ‹€.

Dynamic Linking

각 ν”„λ ˆμž„μ—λŠ” λŸ°νƒ€μž„ μƒμˆ˜ 풀에 λŒ€ν•œ μ°Έμ‘°κ°€ ν¬ν•¨λ©λ‹ˆλ‹€. μ°Έμ‘°λŠ” ν•΄λ‹Ή frame에 λŒ€ν•΄ μ‹€ν–‰ 쀑인 λ©”μ„œλ“œμ˜ ν΄λž˜μŠ€μ— λŒ€ν•œ μƒμˆ˜ 풀을 κ°€λ¦¬ν‚΅λ‹ˆλ‹€. 이 μ°Έμ‘°λŠ” 동적 연결을 μ§€μ›ν•˜λŠ” 데 도움이 λ©λ‹ˆλ‹€.

C/C++ μ½”λ“œλŠ” 일반적으둜 객체 파일둜 컴파일된 λ‹€μŒ μ—¬λŸ¬ 객체 파일이 ν•¨κ»˜ μ—°κ²°λ˜μ–΄ μ‹€ν–‰ νŒŒμΌμ΄λ‚˜ dllκ³Ό 같은 μ‚¬μš© κ°€λŠ₯ν•œ μ•„ν‹°νŒ©νŠΈλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€. μ—°κ²° 단계 λ™μ•ˆ 각 객체 파일의 symbolic μ°Έμ‘°λŠ” μ΅œμ’… μ‹€ν–‰ νŒŒμΌμ— μƒλŒ€μ μΈ μ‹€μ œ λ©”λͺ¨λ¦¬ μ£Όμ†Œλ‘œ λŒ€μ²΄λ©λ‹ˆλ‹€. Javaμ—μ„œ 이 μ—°κ²° λ‹¨κ³„λŠ” λŸ°νƒ€μž„μ— λ™μ μœΌλ‘œ μˆ˜ν–‰λ©λ‹ˆλ‹€.

Java ν΄λž˜μŠ€κ°€ 컴파일되면 λ³€μˆ˜ 및 λ©”μ†Œλ“œμ— λŒ€ν•œ λͺ¨λ“  μ°Έμ‘°κ°€ symbolic 참쑰둜 클래슀의 μƒμˆ˜ 풀에 μ €μž₯λ©λ‹ˆλ‹€. symbolic μ°Έμ‘°λŠ” μ‹€μ œ λ©”λͺ¨λ¦¬ μœ„μΉ˜λ₯Ό μ‹€μ œλ‘œ κ°€λ¦¬ν‚€λŠ” μ°Έμ‘°κ°€ μ•„λ‹Œ 논리적 μ°Έμ‘°μž…λ‹ˆλ‹€. JVM κ΅¬ν˜„μ€ symbolic μ°Έμ‘°λ₯Ό 확인할 μ‹œκΈ°λ₯Ό 선택할 수 μžˆμŠ΅λ‹ˆλ‹€. 이것은 λ‘œλ“œλœ ν›„ 클래슀 파일이 확인될 λ•Œ λ°œμƒν•  수 있으며 eager λ˜λŠ” static resolution이라고 ν•©λ‹ˆλ‹€. λŒ€μ‹  symbolic μ°Έμ‘°κ°€ 처음으둜 μ‚¬μš©λ˜λŠ” 경우 lazy or late resolution이라고 ν•©λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ JVM은 각 μ°Έμ‘°κ°€ 처음 μ‚¬μš©λ  λ•Œ resolution이 λ°œμƒν•œ κ²ƒμ²˜λŸΌ λ™μž‘ν•΄μ•Ό ν•˜λ©° 이 μ‹œμ μ—μ„œ resolution 였λ₯˜λ₯Ό λ°œμƒμ‹œμΌœμ•Ό ν•©λ‹ˆλ‹€. 바인딩은 symbolic 참쑰둜 μ‹λ³„λ˜λŠ” ν•„λ“œ, λ©”μ„œλ“œ λ˜λŠ” ν΄λž˜μŠ€κ°€ 직접 참쑰둜 λŒ€μ²΄λ˜λŠ” ν”„λ‘œμ„ΈμŠ€μ΄λ©° symbolic μ°Έμ‘°κ°€ μ™„μ „νžˆ λŒ€μ²΄λ˜κΈ° λ•Œλ¬Έμ— ν•œ 번만 λ°œμƒν•©λ‹ˆλ‹€. symbolic μ°Έμ‘°κ°€ 아직 ν•΄κ²°λ˜μ§€ μ•Šμ€ 클래슀λ₯Ό μ°Έμ‘°ν•˜λŠ” 경우 이 ν΄λž˜μŠ€κ°€ λ‘œλ“œλ©λ‹ˆλ‹€. 각 직접 μ°Έμ‘°λŠ” λ³€μˆ˜ λ˜λŠ” λ©”μ„œλ“œμ˜ λŸ°νƒ€μž„ μœ„μΉ˜μ™€ κ΄€λ ¨λœ μ €μž₯ ꡬ쑰에 λŒ€ν•œ μ˜€ν”„μ…‹μœΌλ‘œ μ €μž₯λ©λ‹ˆλ‹€.

Last updated 2 years ago

Was this helpful?