Edge & Fog Computing · Study deck

Fog Resource Allocation

A gateway is the nearby computer that receives device messages and passes work onward.

Edge Eddie is your guide for this deck.

resourceallocation
Edge Eddie, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Build a fog resource allocation record from workload contracts and measured capacity.
  • Separate hard feasibility gates from ranking and optimization rules.
  • Choose between reservations, quotas, priority queues, backpressure, load shedding, and migration.
  • Explain why resource allocation must include CPU, memory, accelerator, storage, network, energy, thermal, and failure-mode constraints.
iotclass.org

Major section

Start Simple

A gateway is the nearby computer that receives device messages and passes work onward.

  • Firmware is the software stored on a device.
  • Alarms, camera clips, stock checks, and updates may all reach it at once.
  • A high average score can hide a short burst, a hot processor, full memory, or a blocked link.
iotclass.org

Major section

Start Simple (continued)

The useful check is whether urgent work still finishes on time while less important work slows down.

  • This simple story does not choose exact limits or prove that moving work is safe.
  • Those choices need measured demand, spare capacity, and a recovery plan.
  • A move can cost more time and energy than it saves.
iotclass.org

Major section

Minimum Viable Understanding · Most Valuable Understanding

Allocate to workload contracts, not to device names.: A refrigerator alarm, a video summary, a firmware update, and a status heartbeat should not receive the same treatment.

  • Admission control is part of allocation.: Refusing or deferring a task can be the correct answer when accepting it would break existing commitments.
  • Queues are signals.: Queue depth, deadline misses, memory pressure, thermal state, and network backlog should change allocation decisions.
  • Rebalancing has a cost.: Migrating containers, changing quotas, or moving tasks can interrupt sessions and should be gated by evidence.
  • High utilization is useful only after deadlines, safety, recovery, and fairness are protected.
iotclass.org

Major section

Why This Chapter Exists

Fog nodes sit close to devices, but they are not miniature clouds with unlimited headroom.

  • A gateway may have a small CPU, limited memory, one accelerator, a flash device with finite write endurance, a shared uplink, and a thermal envelope that changes with the enclosure and ambient temperature.
  • "Which work gets protected capacity?": Reserve capacity for control, safety, recovery, and observability paths before best-effort work consumes the node.
  • "Can this node accept another workload?": Check deadline, memory, network, storage, energy, thermal, and fallback constraints before starting the task.
iotclass.org

Major section

The Allocation Surface

Resource allocation is broader than CPU percentages.

  • A task can be CPU-light but memory-heavy, network-heavy, flash-write-heavy, accelerator-bound, or thermally risky.
  • These feed the Multi-Objective Optimizer, Constraint Solver, and Resource Allocator, which can choose task partitioning, traffic shaping, placement, or caching.
Fog resource allocation as multi-objective optimization: application requirements, resource availability, and system constraints feed an optimizer and constraint solver that place and size workloads.
Fog resource allocation as multi-objective optimization: application requirements, resource availability, and system constraints feed an optimizer and constraint solver that place and size workloads.
iotclass.org

Major section

Build the Allocation Record

The record should be short, measurable, and reviewable.

  • Task name, traffic class, deadline, statefulness, persistence need, burst pattern, retry behavior, and criticality.
  • Conditions that must be true before a workload starts or receives more quota.
  • Priority, fair-share, quota, deadline, or weighted policy used after feasibility gates pass.
iotclass.org

Major section

The Stable Allocation Model · Pitfall: A High Score Cannot Override a Hard Gate

A stable allocator is easier to audit when hard gates are separated from ranking.

  • React to pressure: throttle best_effort before important work shed optional work before violating critical deadlines migrate only when destination headroom and state cost are acceptable.
  • The model can use weighted fairness, deadline scheduling, token buckets, priority queues, or container limits.
  • The important part is that the chosen mechanism is tied to the workload contract and verified under pressure.
iotclass.org

Major section

Placement, Scheduling, and Admission Gates · Interactive Quiz: Match the Control to the Risk

