After reading some libcdio documentation, I think I understand how this system works.
First I'll talk a bit about floppy drives and RAM and then connect that to compact discs.
In RAM each byte has a number assigned to it. When we want to access data in that byte, we send the number to the processor and it puts the data in a register which we can later process (there's also the story of segments and offsets for x86, but I don't think it's relevant for this analogy). The system was more or less simple and it allows relatively easy access to memory.
Now on diskettes (and HDDs too) the disk is separated into concentric circles and they mark the tracks. Tracks which are parallelly placed above or below each-other form what is called a cylinder (remember, today's floppies are double sided, and on HDDs we can have several double sided disks). The disk is also divided into sectors. A sector is basically an angle whose vertex is in the center of the disk. Area bounded by track and sector is called block (although many people call it sector too). Another important thing is the head. As I said, today floppy disks have two sides and in HDD, each disk has two sides. On each side, there is a head which reads the data and each head has its own number.
When we want to get data from a floppy (or older HDD), we send the cylinder number, head number and sector number to the drive controller and it moves the head to appropriate location. Dimensions of disks are standardized and locations of tracks and sectors are too. We have a stepper motor which will move the head along the radius of the disk. The controller knows the distance between tracks and the current location of the head and will calculate by how many tracks it needs to move the head to get to the required track. When the head is moved to correct track, it will read the data on the diskette. Each block (or as some call it sector) there is some metadata written in addition to front data. The metadata has information on sector number and the CRC data. The sector number is read and the controller now knows where the head is actually on the disk and knows by how much to rotate disk to put head on the needed sector (or as some call it block). Since (on floppies and some very old HDDs) there is fixed amount of blocks on each track (and each block "take up" same angle), the controller can calculate the angle by which it needs to rotate the disk so that the needed block is next to the head. This method of getting the location is also called CHS form cylinder, head sector and is still used for diskettes. HDDs moved on to a more user-friendly method of addressing.
So now we're at logical block addressing. The idea is very simple. Instead of having programmer calculate address of data on the disk using CHS, we'll just assign a number to each block, just like each byte has its number in RAM, and access the data using that. HDD electronics do the LBA to CHS conversion internally and now we don't have to think too much about that.
Finally I've reached the compact disc area. First, I'll mention the main difference between compact disks and HDDs/floppies: The track on CD is a spiral and not a circle. Now that I've said that, I'll move a bit to CD history. Since LBA is so easy and simple to use (from OS and application programmer point of view, it's more complicated for drive firmware programmer). The esteemed scientists and engineers which were designing compact disk standards saw the beauty of LBA (which at that time was being implemented in SCSI, it won't become common-place on home computers for two more decades) and decided that they wanted something like that on the compact disc.
There seem to be several ways to get a block address on CD and I'll start with the simplest one: logical sector number (remember, terms like block, sector are often used as if they have same meaning). Using LSN, entire spiral is divided into 2352 byte blocks of main data (which are called sectors here). Each block has its number. Then there's the LBA addressing format. It's LSN-150. From what I've read, the 150 sectors are part of the lead-in of the track and that part of the disc is supposed to be empty.
I'll now explain what "frame" is. Basically each block is divided into 98 frames, which are basically a sort of smaller blocks. Each frame has 33 bytes of data. Of those 33 bytes, 24 are actual data expected by the player and nine are metadata. Eight bytes are used to provide error correction and one byte is used to provide so-called sub-channel data. Of those subchannels, P and Q are interesting to us because they actually contain the information about the location of the sector those frames are in. The Q channel has data about location in absolute time which is related to another block system which is next topic. The frame is then encoded on the disc using 8-to-14 modulation scheme and additional 27 bit word is added to the end. The word is specially made so that it's different from surrounding data and is used to separate two frames.
Now on to MSF (minute, second, frame) addressing. This addressing system came up because of the intended use of compact discs: digital audio. It must have seemed logical back then to measure space on disc by amount of time you could play sound using that space. As I said, 98 frames make block. There are 75 frames in a second using this addressing system. The interesting part is that here "frame" means block and not the frame I discussed above. Also there are of course 60 seconds in a minute. That's why we can sometimes see CDs marked as 74 minute or 80 minute discs.
I think I've finally come to the part which the question asked: How does CD drive know where to look. Well it works the same way as HDD and floppy. The general layout of the spiral is known (and drive can detect information about the particular disc itself when it's inserted) and the head moves to the location where it's expecting the data to be. Since stepper motors are used for that, drive knows exact location of the head and it can easily calculate by how much steps it needs to move in order to get to the expected location. It then rotates the disc so that the expected block is at the read head and we're ready. The drive gets address of the data on disc in LBA format from OS and it does the conversion internally using the addressing systems I described above. There's also the information in each block about its location which is helpful too.
Using math? All CDs have exactly the same track width, distance, etc., as defined in standards. The firmware could just calculate the location. – user1686 – 2011-12-29T12:54:49.237
From where? and what (Roughly) is that math? – Jonathan. – 2011-12-29T13:25:04.507
@Jonathan. - Your operating system uses the same basic procedure to find the data on a media like a compact disk that it uses to find your data on a flash drive or a mechanical hdd. When you view the contents of the disk, it reads the entire disk, it keeps track of the location of the files. – Ramhound – 2011-12-29T14:00:50.667
@Ramhound, well that's not really possible, often the disk will have a higher capacity than the RAM, and if you say it reads it to the HDD, you can read discs when the hard drive is full. – Jonathan. – 2011-12-29T14:08:42.397
http://electronics.howstuffworks.com/cd2.htm – Psycogeek – 2011-12-29T15:51:40.633
@Psycogeek, that just says the data is stored in a spiral..?? – Jonathan. – 2011-12-29T16:42:41.193
it doesnt cover everything you asked, but for a Web "how it works" it does a good job. try hitting the Next Page button. – Psycogeek – 2011-12-29T16:48:29.230
@Psycogeek, it is pretty good, I read it before asking here, it explains the bumps and that a laser is used to read them, but it doesn't say how the CD drive knows which bumps to read. – Jonathan. – 2011-12-29T17:11:27.333
http://www.freeopenbook.com/pc-hardware-nutshell-3/pchardnut3-chp-11-sect-2.html Yes the exact question that you have is not answered at many locations. They got the TOC (table of contents) and the Q bits, which have the data for the locations, and many different file systems as pointed out by dennis. stepper motor to jump tracks, wobble tracks, test areas, Buffers to hold data and info and timing based on next bump. but there doesnt seem to be a "controller" discussion. how does the microcontroller tell it where to skip and how. – Psycogeek – 2011-12-29T17:47:07.533