Lecture 01 · Introduction
المحاضرة 01 · مقدمة
The continuum and the memory hierarchy analogy
السلسلة المتصلة (continuum) وتشبيه هرم الذاكرة
P2 SHOULDBetween client and server there is not a wire but a range of places to put compute. Networks and CPUs already layer that range. Edge is to cloud what cache is to RAM.
بين الـclient والخادم ليس سلكاً فارغاً، بل مدى من الأماكن التي يمكن وضع الحوسبة فيها. الشبكات والمعالجات تقسّم هذا المدى إلى طبقات أصلاً. والـedge بالنسبة للسحابة كالـcache بالنسبة للـRAM.
Why layering: the path is a range, not a wire
لماذا الطبقات: المسار مدى متصل لا سلك واحد
Slide 46 opens the Edge-to-Cloud (E2C) Continuum with one question: why is layering necessary in modern web applications? The picture puts Layer 1, Layer 2 and Layer 3 between Client and Server, with latency growing along the line. Each layer is a candidate location for compute and storage. Near layers answer sooner; far layers are bigger.
تفتح الشريحة 46 موضوع Edge-to-Cloud (E2C) Continuum بسؤال واحد: لماذا التقسيم إلى طبقات ضروري في تطبيقات الويب الحديثة؟ تضع الصورة Layer 1 وLayer 2 وLayer 3 بين الـClient والـServer، مع latency تزداد على طول الخط. كل طبقة مكان مرشّح للحوسبة والتخزين. الطبقات القريبة تجيب أسرع، والبعيدة أكبر سعة.
The answer: so that each request can be served by the nearest layer that has enough capacity. If every request had to cross the full distance to one far server, every click would pay the full round trip.
الجواب: كي يُخدم كل طلب من أقرب طبقة لديها سعة كافية. لو اضطر كل طلب لقطع المسافة كاملة إلى خادم بعيد واحد، لدفعت كل نقرة رحلة الذهاب والإياب كاملة.
What "continuum" means
ماذا تعني continuum
Slide 47 defines it: a range or series of things that are slightly different from each other and that exist between two different possibilities (points). Its example is the electromagnetic spectrum. Walk from 400 nm to 700 nm: one nanometre changes nothing visible, there is no single point where blue stops and green starts, yet 400 nm (violet) and 700 nm (red) are obviously different.
تعرّفه الشريحة 47: مدى أو سلسلة من الأشياء التي يختلف بعضها عن بعض اختلافاً طفيفاً، وتقع بين احتمالين (نقطتين) مختلفين. مثالها هو الطيف الكهرومغناطيسي. امشِ من 400 nm إلى 700 nm: نانومتر واحد لا يغيّر شيئاً مرئياً، ولا توجد نقطة محددة ينتهي عندها الأزرق ويبدأ الأخضر، ومع ذلك فإن 400 nm (بنفسجي) و700 nm (أحمر) مختلفان بوضوح.
Adjacent points
النقاط المتجاورة
Barely differ. No sharp internal boundary.
تختلف اختلافاً طفيفاً جداً. لا توجد حدود داخلية حادة.
Endpoints
الطرفان
Differ greatly: device vs hyperscale cloud region, violet vs red.
تختلف كثيراً: الجهاز مقابل منطقة سحابية ضخمة، البنفسجي مقابل الأحمر.
Mapped to computing: the endpoints are "compute on the device" and "compute in a hyperscale cloud". Everything between is a candidate location. Names like edge and fog work like "UV" and "infrared": labels people put on one smooth range, not walls. So edge and cloud are regions of one range, not two separate technologies. A telco site 50 km away and a regional data centre 500 km away differ by degree, not by kind.
بإسقاطه على الحوسبة: الطرفان هما "الحوسبة على الجهاز" و"الحوسبة في سحابة ضخمة". وكل ما بينهما مكان مرشّح. أسماء مثل edge وfog تعمل مثل "UV" و"infrared": تسميات يضعها الناس على مدى واحد متصل، وليست جدراناً. إذن الـedge والسحابة منطقتان من مدى واحد، وليسا تقنيتين منفصلتين. موقع اتصالات على بُعد 50 km ومركز بيانات إقليمي على بُعد 500 km يختلفان في الدرجة لا في النوع.
Networks already layer the path: LAN and WAN tiers
الشبكات تقسّم المسار إلى طبقات أصلاً: مقاطع LAN وWAN
Slide 48 connects a user to a printer in another city. At least three segments are needed: LAN 1 (switching), WAN (routing), LAN 2 (switching), laid out along the networking continuum of distance.
تربط الشريحة 48 مستخدماً بطابعة في مدينة أخرى. يلزم على الأقل ثلاثة مقاطع: LAN 1 (switching) وWAN (routing) وLAN 2 (switching)، مرتبة على networking continuum الخاص بالمسافة.
| Tier (slide label)المقطع (تسمية الشريحة) | Spanالمدى | Deviceالجهاز | Forwards byيوجّه حسب | Stack layer it works atطبقة المكدّس التي يعمل فيها |
|---|---|---|---|---|
| LAN 1 ("Layer 1") | One buildingمبنى واحد | Switch | MAC addressعنوان MAC | Link layer (layer 2)Link layer (الطبقة 2) |
| WAN ("Layer 2") | Between citiesبين المدن | Router | IP addressعنوان IP | Network layer (layer 3)Network layer (الطبقة 3) |
| LAN 2 ("Layer 3") | One officeمكتب واحد | Switch | MAC addressعنوان MAC | Link layer (layer 2)Link layer (الطبقة 2) |
يبيّن الجدول المقاطع الثلاثة: مداها، والجهاز الذي يخدمها، وما يعتمد عليه في التوجيه، وطبقة المكدّس التي يعمل فيها. الملاحظة الأهم: تسميات الشريحة "Layer 1, 2, 3" هي مواقع على المسار (tiers) وليست طبقات المكدّس. الـswitch يعمل في link layer (الطبقة 2) والـrouter في network layer (الطبقة 3).
Why not one technology end to end? A switch learns MAC addresses by flooding, which is cheap inside a building and absurd across the planet. A router forwards by hierarchical IP addresses with computed tables, which scales across networks. Each technology fits one stretch, so the path is built from tiers.
لماذا لا تقنية واحدة من الطرف إلى الطرف؟ الـswitch يتعلّم عناوين MAC بالإغراق (flooding)، وهذا رخيص داخل مبنى ومستحيل عبر الكوكب. أما الـrouter فيوجّه بعناوين IP الهرمية وجداول محسوبة، وهذا يتوسّع عبر الشبكات. كل تقنية تناسب مقطعاً واحداً، فيُبنى المسار من طبقات.
The memory hierarchy: placement by urgency
هرم الذاكرة: التوزيع حسب الإلحاح
Slide 49 moves the same pattern inside one computer, where the axis is time: registers (1 ns), cache (5 ns), RAM (15 ns), then disk, forming a continuum of latencies (access time). The two rules on the slide:
تنقل الشريحة 49 النمط نفسه إلى داخل حاسوب واحد، حيث المحور هو الزمن: registers (1 ns) ثم cache (5 ns) ثم RAM (15 ns) ثم القرص، مكوّنةً a continuum of latencies (access time). والقاعدتان في الشريحة:
- Keep immediately needed data in the registers: operational data for the currently executing instruction.
احتفظ بالبيانات المطلوبة فوراً (immediately) في الـregisters: البيانات التشغيلية للتعليمة المنفَّذة حالياً.
- Keep frequently accessed data in the cache, very close to the CPU.
احتفظ بالبيانات المستخدمة بكثرة (frequently) في الـcache، قريباً جداً من المعالج.
Why can a small cache serve most reads? Locality. Programs reuse data they touched recently (temporal locality) and data stored near it (spatial locality). So a small fast layer that holds those items answers most requests. Cache is much smaller than RAM; it is fast memory that is expensive per byte, so only a little can sit close to the processor.
لماذا يستطيع cache صغير أن يخدم معظم القراءات؟ بسبب المحلية (locality). البرامج تعيد استخدام البيانات التي لمستها مؤخراً (temporal locality) والبيانات المخزنة بجوارها (spatial locality). فطبقة صغيرة سريعة تحمل هذه العناصر تجيب معظم الطلبات. الـcache أصغر بكثير من الـRAM، فهي ذاكرة سريعة غالية لكل بايت، ولا يمكن وضع إلا القليل منها قرب المعالج.
Slide 50 gives measured numbers (Cornell Virtual Workshop, Intel Skylake server) for the CPU-to-hard-disk continuum, naming two resources: channel bandwidth and storage. Going outward, bandwidth roughly halves and latency roughly quadruples at each step.
تعطي الشريحة 50 أرقاماً مقاسة (Cornell Virtual Workshop، معالج Intel Skylake للخوادم) لـCPU-to-HardDisk continuum، وتسمّي موردين: channel bandwidth وstorage. كلما ابتعدنا تقل bandwidth إلى النصف تقريباً وتتضاعف latency أربع مرات تقريباً في كل خطوة.
Slide 50's side box is the placement policy in everyday terms: when editing a video, the current frames sit in cache or registers for real-time editing, raw footage is loaded from the SSD into RAM for processing, and archived projects are retrieved from slower storage only when needed.
الصندوق الجانبي في الشريحة 50 هو سياسة التوزيع بلغة يومية: عند تحرير فيديو تبقى الإطارات الحالية في الـcache أو الـregisters للتحرير الفوري، واللقطات الخام تُحمَّل من SSD إلى RAM للمعالجة، والمشاريع المؤرشفة تُجلب من تخزين أبطأ عند الحاجة فقط.
Transfer time: T = S/B + L
زمن النقل: T = S/B + L
Bandwidth and latency only become a decision when combined into the time a fetch takes:
لا تصبح bandwidth وlatency أداة قرار إلا عند جمعهما في زمن الجلب الفعلي:
T = SB + L
S is the data size, B the bandwidth, L the fixed latency paid on every fetch. Small S: S/B is nearly zero and latency dominates. Large S: S/B dwarfs L and bandwidth dominates.
S حجم البيانات، وB الـbandwidth، وL التأخير الثابت المدفوع في كل جلب. عندما يكون S صغيراً يقترب S/B من الصفر ويهيمن latency. وعندما يكون S كبيراً يطغى S/B على L وتهيمن bandwidth.
Memory level, using slide 50's main-memory figures (B = 10 GB/s, L = 90 ns):
على مستوى الذاكرة، باستخدام أرقام الذاكرة الرئيسية في الشريحة 50 (B = 10 GB/s، L = 90 ns):
Small: one 64-byte cache line S/B = 64 B / 10 GB/s = 6.4e-8 GB / 10 GB/s = 6.4 ns T = 6.4 ns + 90 ns = 96.4 ns latency = 93% of T Large: a 16 KB block S/B = 1.6e-5 GB / 10 GB/s = 1.6 us = 1,600 ns T = 1,600 ns + 90 ns = 1,690 ns latency = 5% of T
Network level, same law. Assume a 100 Mbit/s link with L = 50 ms:
على مستوى الشبكة، القانون نفسه. افترض رابطاً بسرعة 100 Mbit/s مع L = 50 ms:
Small message, 1 KB = 8,000 bits S/B = 8,000 / 100,000,000 s = 0.08 ms T = 0.08 ms + 50 ms = 50.08 ms latency dominates Large file, 1 GB = 8,000,000,000 bits S/B = 8e9 / 1e8 s = 80 s T = 80 s + 0.05 s = 80.05 s bandwidth dominates
For the small message, doubling the bandwidth saves 0.04 ms out of 50.08 ms: almost nothing. Moving the server closer to cut L is what helps. For the large file, halving latency saves 0.025 s out of 80 s; only bandwidth helps. Interactive, click-by-click requests are small, so they are latency-bound, which is exactly why edge placement pays off.
في الرسالة الصغيرة، مضاعفة الـbandwidth توفّر 0.04 ms من 50.08 ms: لا شيء تقريباً. ما يفيد هو تقريب الخادم لتقليل L. وفي الملف الكبير، تنصيف التأخير يوفّر 0.025 s من 80 s، والـbandwidth وحدها تفيد. الطلبات التفاعلية (نقرة بنقرة) صغيرة، فهي محكومة بالـlatency، ولهذا بالضبط يفيد وضعها على الـedge.
The analogy the course is built on
التشبيه الذي يقوم عليه المقرر
CPU cache is to RAM as edge is to cloud. Both put a small, fast, nearby tier in front of a large, slower, distant one. Both answer most requests from the near tier because of locality, and both fall back to the far tier on a miss: the CPU goes to RAM, the edge forwards the request to the cloud and pays the extra latency. Bulk analytics is not latency-bound and needs capacity, so it belongs in the cloud.
الـcache بالنسبة للـRAM كالـedge بالنسبة للسحابة. كلاهما يضع طبقة صغيرة سريعة قريبة أمام طبقة كبيرة أبطأ بعيدة. كلاهما يجيب معظم الطلبات من الطبقة القريبة بسبب locality، وكلاهما يرجع إلى الطبقة البعيدة عند الإخفاق (miss): المعالج يذهب إلى الـRAM، والـedge يحوّل الطلب إلى السحابة ويدفع التأخير الإضافي. أما التحليلات الضخمة فليست محكومة بالتأخير وتحتاج سعة، فمكانها السحابة.
"Desk, shelf, library." The page you read is in your hand, this week's books are on the desk, the collection is on the shelf, everything else is at the library. You never carry the library to your desk.
"المكتب، الرف، المكتبة." الصفحة التي تقرؤها في يدك، وكتب هذا الأسبوع على المكتب، والمجموعة على الرف، وكل ما عدا ذلك في المكتبة العامة. لا أحد يحمل المكتبة إلى مكتبه.
- A continuum is not "distinct categories with sharp boundaries", and not "identical resources everywhere". Adjacent points barely differ; endpoints differ greatly.
الـcontinuum ليس "فئات منفصلة بحدود حادة"، وليس "موارد متطابقة في كل مكان". النقاط المتجاورة تختلف قليلاً، والطرفان يختلفان كثيراً.
- Tiers are not protocol stack layers. Slide 48's "Layer 1, 2, 3" are positions on the path. Switching is the link layer (2); routing is the network layer (3).
الـtiers ليست طبقات المكدّس. "Layer 1, 2, 3" في الشريحة 48 مواقع على المسار. الـswitching في link layer (2)، والـrouting في network layer (3).
- Cache capacity does not exceed RAM. Cache is far smaller. And the cache works because of locality, not because everything gets copied into it.
سعة الـcache لا تتجاوز الـRAM. الـcache أصغر بكثير. وهو ينجح بسبب locality، لا لأن كل شيء يُنسخ إليه.
- "Faster" hides two resources. A tiny request is latency-bound; more bandwidth barely helps it.
كلمة "أسرع" تخفي موردين. الطلب الصغير محكوم بالـlatency، وزيادة الـbandwidth بالكاد تفيده.
Check yourself
اختبر نفسك
What best describes a continuum, as used in the edge-to-cloud continuum?
ما أفضل وصف للـcontinuum كما يُستخدم في edge-to-cloud continuum؟
C. Slide 47: a series of things slightly different from each other, existing between two different points. Edge, fog and cloud are labels on one range. A describes the opposite, B removes the differences between ends, and D is an invented rule.
الجواب C. الشريحة 47: سلسلة من أشياء يختلف بعضها عن بعض قليلاً، وتقع بين نقطتين مختلفتين. edge وfog وcloud تسميات على مدى واحد. A يصف العكس، وB يلغي الفرق بين الطرفين، وD قاعدة مخترعة.
In slide 48's user-to-printer path, the first LAN segment is labelled "Layer 1". At which standard stack layer does its switching operate?
في مسار المستخدم إلى الطابعة في الشريحة 48، مقطع LAN الأول مُسمّى "Layer 1". في أي طبقة قياسية من المكدّس يعمل الـswitching فيه؟
B. Switches forward frames by MAC address at the link layer. "Layer 1" on the slide is a tier position along the path, not a stack layer number, so A is the trap. Routing in the WAN tier is the network layer.
الجواب B. الـswitch يمرّر الإطارات بعناوين MAC في link layer. "Layer 1" في الشريحة موقع على المسار وليس رقم طبقة في المكدّس، فالخيار A هو الفخ. أما الـrouting في مقطع WAN فهو في network layer.
Why can a small CPU cache serve most of the memory reads a program makes?
لماذا يستطيع cache صغير أن يخدم معظم قراءات الذاكرة التي يقوم بها البرنامج؟
C. Temporal locality (recent data is reused) and spatial locality (nearby data is used next) mean a small fast layer holding those items answers most reads. A is false: cache is much smaller than RAM. B describes copying everything, which locality makes unnecessary.
الجواب C. temporal locality (إعادة استخدام البيانات الحديثة) وspatial locality (استخدام البيانات المجاورة لاحقاً) تعنيان أن طبقة صغيرة سريعة تحمل هذه العناصر تجيب معظم القراءات. A خطأ: الـcache أصغر بكثير من الـRAM. وB يصف نسخ كل شيء، وهو ما تجعله locality غير ضروري.
A link has B = 100 Mbit/s and L = 50 ms. Using T = S/B + L, roughly how long does a 1 KB (8,000-bit) message take, and what dominates?
رابط فيه B = 100 Mbit/s وL = 50 ms. باستخدام T = S/B + L، كم تستغرق رسالة حجمها 1 KB (8,000 بت) تقريباً، وما الذي يهيمن؟
A. S/B = 8,000 / 100,000,000 = 0.00008 s = 0.08 ms. T = 0.08 + 50 = 50.08 ms, so latency is over 99% of the time. C forgets to add L; B mixes up units. Cutting latency (moving closer) is the only lever that matters here.
الجواب A. S/B = 8,000 / 100,000,000 = 0.00008 s = 0.08 ms. إذن T = 0.08 + 50 = 50.08 ms، فالتأخير أكثر من 99% من الزمن. الخيار C ينسى إضافة L، وB يخلط الوحدات. تقليل التأخير (الاقتراب) هو الرافعة الوحيدة المهمة هنا.
Complete the analogy: CPU cache is to RAM as ____ is to ____. And what does a cache miss correspond to?
أكمل التشبيه: الـcache بالنسبة للـRAM كـ____ بالنسبة لـ____. وما الذي يقابل الـcache miss؟
D. The edge is the small, fast, near tier in front of the large, far cloud. On a miss the CPU falls back to RAM, and the edge falls back to the cloud. A reverses the roles, B never reaches the far tier, and C swaps in the networking tiers, which is a different continuum.
الجواب D. الـedge هو الطبقة الصغيرة السريعة القريبة أمام السحابة الكبيرة البعيدة. عند الإخفاق يرجع المعالج إلى الـRAM، ويرجع الـedge إلى السحابة. A يعكس الأدوار، وB لا يصل أبداً إلى الطبقة البعيدة، وC يستبدلها بطبقات الشبكة، وهي continuum مختلف.