Compression stroke at TDC or Exhaust at TDC or somewhere else?
Is this position fixed or does it depend on other conditions?
It's random. Usually won't come to a stop at top or bottom dead center because theres nothing to drive it to that point, and one of the pistons will be building compression at any given time of the engine cycle. So without some powering source to force it to a high compression location, it'll stop somewhere mid-stroke. Plus the crank wants to roll off from top dead naturally, so chances are that even if it came to rest right on the, it woukd go ahead and rotate to mid-stroke. Of course, that doesn't mean it cant or never happens, but chances are slim. Plus the rotating assembly should be pretty much balanced, so if all other factors are removed, it woukd tend to set at a mid-stroke where all of the components are balanced with each other.
It isn't completely random, as there will always be one piston that is approaching TDC, and the compression building in that cylinder will ultimately cause the engine to stop. Any cylinder that makes it over TDC, will have a "spring" action that will tend to maintain RPM, as the compression energy is now released.
This is critical to the brilliant and bizarre Mitsubishi stop-start system:
Zero mph for a certain delay time stops spark and fuel injection. Engine dies.
Throttle position (pulling away from stop sign) instantly requests a restart from the ECU.
ECU analyzes cam position sensor(s) to determine which cylinder has the piston close to (but before) TDC on compression stroke.
Fuel is injected into that cylinder and sparked to ignite.
Piston forced downward, but engine is running BACKWARDS!
ECU monitors next cylinder to reach close to TDC, injects and fires BEFORE TDC.
Engine now runs reversed-reverse direction (correctly) and ECU takes over and runs engine normally, satifying acceleration request.
It's brilliant how this system works, and it takes place in milliseconds, all within 3/4 of a crank revolution. Note that these vehicles were sold without any electric starter!
The point I'm trying to make, is that you maynot know which cylinder will be on compression just short of TDC, but you are always guaranteed there will be one.
On edit: I can't easily find a reference. I may be confusing this with Mazda's SISS system, which began as "starterless" but then later became a "starter-assist" function. And the Mazda system at one point used ECU-controlled alternator load to brake the engine into an exact known location.
I know I taught this system at vocational college a few years ago out of Halderman's Automotive Technology or maybe some Cenguage textbook. I had never heard of it myself before then. I'll try to dig up the original reference. I still think it was Mitsubishi.
In any case, most of these trick things have been abandoned for conventional electric restarting.