Android from the foundation · check

Know The ground floor already?

One question for each of the 6 puzzles in this module. A right answer marks that puzzle as passed, so you can jump ahead. A wrong one tells you which puzzle to start with. Nothing is sent anywhere: it's saved in this browser.

Puzzle 0: A running app is a process

The music app crashes while your notes app is open. What happens to the note you were typing?

Right. A crash ends only that process. Other processes keep their own memory.

Not quite. The music app can't reach the notes app's memory at all: different houses. Learn it in puzzle 0 →

Not quite. Each process has its own memory. A crash ends one process; the others don't even notice. Learn it in puzzle 0 →

Puzzle 1: The kernel is in charge

One CPU, two apps both busy. How do both get work done?

Right. The kernel shares the CPU by switching between processes very often.

Not quite. The phone has the CPU; processes only get turns on it, handed out by the kernel. Learn it in puzzle 1 →

Not quite. If one ran until it finished, the other would freeze. The kernel switches between them constantly. Learn it in puzzle 1 →

Puzzle 2: Threads are the workers

The main thread is busy for 3 seconds sorting a huge list. The user taps a button. What happens?

Not quite. Taps and drawing are the main thread's job only. Other threads can't step in. Learn it in puzzle 2 →

Right. Only the main thread handles taps and drawing, so while it's busy, the screen waits.

Not quite. The kernel shares the CPU between threads, but it doesn't take over the main thread's work. Learn it in puzzle 2 →

Puzzle 3: Who decides about your screens

The user switches from your app to another app. Who moves your Activity to "stopped"?

Not quite. The kernel shares the CPU and memory; screens and their stages are system_server's job. Learn it in puzzle 3 →

Not quite. Your app finds out, but it doesn't make the decision. The town hall moves it. Learn it in puzzle 3 →

Right. system_server decides every lifecycle stage; your app is told.

Puzzle 4: The post office carries letters

system_server wants your Activity to pause. Can it change your app's memory directly?

Not quite. Being Android's own process doesn't give it access to yours. Only the kernel reaches into every process. Learn it in puzzle 4 →

Right. Separate processes never touch each other's memory; Binder carries the message.

Puzzle 5: You don't call. You're called.

Your app calls onCreate() on its own Activity, by hand. What have you done?

Right. A callback is run by your main thread when system_server says it's time. Calling it yourself doesn't change what system_server decided.

Not quite. Only system_server moves an Activity through its lifecycle. Calling the callback yourself just runs your method. Learn it in puzzle 5 →

Back to the overview →