Welcome to Concurrency in Rust

๋Ÿฌ์ŠคํŠธ๋Š” ๋™์‹œ์„ฑ ์ง€์›์ด ๋ง‰๊ฐ•ํ•ฉ๋‹ˆ๋‹ค. ์šด์˜์ฒด์ œ ๋ ˆ๋ฒจ์˜ ์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ๋ฎคํƒ์Šค์™€ ์ฑ„๋„๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

๋Ÿฌ์ŠคํŠธ์˜ ํƒ€์ž… ์‹œ์Šคํ…œ์€ ํ”„๋กœ๊ทธ๋žจ์— ๋™์‹œ์„ฑ ๋ฒ„๊ทธ๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ์ปดํŒŒ์ผ ์‹œ์— ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋„๋ก ํ•ด ์ค๋‹ˆ๋‹ค. ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ์ด์šฉํ•ด์„œ ํ”„๋กœ๊ทธ๋žจ์ด ์ˆ˜ํ–‰์‹œ์— ์ •ํ™•ํžˆ ๋™์ž‘ํ•จ์„ ๋ฏธ๋ฆฌ ๋ณด์žฅํ•ด ์ฃผ๊ธฐ ๋•Œ๋ฌธ์—, ์‚ฌ๋žŒ๋“ค์€ ์ด๋ฅผ ์ข…์ข… ๊ฒ์—†๋Š” ๋™์‹œ์„ฑ ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

  • Rust lets us access OS concurrency toolkit: threads, sync. primitives, etc.
  • The type system gives us safety for concurrency without any special features.
  • The same tools that help with โ€œconcurrentโ€ access in a single thread (e.g., a called function that might mutate an argument or save references to it to read later) save us from multi-threading issues.