Home πŸ’Ύ [Operating System] Synchronization πŸ’Ύ
Post
Cancel

πŸ’Ύ [Operating System] Synchronization πŸ’Ύ

πŸ’Ύ Synchronization

동기화(Synchronization)은 νŠΉμ • μžμ›μ— μ ‘κ·Όν•  λ•Œ ν•œ 개의 Process(Thread)만 μ ‘κ·Όν•˜κ²Œ ν•˜κ±°λ‚˜ Process(Thread)λ₯Ό μ˜¬λ°”λ₯Έ μˆœμ„œλŒ€λ‘œ μ‹€ν–‰ν•˜λŠ” 것을 μ˜λ―Έν•©λ‹ˆλ‹€.

Process(Thread)의 동기화λ₯Ό 톡해 μ‹€ν–‰ μˆœμ„œμ™€ μžμ›μ˜ 일관성을 보μž₯ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

μ‹€ν–‰ μˆœμ„œ μ œμ–΄λ₯Ό μœ„ν•œ λ™κΈ°ν™”μƒν˜Έ 배제λ₯Ό μœ„ν•œ 동기화
λ™μ‹œμ— μ‹€ν–‰λ˜λŠ” Process(Thread)λ₯Ό μ˜¬λ°”λ₯Έ μˆœμ„œλŒ€λ‘œ μ‹€ν–‰ν•˜λŠ” κ²ƒκ³΅μœ μžμ›μ— λ™μ‹œμ— μ ‘κ·Όν•˜μ§€ λͺ»ν•˜κ²Œ ν•˜λŠ” 것
Β Race Condition이 λ°œμƒν•˜μ§€ μ•Šλ„λ‘ 두 개 μ΄μƒμ˜ Process(Thread)κ°€ μž„κ³„ ꡬ역에 λ™μ‹œμ— μ ‘κ·Όν•˜μ§€ λͺ»ν•˜λ„둝 κ΄€λ¦¬ν•˜λŠ” 것
  • κ³΅μœ μžμ›(Shared Resource): κ³΅λ™μœΌλ‘œ μ΄μš©ν•˜λŠ” λ³€μˆ˜, 파일, μž₯치 λ“±
  • Race Condition: μ—¬λŸ¬ Process(Thread)κ°€ λ™μ‹œ λ‹€λ°œμ μœΌλ‘œ μž„κ³„ κ΅¬μ—­μ˜ μ½”λ“œλ₯Ό μ‹€ν–‰ν•˜μ—¬ μƒκΈ°λŠ” 문제
  • μž„κ³„ ꡬ역(Critical Section): κ³΅μœ μžμ›μ— μ ‘κ·Όν•˜λŠ” μ½”λ“œ 쀑 λ™μ‹œμ— μ‹€ν–‰ν•˜λ©΄ λ¬Έμ œκ°€ λ°œμƒν•˜λŠ” μ½”λ“œ μ˜μ—­

πŸ’Ύ Synchronization Techniques

Monitor

  • Mutex Lock(MUTual Exclusion Lock): ν•˜λ‚˜μ˜ κ³΅μœ μžμ›μ— λ™μ‹œμ— μ ‘κ·Όν•˜μ§€ λͺ»ν•˜λ„둝 λ§Œλ“œλŠ” 도ꡬ
  • Counting Semaphore: ν•˜λ‚˜μ˜ κ³΅μœ μžμ›μ΄ μ•„λ‹Œ μ—¬λŸ¬ 개의 κ³΅μœ μžμ›μ— λŒ€ν•΄ 접근을 μ œμ–΄ν•˜λŠ” 쑰금 더 μΌλ°˜ν™”λœ λ°©μ‹μ˜ 동기화 도ꡬ
  • Monitor: κ³΅μœ μžμ›μ„ λ‹€λ£¨λŠ” Interface에 μ ‘κ·Όν•˜κΈ° μœ„ν•œ Queueλ₯Ό λ§Œλ“€κ³  Monitor μ•ˆμ— 항상 ν•˜λ‚˜μ˜ Process(Thread)만 λ“€μ–΄μ˜€λ„λ‘ ν•˜μ—¬ μƒν˜Έ 배제λ₯Ό μœ„ν•œ 동기화와 쑰건 λ³€μˆ˜λ₯Ό 톡해 μ‹€ν–‰ μˆœμ„œ μ œμ–΄λ₯Ό μœ„ν•œ 동기화λ₯Ό μ œκ³΅ν•˜λŠ” 동기화
This post is licensed under CC BY 4.0 by the author.

πŸ’Ύ [Operating System] CPU Scheduling πŸ’Ύ

πŸ’Ύ [Operating System] Deadlock πŸ’Ύ