A fog allocator has three related jobs.

  • Placement chooses which node can host a task under CPU, memory, accelerator, storage, network, and energy limits.
  • Scheduling orders accepted work using priority, quota, fair share, or earliest-deadline-first rules.
  • Admission control decides whether new work may start at all.

Why it matters

Admission and hard feasibility gates come before ranking because no scheduling score can make an infeasible workload safe.

Try it: Placement, Scheduling, and Admission Gates · Interactive Quiz: Match the Control to the Risk in the chapter

iotclass.org

Major section

Allocation Control Loop

Fog allocation is not a one-time bin-packing exercise.

  • The node must observe pressure, adjust work, and document when the allocation record is no longer valid.
  • Feasible? Protects hard limits and reserve before 3.
  • Admit applies quotas and preserves critical tasks; 4.
  • Under pressure, the node may throttle, shed, defer, buffer, or migrate, but Fallback Capacity stays free.
Fog resource allocation control loop showing pressure measurement, protected-reserve feasibility, admission, scheduling, pressure response, fallback capacity, and review triggers.
Fog resource allocation control loop showing pressure measurement, protected-reserve feasibility, admission, scheduling, pressure response, fallback capacity, and review triggers.
iotclass.org

Major section

Allocation Control Loop (continued)

Repeated pressure or deadline drift reaches Review Trigger, reopening the allocation record instead of normalising overload.

  • Admit and schedule.: Use reservations, quotas, priorities, or fair-share rules that match workload criticality and measured demand.
  • Respond to pressure.: Throttle, shed, defer, buffer, or migrate in an order that preserves critical commitments.
  • Reopen the record.: Treat repeated pressure, drift, deadline misses, or failover problems as evidence that the allocation policy needs review.
iotclass.org

Major section

Interactive Quiz: Sequence the Allocation Loop · Allocation Pattern Guide

The correct choice depends on measured demand, criticality, and failure mode.

  • Control, safety, and local recovery paths should keep capacity even when analytics, updates, or reporting jobs are busy.
  • The fog node directly affects equipment, local alarms, or operator safety.
  • Average utilization can look healthy while queue age on the critical path is already unsafe.

Try it: Interactive Quiz: Sequence the Allocation Loop · Allocation Pattern Guide in the chapter

iotclass.org

Major section

Worked Example: Clinic Cold-Storage Gateway

Normal temperature samples are small and delay tolerant.

  • Out-of-range alarms must be processed locally, logged, and shown to staff even when the WAN is down.
  • A gateway also runs a daily diagnostic summary and occasionally downloads updates.
  • Small periodic events, delay tolerant, can be buffered and replayed when the backhaul returns.
iotclass.org

Major section

Worked Example: Clinic Cold-Storage Gateway (continued)

Batch work, useful for maintenance, may be delayed during alarms, WAN outages, or thermal pressure.

  • High storage and network demand, must never consume alarm reserve or recovery storage.
  • Normal telemetry receives a bounded queue and replay budget.
  • Diagnostic summaries run only when queue age and thermal state are healthy.
iotclass.org

Major section

Common Mistakes · Review Checklist

Memory, accelerator slots, flash writes, broker queues, uplink backlog, energy, and cooling can be the real limit.

  • Backpressure, queue limits, and shedding rules are safer than pretending storage and retry time are infinite.
  • Moving a task can duplicate commands, lose local cache, reset TLS sessions, or overload the destination link.
  • A node under pressure still needs enough capacity to report health, expose logs, and accept operator actions.
iotclass.org

Major section

Reference Notes · Summary

TCP-style feedback, operating-system scheduling, container resource controls, queueing theory, and distributed-systems admission control all inform fog allocation, but none of them replaces local measurement.

  • They become engineering evidence only after the node, enclosure, firmware, workload, and network path have been measured.
  • Fog resource allocation is a measured capacity decision.
  • The strongest designs explain what is allowed to run, what must wait, what can be shed, and what must keep working during degraded modes.
