Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 3 fuera de 23 páginas
Examen

COS3721 Assignment 2 (COMPLETE ANSWERS) 2026 - DUE 1 July 2026

Document preview thumbnail
Vista previa 3 fuera de 23 páginas

COS3721 Assignment 2 (COMPLETE ANSWERS) 2026 - DUE 1 July 2026

Vista previa del contenido

COS3721 Assignment 2
(COMPLETE ANSWERS) 2026 -
DUE 1 July 2026




FOR ASSISTANCE CONTACT
EMAIL:

,Question 01 [15 marks]

a. Process Scheduling Under Each Approach (4)

 Per-core run queues: CPU-intensive tasks are placed into a specific core's queue and execute for
long stretches. Short interactive tasks arrive at a core's queue, wait behind whatever is currently
ahead of them, and are scheduled based on the local core's scheduling policy (e.g., Round-Robin
or Priority). Tasks generally remain tied to the core they arrived at unless an explicit migration or
load-balancing routine intervenes.

 Shared run queue: All 8 cores look at a single, centralized queue. When any core becomes idle,
it locks the shared queue, extracts the highest-priority task, and executes it. CPU-intensive tasks
are pulled by available cores and run for their time slice, while short interactive tasks are quickly
picked up by the next available core as soon as they become ready, irrespective of which core is
free.

b. Advantages and Disadvantages (6)

Per-Core Run Queues

 Advantages:

1. High Cache Affinity: A process tends to stay on the same core, keeping its cache lines
warm and significantly improving execution speed.

2. Low Lock Contention: Cores only access their local queue, eliminating a global
scheduling bottleneck and maximizing scalability.

 Disadvantages:

1. Load Imbalance: Some cores may become completely idle while other cores have
queues packed with processes, leading to inefficient hardware utilization.

2. Migration Overhead: Resolving imbalances requires complex load-balancing algorithms
to pull/push tasks across cores, which adds processing overhead.

Shared Run Queue

 Advantages:

1. Automatic Load Balancing: Workload is naturally distributed perfectly across all 8 cores;
a core will never sit idle if there is work left in the global queue.

2. Optimal Fairness / Minimised Latency: Short interactive tasks are picked up by the very
first core that becomes free, ensuring quick response times.

 Disadvantages:

1. High Lock Contention: All 8 cores must compete for a single mutual-exclusion lock on
the shared queue every time they need a new task, which degrades performance as
core counts scale.

, 2. Poor Cache Affinity: Tasks frequently hop between different cores every time they are
rescheduled, resulting in continuous cache misses and pipeline stalls.

c. Workload Balancing Comparison (2)

The Shared run queue approach makes it significantly easier to balance workloads. Because there is only
one global pool of threads, balancing happens automatically—no explicit workload balancing algorithms
are required. A core cannot become idle while another core is overloaded because any free core
immediately pulls the next ready task from the shared queue. In contrast, per-core queues require
continuous execution of complex load-balancing metrics to actively migrate threads from one queue to
another.

d. Recommendation and Justification (3)

Recommendation: Per-core run queues (with a periodic/work-stealing load balancer).

 Performance: Avoiding a single, heavily contested lock for all 8 cores prevents scheduling
bottlenecks, allowing the server to handle concurrent operations at maximum throughput.

 Cache Usage: This server runs heavy CPU-intensive video encoding. Video encoding processes
rely heavily on L1/L2 cache data structures. Keeping tasks on the same core maximizes cache
hits, which drastically speeds up mathematical calculations compared to a shared queue where
tasks hop across cores and constantly flush caches.

 Fairness: While a shared queue provides uniform immediate fairness, a per-core queue
approach can maintain systemic fairness via a background work-stealing mechanism (where
idle cores safely pull tasks from overloaded cores), giving the system the scalability of
distributed queues alongside the fairness of load balancing.

Question 02 [15 marks]

Rules Summary

 Priorities: Higher number = Higher priority ($7 > 6 > 5 > 4 > 3$).

 Tie-Breaker: If priorities match, use Round-Robin (RR) with a Time Quantum ($TQ = 8$).

 Preemption: If a strictly higher priority process arrives, the current process is immediately
preempted and moved to the back of its priority queue.

Step-by-Step Execution Tracking

 $t=0$: $P_1(\text{Prio } 6, B=18)$ and $P_2(\text{Prio } 4, B=12)$ arrive. $P_1$ has the highest
priority (6).

o $P_1$ runs from $t=0$ to $t=10$. Remaining burst for $P_1 = 8$.

 $t=10$: $P_3(\text{Prio } 5, B=15)$ arrives. $P_1$ (Prio 6) is still the highest priority process.
$P_3$ is placed in the priority 5 queue.

o $P_1$ runs from $t=10$ to $t=12$. Remaining burst for $P_1 = 6$.

Información del documento

Subido en
1 de julio de 2026
Número de páginas
23
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$2.50

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
gabrielmusyoka940
3.2
(233)
Vendido
1535
Seguidores
247
Artículos
1610
Última venta
20 horas hace


Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes