Skip to content

Latest commit

ย 

History

History
289 lines (211 loc) ยท 15.4 KB

File metadata and controls

289 lines (211 loc) ยท 15.4 KB

Transport Layer

1. Transport Layer services

Transport Layer์˜ ์—ญํ• 

    1. Source๋ถ€ํ„ฐ Destination๊นŒ์ง€ ํŒจํ‚ท์ด ์ œ๋Œ€๋กœ ์ „์†ก๋  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.
    1. Application Layer์—์„œ ๋งŒ๋“  ๋ฐ์ดํ„ฐ๋ฅผ ์ผ์ •ํ•œ ํฌ๊ธฐ๋กœ ์ž๋ฅธ๋‹ค.

Transport Layer ํ”„๋กœํ† ์ฝœ์˜ ์ข…๋ฅ˜

์„ธ๋ถ€์ ์œผ๋กœ ๋“ค์–ด๊ฐ€๋ฉด Transport Layer์—๋„ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ํ”„๋กœํ† ์ฝœ๋“ค์ด ์กด์žฌํ•˜์ง€๋งŒ, ๋Œ€ํ‘œ์ ์œผ๋กœ ๋‘๊ฐ€์ง€ ํ”„๋กœํ† ์ฝœ์ด ์žˆ๋‹ค.

TCP (Transmission Control Protocol) for loss-sensitive application

  • reliable transport
    • ์ „์†ก ํ”„๋กœ์„ธ์Šค์™€ ์ˆ˜์‹  ํ”„๋กœ์„ธ์Šค ๊ฐ„์˜ ์•ˆ์ •์ ์ธ ์ „์†ก์ด ๊ฐ€๋Šฅํ•˜๋‹ค.
  • in-order delivery
    • ๋ฐ์ดํ„ฐ๋ฅผ ์ˆœ์„œ๋Œ€๋กœ ์ „์†กํ•œ๋‹ค.
  • connection-oriented (์—ฐ๊ฒฐ ์ง€ํ–ฅ), connection setup : ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ด๊ธฐ ์ „์— ์ƒ๋Œ€๋ฐฉ์˜ ์ƒํƒœ๋ฅผ ํ™•์ธํ•˜๊ณ , ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„ ๊ฐ„์— ์„ค์ •(setup)์„ ์š”๊ตฌํ•œ๋‹ค.
    • ์—ฌ๊ธฐ์„œ ๋งํ•˜๋Š” ์„ค์ •(setup)์ด๋ž€?
      • ์†ก์‹ ์ž/์ˆ˜์‹ ์ž์— buffer ํ• ๋‹น
      • buffer & window size ์„ค์ • ๋“ฑ
  • flow control
    • ๋ผ์šฐํ„ฐ์™€ ๋ฐ›๋Š” ์ˆ˜์‹ ์ž์˜ ์ƒํ™ฉ์„ ๋ด์„œ, ์†ก์‹ ์ž ์ธก ๋ฒ„ํผ๊ฐ€ ๋„˜์น˜์น˜ ์•Š๋„๋ก ๋ณด๋‚ด๋Š” ํŒจํ‚ท ์–‘์„ ์กฐ์ ˆํ•œ๋‹ค.
  • congestion control
    • ๊ฐ TCP ์—ฐ๊ฒฐ์ด ๋„คํŠธ์›Œํฌ ๋Œ€์—ญํญ์„ ๊ณตํ‰ํ•˜๊ฒŒ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๊ฒŒ๋” ์ œ์–ดํ•œ๋‹ค.
  • Delay๋‚˜ Bandwidth๋ฅผ ๊ฑด๋“œ๋ฆฌ์ง€๋Š” ๋ชปํ•œ๋‹ค.
  • timing, minimum throughput guarantee, security ๋“ฑ์˜ ๊ธฐ๋Šฅ์€ ์ œ๊ณตํ•˜์ง€ ์•Š๋Š”๋‹ค.

UDP (User Datagram Protocol) for delay-sensitive application

  • unreliable data transfer
  • ํŒจํ‚ท์„ ์–ด๋–ค ์ˆ˜์‹ ์ž์˜ ์–ด๋–ค ์„œ๋น„์Šค๊ฐ€ ๋ฐ›์•„์•ผ ํ•˜๋Š”์ง€(IP ์ฃผ์†Œ, Port ๋ฒˆํ˜ธ), ํŒจํ‚ท์ด ์ค‘๊ฐ„์— ๋ง๊ฐ€์ง€์ง€๋Š” ์•Š์•˜๋Š”์ง€๋งŒ ์ฒ˜๋ฆฌํ•œ๋‹ค.
  • UDP๋Š” TCP์—์„œ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์„ ํ•˜๋‚˜๋„ ์ œ๊ณตํ•˜์ง€ ์•Š๋Š”๋‹ค.
    • reliability, connection setup, flow control, congestion control, timing, minimum throughput guarantee, security ๋“ฑ์„ ์ œ๊ณตํ•˜์ง€ ์•Š๋Š”๋‹ค.
  • ์ •๋ง ์•„๋ฌด๊ฒƒ๋„ ์•ˆ ํ•˜๋Š” ๊ฒƒ ๊ฐ™์€๋ฐ ํ•„์š”ํ•œ ์ด์œ ๊ฐ€ ๋ฌด์—‡์ผ๊นŒ?
    • UDP๋Š” ํฌํŠธ ๋ฒˆํ˜ธ์— ๋”ฐ๋ผ ์ „๋‹ฌํ•˜๋Š” ์—ญํ• ์„ ํ•œ๋‹ค.
    • UDP๋Š” ์‹ ๋ขฐ์„ฑ์„ ๋ณด์žฅํ•˜์ง€๋Š” ์•Š์ง€๋งŒ, TCP์— ๋น„ํ•˜์—ฌ ๋น ๋ฅธ ์ „์†ก ์†๋„๋ฅผ ์ œ๊ณตํ•œ๋‹ค.
    • UDP๋Š” ๋น„์—ฐ๊ฒฐ์„ ์ง€ํ–ฅํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ์ดํ„ฐ๋ฅผ ์žฌ์ „์†กํ•  ํ•„์š”๋„ ์—†๊ณ , ํ๋ฆ„ ์ œ์–ด๋‚˜ ์—๋Ÿฌ ์ฒดํฌ๋„ ํ•ญ์ƒ ํ•„์š”๋กœ ํ•˜์ง€ ์•Š๋Š”๋‹ค.

2. Multiplexing, Demultiplexing

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜๋“ค์ด Transport Layer์˜ ํ”„๋กœํ† ์ฝœ์„ ์ด์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ”„๋กœ์„ธ์Šค๋งˆ๋‹ค Socket์„ ์ด์šฉํ•ด์•ผ ํ•œ๋‹ค.

ํ•˜์ง€๋งŒ, ์ปดํ“จํ„ฐ์—๋Š” ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์•ฑ๋“ค์ด ๋Œ์•„๊ฐ€๊ณ , ๊ฐ๊ฐ์˜ ์•ฑ๋“ค์€ ํ•˜๋‚˜ ์ด์ƒ์˜ Socket์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค. ๋”ฐ๋ผ์„œ Transport layer ์ž…์žฅ์—์„œ๋Š” ์—ฌ๋Ÿฌ๊ฐœ์˜ Socket์—์„œ ๋ฐ์ดํ„ฐ๋“ค์ด ์Ÿ์•„์ง€๋Š” ํ˜•ํƒœ๊ฐ€ ๋œ๋‹ค.

์—ฌ๋Ÿฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ Socket๋“ค์ด ๋ฐ์ดํ„ฐ๋ฅผ ์†ก/์ˆ˜์‹ ํ•˜๋ฏ€๋กœ ํ•„์š”ํ•œ ๊ฐœ๋…์ด ๋ฐ”๋กœ Multiplexing๊ณผ Demultiplexing์ด๋‹ค.

์—ฌ๋Ÿฌ ์†Œ์ผ“์—์„œ ๋‚˜์˜จ ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ• ๋•Œ๋Š” Multiplexing์„, ๋ฐ›์€ ํŒจํ‚ท์„ ์ ์ ˆํ•œ ์†Œ์ผ“์œผ๋กœ ๋ณด๋‚ด์ค„๋•Œ๋Š” Demultiplexing์„ ์ ์šฉํ•œ๋‹ค.

Multiplexing

์—ฌ๋Ÿฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ Socket๋“ค๋กœ๋ถ€ํ„ฐ ๋“ค์–ด์˜ค๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•˜์—ฌ, ํŒจํ‚ท์œผ๋กœ ๋งŒ๋“ค๊ณ  ํ•˜์œ„ ๊ณ„์ธต์œผ๋กœ ์ „์†กํ•˜๋Š” ๊ฒƒ.

Demultiplexing

ํ•˜์œ„ ๊ณ„์ธต๋กœ๋ถ€ํ„ฐ ์ˆ˜์‹ ๋œ ํŒจํ‚ท์„ ์ •ํ™•ํ•œ Socket์œผ๋กœ ์ „์†กํ•˜์—ฌ ์˜ฌ๋ฐ”๋ฅธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—๊ฒŒ ์ „์†กํ•˜๋Š” ๊ฒƒ.

์ด๋•Œ ์ •ํ™•ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ Socket์œผ๋กœ ์ „๋‹ฌํ•ด์ฃผ๊ธฐ ์œ„ํ•ด ํฌํŠธ ๋ฒˆํ˜ธ(Port Number)๊ฐ€ ์‚ฌ์šฉ๋œ๋‹ค.

3. Principles of RDT(Reliable Data Transfer)

Reliable Data Transfer

์‹ ๋ขฐ์„ฑ ์žˆ๋Š” ๋ฐ์ดํ„ฐ ๊ตํ™˜(์ดํ•˜ RDT)์€ ํ•œ๋งˆ๋””๋กœ "์†ก/์ˆ˜์‹ ํ•˜๋Š” ๋ฐ์ดํ„ฐ๊ฐ€ ์˜ค๋ฅ˜์—†์ด ์˜จ์ „ํžˆ ์ „์†ก๋˜๋Š” ๊ฒƒ" ์ด๋‹ค.

Transport Layer ์—์„œ๋Š” ์‹ ๋ขฐ์„ฑ ์žˆ๋Š” ๋ฐ์ดํ„ฐ ๊ตํ™˜์„ ํ•˜๊ณ  ์‹ถ์–ดํ•˜์ง€๋งŒ, ๊ทธ ์•„๋ž˜์˜ ๋ ˆ์ด์–ด์—์„œ๋Š” ์‹ ๋ขฐ์„ฑ์„ ๋ณด์žฅํ•  ์ˆ˜ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์‹ ๋ขฐ์„ฑ ์žˆ๋Š” ํ†ต์‹ ์— ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ๋‹ค.

์ด๋Ÿฌํ•œ ์ƒํ™ฉ ์†์—์„œ Transport Layer์—์„œ ์ ์šฉ ๊ฐ€๋Šฅํ•œ ๋ฐฉ์‹์ด ๋ฐ”๋กœ "RDT ํ”„๋กœํ† ์ฝœ"์„ ์ด์šฉํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์•„๋ž˜ ๊ทธ๋ฆผ์„ ์‚ดํŽด๋ณด์ž.

  • ํŒจํ‚ท ์†ก์‹  (์ƒ์œ„ ๊ณ„์ธต โ†’ Transport Layer โ†’ ํ•˜์œ„ ๊ณ„์ธต)
    • ์ƒ์œ„ ๊ณ„์ธต โ†’ Transport Layer :
      • rdt_send() ์‹œ์Šคํ…œ ์ฝœ์„ ํ˜ธ์ถœํ•˜์—ฌ RDT ํ”„๋กœํ† ์ฝœ๋กœ ์ „์†ก
    • Transport Layer โ†’ ํ•˜์œ„ ๊ณ„์ธต :
      • udt_send() ํ˜ธ์ถœํ•˜์—ฌ ํŒจํ‚ท ์ „์†ก
  • ํŒจํ‚ท ์ˆ˜์‹  (ํ•˜์œ„ ๊ณ„์ธต โ†’ Transport Layer โ†’ ์ƒ์œ„ ๊ณ„์ธต)
    • ํ•˜์œ„ ๊ณ„์ธต โ†’ Transport Layer :
      • rdt_rcv() ์‹œ์Šคํ…œ ์ฝœ์„ ํ˜ธ์ถœํ•˜์—ฌ RDT ํ”„๋กœํ† ์ฝœ๋กœ ์ „์†ก
    • Transport Layer โ†’ ์ƒ์œ„ ๊ณ„์ธต :
      • deliver_data() ํ˜ธ์ถœํ•˜์—ฌ ๋ฐ์ดํ„ฐ ์ „์†ก

Design of RDT

์•ž์„œ ์‚ดํŽด๋ณธ RDT๋ฅผ FSM(์œ ํ•œ ์ƒํƒœ ์žฅ์น˜)์„ ์ด์šฉํ•˜์—ฌ ์„ค๊ณ„ํ•  ์ˆ˜ ์žˆ๋‹ค.

RDT 1.0

  • ๊ฐ€์ •
    • ๋„คํŠธ์›Œํฌ์˜ ๋ชจ๋“  ์ฑ„๋„์ด ์™„๋ฒฝํ•˜๊ฒŒ ์‹ ๋ขฐ์„ฑ ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•œ๋‹ค. (no bit errors, no loss of packets)
  • ๊ธฐ๋Šฅ
    • ์†ก์‹ ์ž๋Š” ๋ณด๋‚ผ ๋ฐ์ดํ„ฐ๋ฅผ ํŒจํ‚ท์œผ๋กœ ๋งŒ๋“ค์–ด ํŒจํ‚ท์„ ๋ณด๋‚ด๊ณ ,
      ์ˆ˜์‹ ์ž๋Š” ํŒจํ‚ท์œผ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”์ถœํ•˜์—ฌ ์ „๋‹ฌํ•œ๋‹ค.
  • ํŠน์ง•
    • ๋ฐ์ดํ„ฐ ์†์ƒ์ด๋‚˜ ์†์‹ค์˜ ์šฐ๋ ค๊ฐ€ ์—†๋Š” ๋„คํŠธ์›Œํฌ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ชจ๋ธ์ด๋‹ค.

RDT 2.0

  • ๊ฐ€์ •
    • ํŒจํ‚ท ์†์‹ค์€ ์—†๋‹ค๊ณ  ๊ฐ€์ •ํ•œ๋‹ค.
  • ๊ฐœ์„ ๋œ ๊ธฐ๋Šฅ
    • ๊ธฐ๋ณธ ์ฑ„๋„์—์„œ๋Š” ํŒจํ‚ท์˜ bit errors ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ, bit errors ๋ฅผ ํƒ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ACK/NAK์™€ checksum์„ ๋„์ž…ํ•œ๋‹ค.
      • acknowledgements (ACKs) : ์ˆ˜์‹ ์ž๊ฐ€ ์†ก์‹ ์ž์—๊ฒŒ ํŒจํ‚ท์ด ์ •์ƒ์ ์œผ๋กœ ์ˆ˜์‹ ํ–ˆ์Œ์„ ์•Œ๋ฆฐ๋‹ค.
      • negative acknowledgements (NAKs) : ์ˆ˜์‹ ์ž๊ฐ€ ์†ก์‹ ์ž์—๊ฒŒ ํŒจํ‚ท์— ์—๋Ÿฌ๊ฐ€ ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๋ฆฐ๋‹ค.
    • ์—๋Ÿฌ๋ฅผ ํƒ์ง€ํ•˜์—ฌ ๋งŒ์•ฝ ์—๋Ÿฌ๊ฐ€ ์žˆ๋‹ค๋ฉด, ์ƒ๋Œ€๋ฐฉ์˜ Transport Layer์— ๋‹ค์‹œ ํŒจํ‚ท์„ ์š”์ฒญํ•œ๋‹ค.
  • ๋ฌธ์ œ์ 
    • ACK/NAK๊ฐ€ ์†์‹ค๋  ๊ฒฝ์šฐ, ์†ก์‹ ์ž๋Š” ์ˆ˜์‹ ์ž์—๊ฒŒ ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚ฌ๋Š”์ง€ ๋ชจ๋ฅธ๋‹ค.
      • ์†ก์‹ ์ž๊ฐ€ ์ˆ˜์‹ ์ž์—๊ฒŒ Packet์„ ๋˜ ๋ณด๋‚ผ ๊ฒฝ์šฐ, ์ˆ˜์‹ ์ž๋Š” ์ค‘๋ณต์ธ์ง€ ๋ชจ๋ฅด๊ณ  ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—๊ฒŒ ์ค‘๋ณต๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ๋‹ค.

RDT 2.1

  • ๊ฐœ์„ ๋œ ๊ธฐ๋Šฅ
    • (1) Sequence Number ์‚ฌ์šฉ
      • handling duplicates : ์ˆ˜์‹ ์ž๊ฐ€ packet์˜ ์ค‘๋ณต ์ˆ˜์‹  ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
    • (2) Stop and Wait
      • ์†ก์‹ ์ž๊ฐ€ ํ•˜๋‚˜์˜ packet์„ ๋ณด๋‚ด๊ณ ๋‚˜๋ฉด, ์ˆ˜์‹ ์ž์˜ ์‘๋‹ต์„ ๊ธฐ๋‹ค๋ฆฐ๋‹ค.
  • ๋ฌธ์ œ์ 
    • sequence number๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, NAK๋ฅผ ์‚ฌ์šฉํ•  ํ•„์š”๊ฐ€ ์—†์–ด์ง„๋‹ค.

RDT 2.2

  • ๊ฐœ์„ ๋œ ๊ธฐ๋Šฅ
    • NAK ๊ธฐ๋Šฅ ์ œ๊ฑฐ
      • NAK์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค.
      • ๋Œ€์‹ , ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰์œผ๋กœ ์ž˜ ๋ฐ›์€ ํŒจํ‚ท์— ๋Œ€ํ•œ ๋ฒˆํ˜ธ์˜ ACK๋ฅผ ๋ณด๋‚ธ๋‹ค.
  • ๋ฌธ์ œ์ 
    • ์—ฌ์ „ํžˆ ํŒจํ‚ท ์†์‹ค์˜ ๊ฐ€๋Šฅ์„ฑ์ด ๋‚จ์•„์žˆ๋‹ค.

RDT 3.0

  • ๊ฐ€์ •
    • ์ฑ„๋„์— ํŒจํ‚ท ์—๋Ÿฌ์™€ ํŒจํ‚ท ์†์‹ค์˜ ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ๋‹ค.
  • ๊ฐœ์„ ๋œ ๊ธฐ๋Šฅ
    • timer ์‚ฌ์šฉ
      • ์†ก์‹ ์ž๊ฐ€ ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•˜๊ณ  ์ผ์ • ์‹œ๊ฐ„์„ ๊ธฐ๋‹ค๋ฆฐ๋‹ค. ๋งŒ์•ฝ ์‹œ๊ฐ„ ๋‚ด์— ์˜ฌ๋ฐ”๋ฅธ ACK๊ฐ€ ์•ˆ์˜ค๋ฉด ์žฌ์ „์†ก ํ•œ๋‹ค.
RDT 3.0 ์†ก์‹ ์ž

์œ„ ๊ทธ๋ฆผ์—์„œ ๊ฒ€์€์ƒ‰ ๊ธ€์”จ๋“ค์€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ํŒจํ‚ท๋“ค์ด ๊ตํ™˜๋˜์—ˆ์„ ๊ฒฝ์šฐ์ด๋‹ค. ์ด ๊ฒฝ์šฐ ํ˜ธ์ถœ๋œ ํ•จ์ˆ˜๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ๋œ๋‹ค.

๋นจ๊ฐ„์ƒ‰ ๊ธ€์”จ๋“ค์€ ํŒจํ‚ท ์ „์†ก ๊ณผ์ •์—์„œ ๋ฌด์–ธ๊ฐ€ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒƒ์ด๋‹ค. ํŒจํ‚ท์ด ์†์ƒ๋˜์—ˆ๊ฑฐ๋‚˜(corrupt), ์†์‹ค๋˜์—ˆ์„ ๋•Œ(wrong ACK) ๊ทธ๋ƒฅ ์ด๋ฅผ ๋ฌด์‹œํ•œ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด ๊ฒฐ๊ตญ timeout์ด ๋ฐœ์ƒํ•ด ์žฌ์ „์†ก์„ ํ•˜๊ฒŒ ๋œ๋‹ค.

RDT 3.0 ์ˆ˜์‹ ์ž

์œ„ ๊ทธ๋ฆผ์—์„œ ๊ฒ€์€์ƒ‰ ๊ธ€์”จ๋“ค์€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ํŒจํ‚ท๋“ค์ด ๊ตํ™˜๋˜์—ˆ์„ ๊ฒฝ์šฐ์ด๋‹ค. ์ด ๊ฒฝ์šฐ ํ˜ธ์ถœ๋œ ํ•จ์ˆ˜๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ๋œ๋‹ค.

๋นจ๊ฐ„์ƒ‰ ๊ธ€์”จ๋“ค์€ ํŒจํ‚ท ์ „์†ก ๊ณผ์ •์—์„œ ์ˆ˜์‹ ์ž๊ฐ€ ๋ณด๋‚ธ ACK๊ฐ€ ์†ก์‹ ์ž์—๊ฒŒ ์ œ๋Œ€๋กœ ๊ฐ€์ง€ ์•Š์•„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ์ด๋‹ค. ์ด ๊ฒฝ์šฐ ๋‹ค์‹œ ACK์„ ๋งŒ๋“ค์–ด ์†ก์‹ ์ž์—๊ฒŒ ์žฌ์ „์†ก ํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.

rdt 3.0 ๋ชจ๋ธ์€ ํŒจํ‚ท์ด ์œ ์‹ค๋œ ๊ฒฝ์šฐ, ACK๊ฐ€ ์œ ์‹ค๋œ ๊ฒฝ์šฐ, ์œ ์‹ค๋˜์ง€๋Š” ์•Š์•˜์ง€๋งŒ timeout์ด ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ ๋“ฑ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ณ€์น™์ ์ธ ์ƒํ™ฉ์„ ๋ชจ๋‘ ์ปค๋ฒ„ํ•  ์ˆ˜ ์žˆ์–ด์„œ ๊ต‰์žฅํžˆ ์™„์„ฑ๋„ ๋†’์€ ๋ชจ๋ธ์ด๋ผ๊ณ  ํ•  ์ˆ˜ ์žˆ๋‹ค.

ํŠนํžˆ ํŒจํ‚ท์„ ๋ณด๋‚ด๊ณ  ACK๊ฐ€ ์˜ฌ๋•Œ๊นŒ์ง€ ๋Œ€๊ธฐํ•˜๋Š” ์–‘์ƒ์„ ๋ณด์ด๋Š”๋ฐ, ์ด๋ฅผ stop-and-wait Operation ์ด๋ผ๊ณ  ํ•œ๋‹ค. ์ด๋Ÿฌํ•œ ํŠน์ง• ๋•Œ๋ฌธ์— ํ•œํŽธ์œผ๋กœ๋Š” ํšจ์œจ์„ฑ์ด ๋‚ฎ๋‹ค๊ณ  ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

4. Pipelined Protocols

์•ž์„œ ์„œ์ˆ ํ•˜์˜€๋“ฏ์ด, RDT 2.1 ๋ชจ๋ธ๋ถ€ํ„ฐ๋Š” ์†ก์‹ ์ž๊ฐ€ ํ•˜๋‚˜์˜ packet์„ ๋ณด๋‚ด๊ณ ๋‚˜๋ฉด ์ˆ˜์‹ ์ž์˜ ์‘๋‹ต์„ ๊ธฐ๋‹ค๋ฆฌ๋Š” "Stop and Wait" ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•œ๋‹ค๊ณ  ํ•˜์˜€๋‹ค.

ํ•˜์ง€๋งŒ ์ด ๋ฐฉ๋ฒ•์€ ACK๊ฐ€ ์˜ฌ ๋•Œ๊นŒ์ง€ ์†ก์‹ ์ž๊ฐ€ ๊ณ„์†ํ•ด์„œ ๋†€๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๊ต‰์žฅํžˆ ๋น„ํšจ์œจ์ ์ธ ๋ฐฉ๋ฒ•์ด๋‹ค.

