C practice in Operating Systems
Browse the rooms before signing in. All rooms are free with an account. Practice does not issue certificates.
Count the CPUs
A CPU-availability mask stores many yes/no flags in one integer; population count measures how many are set.
bits. Free with an account.
Count the Forks
Starting from one process, n complete duplication rounds produce 2 to the power n processes.
fork. Free with an account.
Name the State
Map the five model states to distinct characters and use ? for an unknown value.
states. Free with an account.
The Turnaround Desk
Waiting = completion - arrival - CPU burst, for this no-I/O model.
metrics. Free with an account.
Ring Around the Buffer
Accept an operation only when occupancy permits it; otherwise count a failure without changing occupancy.
ring. Free with an account.
Round the Robin
On each turn, execute min(quantum, remaining work), then record completion exactly when the remaining work reaches zero.
rr. Free with an account.
Spin the Lock
Remember the old value, store one, then return the old value.
locks. Free with an account.
Wait on the Semaphore
A wait consumes one permit only when capacity is available.
semaphores. Free with an account.
Catch the Cycle
A cycle exists if some node can follow one or more dependency links back to itself.
deadlock. Free with an account.
Split the Address
With a power-of-two page size, the high address bits identify the virtual page.
paging. Free with an account.
The Tightest Hole
Filter eligible free blocks, then choose the smallest size with earliest-index ties.
fit. Free with an account.
Walk the Table
Physical address = mapped frame times page size + original page offset.
pagetable. Free with an account.
Evict the Stale
On every access record its time; on a miss use the first empty slot or the least-recently-used occupied slot.
lru. Free with an account.
Raise the Dead Disk
Missing value = parity XOR every surviving data value.
raid. Free with an account.
Sweep the Disk
At each step, serve the nearest remaining request from the current head position.
elevator. Free with an account.
XOR the Stripe
XOR parity summarizes a stripe and can help reconstruct one missing data word.
raid. Free with an account.
Ask the Oracle
On a full-memory miss, replace the page needed farthest after the current request.
optimal. Free with an account.
Banker's Hours
Repeatedly finish any eligible unfinished process and add its allocation to a private work vector.
deadlock. Free with an account.
Boot to Idle
Run round-robin once, then report makespan, identity changes and mean completion time scaled by 100.
fullrun. Free with an account.
Hand Out the FD
The lowest free descriptor is a hole in an occupancy mask, not the number of open descriptors.
files. Free with an account.