All projects

SYSTEMS / UCT · CSC3002 / 2024

OS scheduling: Andre the Barman

Explore queue policy, thread coordination and measurement validity through FCFS/SJF service simulation and a separate address translator.

JavaConcurrencyOperating systems

UCT / COURSE CONTEXT / 2024

CSC3002F · Computer Science 3002

Operating-system organisation and computer networks, with an Internet-protocol focus.

Science handbook · 2024

ENGINEERING PERSPECTIVE

Inside the work

Make scheduling policy and measurement design concrete: competing requests enter a queue, but a meaningful comparison also requires correct arrival, first-service and completion timestamps.

Java / blocking queues
LinkedBlockingQueue and PriorityBlockingQueue express FCFS and SJF service choices.
CountDownLatch / threads
Coordinate the start and service lifecycle of patron requests.
STEP 1 / 3

Submit requests

Patron threads create orders after a coordinated start.

Source-derived walkthrough

What it is

Explore the behaviour of scheduler policies in a concurrent service simulation and map virtual addresses to physical frames using a fixed page table.

Why it was built

Compare queue policies under competing requests and separately understand how a page-table mapping translates addresses.

My contribution

Individual named address translator; scheduling coursework on attributed teaching scaffolding remains private. The console programme identifies Andre the Barman; the Swing club simulation is a different 2023 assignment.

How it works

Patron and service threads coordinate with CountDownLatch. FIFO and priority queues support FCFS/SJF policies; timing outputs capture wait, response and turnaround behaviour. A separate memory exercise decodes little-endian addresses.

  1. 01Concurrent requests
  2. 02FIFO / priority queue
  3. 03FCFS / SJF service
  4. 04Timing outputs

Technical implementation

  • Patron threads submit DrinkOrder objects to a BlockingQueue. FCFS uses LinkedBlockingQueue; SJF uses PriorityBlockingQueue with the order comparison.
  • A CountDownLatch coordinates the initial start. The barman thread takes orders, sleeps for their service duration and signals completion.
  • Private three-patron runs under each policy completed on JDK 17. They exposed invalid aggregate timing calculations, which remain disclosed rather than treated as benchmarks.
  • The public OS1 translator decodes little-endian eight-byte records using a fixed seven-entry page table and a seven-bit offset. Labelled later changes reject truncated/out-of-range records; eight synthetic translations and three invalid-record checks passed on 13 October 2026.

Compare the scheduling policies

NON-PREEMPTIVE SERVICE
Request A
Request B
Request C
Request D
A0B7C10D1216
WAITING6.50
RESPONSE6.50
TURNAROUND10.50
THROUGHPUT0.250

Synthetic demonstration requests, arbitrary time units. A new scheduling visualisation, not historical measurements. Response equals waiting here because service is non-preemptive. The original Andre simulation's invalid timing aggregates remain disclosed.

Address translation

FIXED PAGE TABLE / 128-BYTE PAGES

Inside an address.

Virtual 68 → physical 324 / 0x144

VIRTUAL / PAGE000OFFSET / 7 BITS1000100
PAGE 02FRAME
PAGE 14FRAME
PAGE 21FRAME
PAGE 37FRAME
PAGE 43FRAME
PAGE 55FRAME
PAGE 66FRAME
PHYSICAL / FRAME010SAME OFFSET1000100
PAGE0
OFFSET68
FRAME2
PHYSICAL324
page = address >> 7
offset = address & 127
physical = (table[page] << 7) + offset

New binary explorer using the exact fixed table and bit operations in OS1Assignment.java. Seven valid virtual pages; no page replacement, faults or measured memory latency.

Explore the memory exercise Explore the separate Swing club simulation

Results & evidence

  • Private scheduling source compiled with JDK 17; both three-patron FCFS/SJF smoke runs completed.
  • The original address translator reproduced eight physical addresses from the private supplied fixture.
  • The public translator passed eight authored synthetic translations and three invalid-record checks on 13 October 2026; both stdout and file output were verified.

Engineering challenges

A runnable simulation is not necessarily a valid measurement system. Arrival-time initialisation and per-order timing boundaries are as important as queue choice.

Scope & limitations

Fresh runs expose an invalid turnaround aggregate: the order arrival field is not populated, and waiting/response aggregates use the global service start rather than each order arrival. These are not valid scheduler benchmarks. Teaching scaffolding is attributed.

What I learned

Blocking queues, barriers and service coordination, plus how to audit measurements against their definitions.

What I would improve now

Fix per-order timestamps in a new scheduling experiment and reuse identical workloads across policies. Extend translator stream/alias-path tests and write output atomically so a failed run cannot leave partial results.

NEXT PROJECTLearning to navigate Four Rooms