๋”ฐ๋ผ์„œ, ํ•œ๋ฒˆ์— ํ•˜๋‚˜์˜ ํŒจํ‚ท๋งŒ ๋ณด๋‚ด๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ์—ฌ๋Ÿฌ ํŒจํ‚ท์„ pipeliningํ•˜์—ฌ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์„ ์‚ดํŽด๋ณผ ๊ฒƒ์ด๋‹ค. ๋Œ€ํ‘œ์ ์ธ Pipelined Protocol์œผ๋กœ๋Š” GBN(Go-Back-N)๊ณผ SR(Selective Repeate) ๋ฐฉ์‹์ด ์žˆ๋‹ค.

GBN(Go-back-N)

Go-back-N ๋ฐฉ์‹์€ ์ˆ˜์‹ ์ž ์ธก์—์„œ ๋ฐ›์ง€ ๋ชปํ•œ ํŒจํ‚ท์ด ์žˆ๋‹ค๋ฉด, ์†ก์‹ ์ž๊ฐ€ ํ•ด๋‹น ํŒจํ‚ท๋ถ€ํ„ฐ ์ˆœ์„œ๋Œ€๋กœ ๋‹ค์‹œ ์žฌ์ „์†ก ํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค.

  • (1) ์ˆ˜์‹ ์ž ์ธก์€ ์ •์ƒ์ ์œผ๋กœ ๋ฐ›์ง€ ๋ชปํ•œ ํŒจํ‚ท์ด ์žˆ์„ ๊ฒฝ์šฐ, ํ•ด๋‹น ํŒจํ‚ท์ด ์˜ฌ ๋•Œ๊นŒ์ง€ ๋‹ค๋ฅธ ํŒจํ‚ท๋“ค์„ ๋ฐ›๋”๋ผ๋„, ๋ฐ›์ง€ ๋ชปํ•œ ํŒจํ‚ท์˜ ์ง์ „ ํŒจํ‚ท์— ๋Œ€ํ•œ ACK๋ฅผ ๋ณด๋‚ธ๋‹ค.
    • ์ˆ˜์‹ ์ž๋Š” ๋ฐ›์€ ACK์˜ ์ˆœ์„œ๊ฐ€ ๋’ค์„ž์ด๋Š” ๊ฒƒ์„ ํ—ˆ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค.
      • ์ด๋Ÿฌํ•œ ์„ฑ์งˆ ๋•Œ๋ฌธ์— cumulative ACK(์—ฐ์†์ ์ธ ACK)์ด๋ผ๊ณ ๋„ ํ•œ๋‹ค.
    • ์˜ˆ๋ฅผ ๋“ค์–ด ํŒจํ‚ท 1,2,3,4,5๋ฅผ ์ „์†กํ–ˆ๋Š”๋ฐ, ์ˆ˜์‹ ์ž ์ธก์—์„œ 1,2,4,5๋ฅผ ๋ฐ›์•˜๋‹ค๋ฉด, ์ˆ˜์‹ ์ž ์ธก์€ ACK 1,2,2,2๋ฅผ ๋ณด๋‚ธ๋‹ค.
      • ์†ก์‹ ์ž ์ž…์žฅ์—์„œ ACK 1,2,3์ด ์•ˆ์˜ค๊ณ  ACK 4๋งŒ ์˜ค๋”๋ผ๋„ ์ˆ˜์‹ ์ž๊ฐ€ ํŒจํ‚ท 1,2,3,4๋ฅผ ์ •์ƒ์ ์œผ๋กœ ๋ฐ›์•˜๋‹ค๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. (ACK๊ฐ€ ์˜ค๋‹ค๊ฐ€ ์†์‹ค๋œ ๊ฒฝ์šฐ)
  • (2) ์†ก์‹ ์ž๋Š” ์ „์†กํ•œ ํŒจํ‚ท ์ค‘, ACK ๋˜์ง€ ์•Š์€ ๊ฐ€์žฅ ์ตœ์‹ ์˜ ํŒจํ‚ท์— ๋Œ€ํ•ด ํ•˜๋‚˜์˜ ํƒ€์ด๋จธ๋ฅผ ๊ณ„์‚ฐํ•œ๋‹ค.
    • ๋งŒ์•ฝ ํ•ด๋‹น ํƒ€์ด๋จธ๊ฐ€ ๋งŒ๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ACK๊ฐ€ ์˜ค์ง€ ์•Š์œผ๋ฉด, window ๋‚ด์˜ unack๋œ ๋ชจ๋“  ํŒจํ‚ท์„ ์žฌ์ „์†กํ•œ๋‹ค.
    • ๋งŒ์•ฝ ํ•ด๋‹น ํƒ€์ด๋จธ๊ฐ€ ๋งŒ๋ฃŒ๋˜๊ธฐ ์ „์— ACK๊ฐ€ ์˜จ๋‹ค๋ฉด, ๋‹ค์Œ ACK ๋˜์ง€ ์•Š์€ ๊ฐ€์žฅ ์ตœ์‹ ์˜ ํŒจํ‚ท์— ๋Œ€ํ•ด ํƒ€์ด๋จธ๋ฅผ ๊ณ„์‚ฐํ•œ๋‹ค.
  • (3) ๊ตฌ์กฐ๊ฐ€ ๊ฐ„๋‹จํ•˜๊ณ  ๊ตฌํ˜„์ด ๋‹จ์ˆœํ•˜๋ฉฐ, ๋”ฐ๋กœ ํŒจํ‚ท์„ ๋ณด๊ด€ํ•  ๋ฒ„ํผ๊ฐ€ ํ•„์š” ์—†๋‹ค.
    • ์˜ฌ๋ฐ”๋ฅธ ํŒจํ‚ท์ด ์˜ค๋ฉด ์‚ผํ‚ค๊ณ , ํ‹€๋ฆฐ ํŒจํ‚ท์ด ์˜ค๋ฉด ๋ฑ‰๋Š” ๊ตฌ์กฐ์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
  • (4) ์†ก์‹ ์ž์˜ Window Size๋Š” ์‚ฌ์šฉ๋˜๋Š” sequence number๋ณด๋‹ค ๋ฌด์กฐ๊ฑด ์ปค์•ผํ•œ๋‹ค.
    • N = (2^k)-1
    • ๋งŒ์•ฝ Window size๊ฐ€ ๊ฐ™๊ฑฐ๋‚˜ ์ž‘์œผ๋ฉด, ์ˆ˜์‹ ์ž๊ฐ€ ์˜คํ•ดํ•  ์ˆ˜ ์žˆ๋Š” ์ƒํ™ฉ์ด ์ƒ๊ธด๋‹ค. (ACK๊ฐ€ ๋ชจ๋‘ ์†Œ์‹ค๋œ ๊ฒฝ์šฐ)

