SShortSingh.
Back to feed

Belady's Anomaly Tested in Python: FIFO, LRU and Optimal Page Replacement

0
·354 views

A GATE CS page replacement tutorial walks through counting faults under FIFO, LRU and Optimal policies using a small Python checker. The author notes a textbook reference string with 3 frames that is worked through without the answer printed. A random simulation of one million strings found FIFO faulting more with 4 frames than with 3 in a single case, while LRU never did. An exhaustive C count over all 5^12 strings found FIFO's anomaly in exactly 120 of them, roughly 1 in 2 million. The author advises checking a question's wording first, since only FIFO can exhibit this behavior, and cross-checking practice answers against official keys.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Event-Driven Audit Log Ingestion Versus Direct Database Writes at Scale

The article argues that synchronous writes of audit logs to a relational database become a throughput bottleneck in high-volume SaaS platforms, where microservices can emit tens of thousands of privileged events per second. Such bottlenecks can cause back-pressure, raise API latency, and jeopardize regulatory audit visibility windows. The proposed alternative decouples producers from storage using message brokers such as Kafka, paired with idempotent writes, schema registries, and tiered hot and cold storage. The piece also covers operational concerns like tamper-evidence hashing, tracing, lag alerting, and batch and consumer tuning. It compares this pipeline against direct RDBMS writes, outlining trade-offs in complexity, cost, and consistency.

0
ProgrammingDEV Community ·

Phorge and Phabricator installations need migration-aware exposure reviews

Phorge is a maintained fork of Phabricator, and many live installations still show the older product name in their page titles, which can distort searches. A title search returned 244 matches for Phabricator and 34 for Phorge on 2026-11-11, but these counts are treated as overlapping, unverified candidate sets rather than a census. The article stresses that API bearer tokens carry the permissions of their owning account, so reviewers should map which accounts and applications each token can reach. It also recommends reviewing registration policies and authentication providers, since changes there are high-impact and open sign-up could let outsiders create accounts. Each candidate host should be confirmed as Phorge or legacy Phabricator before any conclusions are drawn.

0
ProgrammingDEV Community ·

MCP Bastion Flags a Silent Change to an AI Tool Description

The author edited a single sentence in the description of an MCP tool called get_uptime, which changed the tool's promise from reporting uptime to also reporting deployment region. Scanned alone, the altered definition raised no issues, but compared against the previously approved copy it triggered a HIGH-severity finding and a failing exit code. The case illustrates how an ordinary wording change can alter what an AI agent is asked to do without a fresh review. The author presented this as a demonstration of MCP Bastion, an open-source scanner for Model Context Protocol servers and agent tools. The scanner was tested at version 0.4.0 using saved tool definitions, and the experiment can be reproduced without a model, API key, or running server.

0
ProgrammingDEV Community ·

AI agent sells $0.15 AI-readiness audits and publishes all revenue on a public ledger

Script Master Labs has launched The Apprentice, a 30-day autonomous experiment that sells AI-readiness audits for one URL at $0.15 USDC per call over the x402 protocol on Base. Each call returns a deterministic 28-check audit, a markdown extraction of the page, and a short research brief, and failed runs are not charged. The experiment started with a $100 USDC seed under strict per-payment and daily spending limits, and only outside-party revenue counts toward its earnings. As of day two, the public ledger showed $0 in outside revenue and $0.02 spent on build-bounty claims. The audit was newly added to the OMNIGATE gateway and the HIVE402 catalog to improve discoverability.