2

Screen Time Guardian — Distributed Process Control

A cross-platform parental screen-time system — an enforcement agent on the child's machine and a remote control app for parents — built around a genuine concurrency problem: two parents editing the same policy file from different devices without corrupting it.

Technology Stack

Process Synchronisation, Inter-Process Communication, Mutual Exclusion Algorithms, Cloud File Sync, Cross-Platform Development

Overview

Duration: 1/2022

A screen-time management system in two parts: an enforcement agent running on the child's computer, and a control application the parents run from their own devices. The agent authenticates the user, checks the current time against an allowed-usage policy, monitors an active session, and shuts the machine down when the allowance is exhausted.

The reason this is a systems project rather than an application project is a single line in the requirements: both parents may run the control app simultaneously, from different machines, on different operating systems, editing the same policy file. That turns a scheduling tool into a distributed mutual-exclusion problem, and getting it wrong corrupts the policy that everything else depends on.

The Enforcement Agent

Runs at startup and cannot be trivially dismissed. Its control flow:

The Policy Format

Allowed usage is expressed in a compact line-based format, one rule per line:

F06:00 T06:45
F07:30 T11:30 D60 I20 S150
F19:00 T21:30 S90

Where F/T are the window bounds, D is the maximum continuous session, I the mandatory break between sessions, and S the total allowance within the window. The three rules above read as: free use from 06:00 to 06:45; between 07:30 and 11:30, 150 minutes total in blocks of at most 60 with 20-minute breaks; and between 19:00 and 21:30, 90 minutes total taken at any time.

Expressing the policy declaratively rather than as code is what lets both applications — written for different platforms — share one source of truth without shipping shared logic.

The Concurrency Problem

The policy file is synchronised through cloud storage so control apps on any platform can reach it. That is also what creates the hazard: two parents editing concurrently is a textbook critical section, and a naive read-modify-write loses one parent's change or corrupts the file outright.

The system coordinates access explicitly rather than hoping the window is too small to matter:

The Control Application

Runs on the parent's phone or computer and provides policy viewing and editing, plus access to the activity history the agent has recorded — the current day at minimum, with historical access as an extension.

This project is operating-systems fundamentals applied to a real scenario: mutual exclusion, deadlock avoidance, inter-process communication, and concurrent task coordination — where the correctness requirement comes from an ordinary use case rather than a contrived one.