# Concurrency Basics (Rust) > Threads, thread::spawn, move closures, channels (mpsc), Send & Sync traits, thread safety - 20 interview questions - Mid-Level - [Interview Questions: Rust](https://sharpskill.dev/en/technologies/rust/interview-questions.md) ## 1. Which function should be used to create a new thread in Rust? **Answer** The thread::spawn function from the std::thread module creates a new execution thread. It takes a closure as parameter and returns a JoinHandle that allows waiting for the thread to finish using the join() method. This function is the main entry point for thread-based concurrent programming in Rust. ## 2. What does the join() method return when called on a JoinHandle? **Answer** The join() method returns a Result where T is the return type of the thread's closure. If the thread completes normally, you get Ok(value). If the thread panicked, you get Err containing the panic information. This allows safely retrieving thread results or handling its errors. ## 3. Why use the move keyword with a closure passed to thread::spawn? **Answer** The move keyword forces the closure to take ownership of captured variables instead of borrowing them. This is essential with thread::spawn because the new thread may outlive the scope where variables are defined. Without move, the compiler refuses because it cannot guarantee that references will be valid for the thread's entire lifetime. ## 17 more questions available - What is the role of the Send trait in Rust? - What is the role of the Sync trait in Rust? Sign up for free: https://sharpskill.dev/en/login ## Other Rust interview topics - [Rust Basics](https://sharpskill.dev/en/technologies/rust/interview-questions/rust-basics.md): 25 questions, Junior - [Ownership & Borrowing](https://sharpskill.dev/en/technologies/rust/interview-questions/ownership-borrowing.md): 22 questions, Junior - [Structs & Enums](https://sharpskill.dev/en/technologies/rust/interview-questions/structs-enums.md): 20 questions, Junior - [Error Handling](https://sharpskill.dev/en/technologies/rust/interview-questions/error-handling.md): 18 questions, Junior - [Collections](https://sharpskill.dev/en/technologies/rust/interview-questions/collections.md): 20 questions, Junior - [Modules & Packages](https://sharpskill.dev/en/technologies/rust/interview-questions/modules-packages.md): 18 questions, Junior - [Traits](https://sharpskill.dev/en/technologies/rust/interview-questions/traits.md): 22 questions, Mid-Level - [Generics](https://sharpskill.dev/en/technologies/rust/interview-questions/generics.md): 20 questions, Mid-Level - [Lifetimes](https://sharpskill.dev/en/technologies/rust/interview-questions/lifetimes.md): 20 questions, Mid-Level - [Iterators & Closures](https://sharpskill.dev/en/technologies/rust/interview-questions/iterators-closures.md): 22 questions, Mid-Level - [Smart Pointers](https://sharpskill.dev/en/technologies/rust/interview-questions/smart-pointers.md): 22 questions, Mid-Level - [async/await](https://sharpskill.dev/en/technologies/rust/interview-questions/async-await.md): 22 questions, Mid-Level - [Testing](https://sharpskill.dev/en/technologies/rust/interview-questions/testing.md): 18 questions, Mid-Level - [Cargo & Ecosystem](https://sharpskill.dev/en/technologies/rust/interview-questions/cargo-ecosystem.md): 18 questions, Mid-Level - [Pattern Matching](https://sharpskill.dev/en/technologies/rust/interview-questions/pattern-matching.md): 18 questions, Mid-Level - [Macros](https://sharpskill.dev/en/technologies/rust/interview-questions/macros.md): 20 questions, Mid-Level - [Serde & Serialization](https://sharpskill.dev/en/technologies/rust/interview-questions/serde-serialization.md): 20 questions, Mid-Level - [Unsafe Rust](https://sharpskill.dev/en/technologies/rust/interview-questions/unsafe-rust.md): 20 questions, Senior - [Advanced Traits](https://sharpskill.dev/en/technologies/rust/interview-questions/advanced-traits.md): 22 questions, Senior - [Advanced Lifetimes](https://sharpskill.dev/en/technologies/rust/interview-questions/advanced-lifetimes.md): 20 questions, Senior - [Type System](https://sharpskill.dev/en/technologies/rust/interview-questions/type-system.md): 20 questions, Senior - [Tokio & Async I/O](https://sharpskill.dev/en/technologies/rust/interview-questions/tokio-async.md): 22 questions, Senior - [Performance Optimization](https://sharpskill.dev/en/technologies/rust/interview-questions/performance-optimization.md): 20 questions, Senior - [Memory Management](https://sharpskill.dev/en/technologies/rust/interview-questions/memory-management.md): 20 questions, Senior - [Web Frameworks](https://sharpskill.dev/en/technologies/rust/interview-questions/web-frameworks.md): 22 questions, Senior - [Database Integration](https://sharpskill.dev/en/technologies/rust/interview-questions/database-integration.md): 20 questions, Senior - [Rust Design Patterns](https://sharpskill.dev/en/technologies/rust/interview-questions/design-patterns.md): 20 questions, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/en/technologies/rust/interview-questions/concurrency-basics