انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-005-L03

الطوابير الحاجبة والمنتج والمستهلك

  • الدرس 3 من 5
  • Mid-level
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

build a bounded pipeline with backpressure.

الموضوعات المخطط لها

  • BlockingQueue: put blocks when full, take blocks when empty; offer/poll accept timeouts.
  • ArrayBlockingQueue is bounded; LinkedBlockingQueue is unbounded unless given a capacity.
  • A bounded queue gives backpressure: fast producers slow down instead of exhausting memory.
  • Stopping consumers: send a poison pill, or interrupt the workers.
  • Choose queue size from latency tolerance, not "large to be safe".
تفاصيل المخطط المبدئي

عرض عملي

java
BlockingQueue<OrderEvent> q = new ArrayBlockingQueue<>(1_000);
// producer: q.put(event);   consumer: var e = q.take();

اختبر فهمك

What happens when a producer calls put on a full queue?

أظهر الإجابة

It blocks until space is free.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.