iotclass.org

Deck summary

Key takeaways

A gateway is the nearby computer that receives device messages and passes work onward.

  • The useful check is whether urgent work still finishes on time while less important work slows down.
  • Allocate to workload contracts, not to device names.: A refrigerator alarm, a video summary, a firmware update, and a status heartbeat should not receive the same treatment.
  • Fog nodes sit close to devices, but they are not miniature clouds with unlimited headroom.
  • Resource allocation is broader than CPU percentages.
iotclass.org

Retrieval practice

Recall check 1 of 4

Edge Eddie says: answer from memory, then check your reasoning.

Q1Fog resource allocation should be tied to what, rather than to device names?

AThe device that happens to run the newest firmware version, regardless of deadline or criticality
BWorkload contracts, so a safety alarm and a status heartbeat get different guarantees
CThe alphabetical order of device identifiers, even when the workloads have different risks
DWhichever workload arrived at the gateway earliest, before checking reserves or deadlines
Show answer

Answer: B Fog allocation is tied to workload contracts, so critical and best-effort work receive different guarantees regardless of device.

iotclass.org

Retrieval practice

Recall check 2 of 4

Edge Eddie says: answer from memory, then check your reasoning.

Q2A fog gateway receives a critical motor-stop command stream and a best-effort video-summary job. CPU is still available on average, but the queue sometimes delays the motor-stop path. What is the strongest allocation decision?

AKeep both workloads equal because average CPU utilization is below 100 percent and the queue will probably recover.
BMove both workloads to a cloud service with more compute headroom, using its larger capacity to shorten the shared processing queue.
CProtect the motor-stop path with reserved capacity and priority, then throttle or defer the video-summary job when the reserve is threatened.
DIncrease video priority so the best-effort queue drains faster, even if motor-stop commands wait longer.
Show answer

Answer: C Fog allocation begins with workload contracts.

iotclass.org

Retrieval practice

Recall check 3 of 4

Edge Eddie says: answer from memory, then check your reasoning.

Q3Three tasks needing 2, 2, and 1.5 CPU units arrive at a fog node with 4 CPU units of capacity. What allocation decision protects the system?

AAdmit all three because scheduling priority will reduce total CPU demand after queues begin to build.
BReject every task even though two can fit inside the node limit and serve useful work.
CPlace feasible work locally, then defer, relocate, shrink, or reject the remaining task instead of overcommitting.
DRaise every task's priority so 5.5 CPU units becomes less than the 4 CPU-unit capacity limit.
Show answer

Answer: C Fog allocation should fit feasible work under hard resource limits and use admission control for work that would overcommit the node.

iotclass.org

Retrieval practice

Recall check 4 of 4

Edge Eddie says: answer from memory, then check your reasoning.

Q4Place each resource-allocation control where it lives so you can admit only feasible work and recover cleanly when fog capacity changes.

AWorkload contract
BVendor invoice
CDashboard color
DPacket checksum
Show answer

Answer: A Separate demand evidence, scheduling decisions, and recovery review so you can explain why a workload was admitted, placed, or moved.

Q5Complete the admission function so it protects reserved capacity before accepting best-effort work.

Aspare_cpu = node['free_cpu'] - reserve
Bspare_cpu = node['total_cpu'] + reserve
Cspare_cpu = task['cpu'] - reserve
Dspare_cpu = node['free_cpu']
Show answer

Answer: A Critical work can use currently free capacity if memory also fits.

iotclass.org

Print reference

Answers

Answer key.

  1. B · Fog allocation is tied to workload contracts, so critical and best-effort work receive different guarantees regardless of device.
  2. C · Fog allocation begins with workload contracts.
  3. C · Fog allocation should fit feasible work under hard resource limits and use admission control for work that would overcommit the node.
  4. A · Separate demand evidence, scheduling decisions, and recovery review so you can explain why a workload was admitted, placed, or moved.
  5. A · Critical work can use currently free capacity if memory also fits.
iotclass.org