What is the conceptual difference between a buffered and an unbuffered channel, and how does the blocking behavior change for the sender in each case?
Last updated
An unbuffered channel has no capacity and requires a sender and receiver to meet (rendezvous); a buffered channel has a fixed capacity and only blocks the sender when that buffer is full.
Unbuffered (
make(chan T)):Send blocks until another goroutine receives; it's a synchronization point (handshake).
Guarantees the value was handed off before the sender proceeds.
Buffered (
make(chan T, n)):Send succeeds immediately while the buffer has room; the sender only blocks when the buffer is full.
Decouples sender and receiver timing, useful for smoothing bursts.
Receiver side: Receive blocks whenever the channel is empty, buffered or not.
Design note: Unbuffered gives stronger ordering/happens-before guarantees; buffering trades that for throughput and looser coupling.
- https://salestalentinc.com/software-development-recruiters/
- https://bencheung.me/intern-newgrad-guide
- https://www.jobfluent.com/feeds/jobs-london.xml
- https://www.reddit.com/r/leetcode/comments/1e3ca3q/microsoft_senior_swe_interview_experience_with/
- https://www.lockedinai.com/company-details/HPQ
- https://www.reddit.com/r/rust/comments/1h15md8/goodbye_rust_i_wish_you_success_but_im_back_to_c/
- https://www.reddit.com/r/golang/comments/1gfjnzm/since_when_is_senior_golang_developer_expected_to/