SR(Selective Repeat)

Selective Repeat ๋ฐฉ์‹์€ ์†ก์‹ ์ž ์ธก์—์„œ ๋ฐ›์€ ๊ฐ๊ฐ์˜ ํŒจํ‚ท๋“ค์— ๋Œ€ํ•ด ACK์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์‹์ด๋‹ค.

  • (1) ์†ก์‹ ์ž ์ธก์€ ACK๊ฐ€ ์ˆœ์„œ๋Œ€๋กœ ์˜ค๋“  ๋ง๋“ , ๊ทธ๋ƒฅ ๋ฐ›์€ ํŒจํ‚ท์— ๋Œ€ํ•œ ACK์„ ๋ณด๋‚ธ๋‹ค.
    • ์˜ˆ๋ฅผ ๋“ค์–ด ํŒจํ‚ท 1,2,3,4,5๋ฅผ ์ „์†กํ–ˆ๋Š”๋ฐ ์†ก์‹ ์ž ์ธก์—์„œ 1,2,4,5๊ฐ€ ์™”๋‹ค๋ฉด, ์†ก์‹ ์ž ์ธก์€ ACK 1,2,4,5๋ฅผ ๋ณด๋‚ธ๋‹ค.
  • (2) ์†ก์‹ ์ž๋Š” ACK์„ ๋ฐ›์ง€ ๋ชปํ•œ ๋ชจ๋“  ํŒจํ‚ท์— ๋Œ€ํ•ด ํƒ€์ด๋จธ๋ฅผ ๊ฐ๊ฐ ๊ณ„์‚ฐํ•œ๋‹ค.
    • ๋งŒ์•ฝ ๊ฐ๊ฐ์˜ ํƒ€์ด๋จธ๊ฐ€ ๋งŒ๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ACK๊ฐ€ ์•ˆ์˜ค๋ฉด, ๊ฐ๊ฐ ํŒจํ‚ท์„ ์žฌ์ „์†กํ•œ๋‹ค.
  • (3) ๋”ฐ๋กœ ๋ฐ›์€ ํŒจํ‚ท์„ ๋ณด๊ด€ํ•  ๋ฒ„ํผ๊ฐ€ ํ•„์š”ํ•˜๋‹ค.
    • ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์€ ํŒจํ‚ท์ด ์™€๋„ ์ผ๋‹จ ์ €์žฅํ•ด๋†“๊ณ , ๋‚˜์ค‘์— ๋ถ€์กฑํ•œ ๋ถ€๋ถ„์ด ์ฑ„์›Œ์ง€๋ฉด ํ•จ๊ป˜ ์‚ผํ‚ค๋Š” ๊ตฌ์กฐ์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
  • (4) ์‚ฌ์šฉ๋˜๋Š” sequence number๋Š” ์†ก์‹ ์ž์˜ Window Size์™€ ์†ก์‹ ์ž์˜ Widow Size ํฌ๊ธฐ์˜ ํ•ฉ๋ณด๋‹ค ๋ฌด์กฐ๊ฑด ํฌ๊ฑฐ๋‚˜ ๊ฐ™์•ผํ•œ๋‹ค.
    • Max allowable window size N์„ (2^k)-1์ด ์•„๋‹ˆ๋ผ, (2^k)/2 = 2^(k-1)๋กœ ํ•ด์•ผ ํ•œ๋‹ค. (half the seq# space)
    • ๋งŒ์•ฝ sequence number์˜ ํฌ๊ธฐ๊ฐ€ ๋” ์ž‘๋‹ค๋ฉด, ์†ก์‹ ์ž๊ฐ€ ์˜คํ•ดํ•  ์ˆ˜ ์žˆ๋Š” ์ƒํ™ฉ์ด ์ƒ๊ธด๋‹ค.

์‹œ๊ฐํ™” ์ž๋ฃŒ

5. Connection-oriented transport: TCP

  • point-to-point:
    • one sender, one receiver
  • reliable data transfer
  • in-order byte stream
  • pipelined (โ†” stop & wait)
  • full duplex data
    • MSS (maximum segment size)๋ฅผ ์ •์˜ํ•˜๊ณ , ๋ฐ์ดํ„ฐ ์†ก์ˆ˜์‹  ์ „์— ๋ฏธ๋ฆฌ ์•Œ๋ ค์คŒ
  • connection oriented
    • handshaking (exchange of control msgs) inits sender, receiver state before data exchange
  • flow control
    • sender will not overwhelm receiver
    • ์‹œ๊ฐ„์— ๋”ฐ๋ผ ๋ณ€ํ•˜๋Š” Adaptive window size (N)
  • segment structure
    • TCP Header์™€ Data๋ฅผ ํ†ตํ‹€์–ด์„œ TCP segement๋ผ๊ณ  ํ•œ๋‹ค.
    • TCP Segment๋Š” ์—ฌ๋Ÿฌ field๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ๋Š”๋ฐ, field๋Š” ์˜๋ฏธ ์žˆ๊ฒŒ packet์„ ์ž๋ฅธ ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค.

TCP segment structure

each line's length is 32 bits

Header

Default Header = 20 bytes
  • (1-1) IP protocol version number
  • (1-2) header length (bytes)
    • 20 bytes + @
  • (1-3) "type" of data
    • "type" : ๋น ๋ฅธ ๊ธธ or ๋Š๋ฆฌ์ง€๋งŒ ์‹ผ ๊ธธ
    • ์‹ค์ œ router๊ฐ€ ๊ณ ๋ คํ•˜์ง€๋Š” ์•Š์Œ
  • (1-4) total datagram length (bytes)
  • (2-1) 16-bit identifier
    • for fragmentation/reassembly
  • (2-2) flags
    • D (Done fragmentation)
      • 0์ด๋ฉด fragmentation์„ ์ˆ˜ํ–‰
      • 1์ด๋ฉด fragmentation์„ ์ˆ˜ํ–‰ x
    • M (More flag)
      • 0์ด๋ฉด ๋‚ด๊ฐ€ ๋งˆ์ง€๋ง‰์ด๋‹ค.
      • 1์ด๋ฉด ๋‚ด๊ฐ€ ๋งˆ์ง€๋ง‰์ด ์•„๋‹ˆ๋‹ค.
    • for fragmentation/reassembly
  • (2-3) fragmentation offset
    • ์›๋ž˜ ๋ฐ์ดํ„ฐ์—์„œ ์–ด๋Š ์œ„์น˜์— ์žˆ์—ˆ๋Š”์ง€๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค.
    • for fragmentation/reassembly
  • (3-1) time to live
    • max number remaining hops (decremented at each router)
  • (3-2) upper layer
    • upper layer protocol to deliver payload to
  • (3-3) header checksum
    • IPv4์—์„œ๋Š” ๋ชจ๋“  ํŒจํ‚ท์— ๋Œ€ํ•ด checksum์„ ๊ณ„์‚ฐํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค. (์‹œ๊ฐ„์ด ๋Š๋ ค์ง)
    • ์™œ๋ƒํ•˜๋ฉฐ๋Š ๋ผ์šฐํ„ฐ๋ฅผ ๊ฑฐ์น ๋•Œ๋งˆ๋‹ค TTL์ด ๋ณ€๊ฒฝ๋˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
  • (4) 32 bit source IP address
  • (5) 32 bit destination IP address
Option Header
  • (6) options (if any)

Data

  • data (variable length, typically a TCP or UDP segment)

Source

  1. Computer Networking: A Top Down Approach 6th edition - Jim Kurose, Keith Ross Addison-Wesley March 2012
  2. https://ddongwon.tistory.com/m/79
  3. https://ddongwon.tistory.com/m/80
  4. https://ddongwon.tistory.com/m/81
  5. https://m.blog.naver.com/mayooyos/220987008864