File Systems - hochan222/Everything-in-JavaScript GitHub Wiki

๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ”๋กœ๊ฐ€๊ธฐ

File and File System

  • File
    • "A named collection of related information"
    • ์ผ๋ฐ˜์ ์œผ๋กœ ๋น„ํœ˜๋ฐœ์„ฑ์˜ ๋ณด์กฐ๊ธฐ์–ต์žฅ์น˜์— ์ €์žฅ
    • ์šด์˜์ฒด์ œ๋Š” ๋‹ค์–‘ํ•œ ์ €์žฅ ์žฅ์น˜๋ฅผ file์ด๋ผ๋Š” ๋™์ผํ•œ ๋…ผ๋ฆฌ์  ๋‹จ์œ„๋กœ ๋ณผ ์ˆ˜ ์ž‡๊ฒŒ ํ•ด์คŒ
    • Operation
      • create, read, write, reposition (lseek), delete, open, close ๋“ฑ
  • File attribute (ํ˜น์€ ํŒŒ์ผ์˜ metadata)
    • ํŒŒ์ผ ์ž์ฒด์˜ ๋‚ด์šฉ์ด ์•„๋‹ˆ๋ผ ํŒŒ์ผ์„ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ๊ฐ์ข… ์ •๋ณด๋“ค
      • ํŒŒ์ผ ์ด๋ฆ„, ์œ ํ˜•, ์ €์žฅ๋œ ์œ„์น˜, ํŒŒ์ผ ์‚ฌ์ด์ฆˆ
      • ์ ‘๊ทผ ๊ถŒํ•œ(์ฝ๊ธฐ, ์“ฐ๊ธฐ, ์‹คํ–‰), ์‹œ๊ฐ„ (์ƒ์„ฑ, ๋ณ€๊ฒฝ, ์‚ฌ์šฉ), ์†Œ์œ ์ž ๋“ฑ
  • File system
    • ์šด์˜์ฒด์ œ์—์„œ ํŒŒ์ผ์„ ๊ด€๋ฆฌํ•˜๋Š” ๋ถ€๋ถ„
    • ํŒŒ์ผ ๋ฐ ํŒŒ์ผ์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ, ๋””๋ ‰ํ† ๋ฆฌ ์ •๋ณด ๋“ฑ์„ ๊ด€๋ฆฌ
    • ํŒŒ์ผ์˜ ์ €์žฅ ๋ฐฅ๋ฒ• ๊ฒฐ์ •
    • ํŒŒ์ผ ๋ณดํ˜ธ

Directory and Logical Disk

  • Directory

    • ํŒŒ์ผ์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์ค‘ ์ผ๋ถ€๋ฅผ ๋ณด๊ด€ํ•˜๊ณ  ์žˆ๋Š” ์ผ์ข…์˜ ํŠน๋ณ„ํ•œ ํŒŒ์ผ
    • ๊ทธ ๋””๋ ‰ํ† ๋ฆฌ์— ์†ํ•œ ํŒŒ์ผ ์ด๋ฆ„ ๋ฐ ํŒŒ์ผ attribute๋“ค
    • operation
      • search for a file, create, delete, list, rename, traverse...
  • Partition(=Logical Disk)

    • ํ•˜๋‚˜์˜ ๋ฌผ๋ฆฌ์  ๋””์Šคํฌ ์•ˆ์— ์—ฌ๋Ÿฌ ํŒŒํ‹ฐ์…˜์„ ๋‘๋Š”๊ฒŒ ์ผ๋ฐ˜์ 
    • ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๋ฌผ๋ฆฌ์ ์ธ ๋””์Šคํฌ๋ฅผ ํ•˜๋‚˜์˜ ํŒŒํ‹ฐ์…˜์œผ๋กœ ๊ตฌ์„ฑํ•˜๊ธฐ๋„ํ•จ
    • (๋ฌผ๋ฆฌ์ ) ๋””์Šคํฌ๋ฅผ ํŒŒํ‹ฐ์…˜์œผ๋กœ ๊ตฌ์„ฑํ•œ ๋’ค ๊ฐ๊ฐ์˜ ํŒŒํ‹ฐ์…˜์— file system์„ ๊น”๊ฑฐ๋‚˜ swapping๋“ฑ ๋‹ค๋ฅธ ์šฉ๋„๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Œ
  • open()

File Protection

  • ๊ฐ ํŒŒ์ผ์— ๋Œ€ํ•ด ๋ˆ„๊ตฌ์—๊ฒŒ ์–ด๋–ค ์œ ํ˜•์˜ ์ ‘๊ทผ์„ ํ—ˆ๋ฝํ•  ๊ฒƒ์ธ๊ฐ€?

Allocation of File Data in Disk

  • Contiguous Allocation
  • Linked Allocation
  • Indexed Allocation

UNIX ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ ๊ตฌ์กฐ

Free Space Management

  • bit
  • Linked List
  • Grouping
  • Counting

Directory Implementation

  • Linearlist
  • Hash Table

VFS and NFS

Page Cache and Buffer Cache

  • Page Cache
    • Virtual memory์˜ paging system์—์„œ ์‚ฌ์šฉํ•˜๋Š” page frame์„ caching์˜ ๊ด€์ ์—์„œ ์„ค๋ช…ํ•˜๋Š” ์šฉ์–ด
    • Memory-Mapped I/O๋ฅผ ์“ฐ๋Š” ๊ฒฝ์šฐ file์˜ I/O์—์„œ๋„ page cache ์‚ฌ์šฉ
  • Memory-Mapped I/O
    • File์˜ ์ผ๋ถ€๋ฅผ virtual memory์— mapping์‹œํ‚ด
    • ๋งคํ•‘์‹œํ‚จ ์˜์—ญ์— ๋Œ€ํ•œ ๋ฉ”๋ชจ๋ฆฌ ์ ‘๊ทผ ์—ฐ์‚ฐ์€ ํŒŒ์ผ์˜ ์ž…์ถœ๋ ฅ์„ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ํ•จ
  • Buffer Cache
    • ํŒŒ์ผ์‹œ์Šคํ…œ์„ ํ†ตํ•œ I/O ์—ฐ์‚ฐ์€ ๋ฉ”๋ชจ๋ฆฌ์˜ ํŠน์ • ์˜์—ญ์ธ buffer cache ์‚ฌ์šฉ
    • File ์‚ฌ์šฉ์˜ locality ํ™œ์šฉ
      • ํ•œ๋ฒˆ ์ฝ์–ด์˜จ block์— ๋Œ€ํ•œ ํ›„์† ์š”์ฒญ์‹œ buffer cache ์—์„œ ์ฆ‰์‹œ ์ „๋‹ฌ
    • ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค๊ฐ€ ๊ณต์šฉ์œผ๋กœ ์‚ฌ์šฉ
    • Replacement algorithm ํ•„์š” (LRU, LFU ๋“ฑ)
  • Unified Buffer Cache
    • ์ตœ๊ทผ์˜ OS์—์„œ๋Š” ๊ธฐ์กด์˜ buffer cache๊ฐ€ page cache์— ํ†ตํ•ฉ๋จ.

06 32