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

In 60 Seconds · Start Simple

Fog resource allocation is the discipline of deciding which workloads may use scarce local compute, memory, accelerator, storage, network, and energy capacity.

  • A good allocator does not chase maximum utilization alone.
  • A gateway is the nearby computer that receives device messages and passes work onward.
  • Firmware is the software stored on a device.
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 · The Allocation Surface

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.
  • Resource allocation is broader than CPU percentages.

Key terms

If every workload
If every workload is admitted because the average looks fine, the first burst can break the very local response that justified fog placement.
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 · Measure Before You Allocate

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

Fog resource allocation is the discipline of deciding which workloads may use scarce local compute, memory, accelerator, storage, network, and energy capacity.

  • 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.
  • The record should be short, measurable, and reviewable.
  • A stable allocator is easier to audit when hard gates are separated from ranking.
iotclass.org

Retrieval practice

Recall check 1 of 5

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

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

AChoose the device running the newest firmware because version recency determines deadline and task criticality.
BThe alphabetical order of device identifiers, even when the workloads have different risks
CWhichever workload arrived at the gateway earliest, before checking reserves or deadlines
DWorkload contracts, so a safety alarm and a status heartbeat get different guarantees
Show answer

Answer: D 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 5

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?

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

Answer: A Fog allocation begins with workload contracts.

iotclass.org

Retrieval practice

Recall check 3 of 5

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 because admitting two useful tasks would still violate the node's scheduling limit.
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 5

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

Q4What states latency, CPU, memory and priority demands a scheduler must satisfy?

AWorkload contract
BCapacity snapshot
CFeasibility gates
DScheduler controls
Show answer

Answer: A Latency, memory, CPU, and priority requirements define what the scheduler must satisfy.

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

Retrieval practice

Recall check 5 of 5

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

Q6A fog allocator keeps moving a report job between nodes after small queue changes, while low-priority reports never finish. What should its control loop do?

AMove the report job on each queue sample, even when small changes make it bounce between nodes.
BKeep critical reserve and fair report share; use dwell and distinct move/return thresholds; review sustained pressure.
CGive urgent work every slot permanently, leaving feasible reports unfinished even as their queue age rises under overload.
DIgnore report queue age after the first placement, even if low-priority jobs remain unfinished.
Show answer

Answer: B Reserve and fair share protect both classes; dwell time and hysteresis prevent small queue changes from causing repeated moves.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. D · Fog allocation is tied to workload contracts, so critical and best-effort work receive different guarantees regardless of device.
  2. A · 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 · Latency, memory, CPU, and priority requirements define what the scheduler must satisfy.
  5. A · Critical work can use currently free capacity if memory also fits.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. B · Reserve and fair share protect both classes; dwell time and hysteresis prevent small queue changes from causing repeated moves.
iotclass.org