الساعات والترتيب
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
see why wall-clock time cannot order events across nodes.
الموضوعات المخطط لها
- Each machine has its own clock; they drift and are corrected by NTP, sometimes jumping backward.
- Two events with timestamps from different machines cannot be reliably ordered.
- Within one machine use a monotonic clock for durations (
System.nanoTime()), not wall time. - Logical ordering uses counters: Lamport clocks and vector clocks (conceptual).
- Practical choices: order by a single log (Kafka partition) or a database sequence.
تفاصيل المخطط المبدئي
عرض عملي
two nodes, one at 10:00:05 and one at 10:00:03, where the later event has the smaller timestamp.
اختبر فهمك
Which clock measures elapsed time safely?
أظهر الإجابة
A monotonic clock, System.nanoTime().
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.