To use an M42 lens on a K100DS I purchased a second-hand adapter that converts from the 42mm screw thread to the current K bayonet mount. As many others before me have advised, look for the official Pentax adapter. Cheap eBay clones are deficient in that they do not allow focus at infinity, and might require a special tool to remove it from the camera. The Pentax adapter has a small spring one can press with a fingernail or pen; there's no tool to lose.
The usual procedure is to attach the converter to the camera lens mount by seating it in place and turning. The spring holds it in place. Now you can screw the lens onto the adapter. To remove, unscrew the lens leaving the adapter on the body. Then use that little spring and rotate off the adapter. I find this a bit tricky and do not like having the innards of the camera exposed that long.
If you too are dexterity challenged, consider instead unscrewing the spring and taking it off entirely. In this way the adapter stays on the lens instead of the body. This makes it much quicker to change lenses, but of course you'll then need an adapter for each lens so fitted.
There is another disadvantage to this trick. When attached, such lenses do not click into place since there is nowhere for the lens mount locking pin to engage. This means it is possible for the lens to twist off the body. Some enterprising souls drill a hole in the lens at just the right spot so the locking pin can fit. I didn't bother, since I don't want to mar the lens and don't judge the risk is too high.
Now the lens is on the camera, there are some settings to make. Go into the "Custom Setting" menu and set "FL with S lens used" to "Available". What this does is turn on focus lock. Next, set "Using Aperture Ring" to "Allowed". Now you can use the aperture ring on the lens itself. I am not too sure why these are not on by default, since the only disadvantage I can see is that you might use the aperture ring by mistake when you don't want to.
Now go to the "Rec Mode" menu. Set "metering" to center-weighted or spot as you prefer. Set the focus switch to "MF" since we will be focusing manually. Set the mode dial to "M". We need to be fully manual so the body and lens will communicate properly. Finally, the lens itself has a switch (not all do, so the procedure is different with other M42 lenses). Slide this so the red "M" is showing. This seemed counter-intuitive to me, but allows the lens aperture ring to function independently of the body. (I would have thought the "A" setting allowed automatic metering, but apparently that setting is for a different -- older -- body mechanism.)
That may seem like an awful lot of settings, but most of it need only be done once. from now on all you need to do when attaching the lens is set "MF" and go to Manual mode. Easy!
There is one more thing I should mention. When you turn on the camera with a manual lens attached, the body does not know its focal length. So a menu pops up asking you to dial it in. Simply select the nearest focal length. This ensures the Shake Reduction will work optimally.
To take a photo you need to use an ancient procedure known as "stop-down metering". But the camera makes this a piece of cake.
1. Set the aperture ring on the lens to the desired f-stop.
2. Press "AE-L" button (or the "green" button depending on your camera) to stop down the lens and take a meter reading. The camera will set the shutter speed automatically.
3. Adjust shutter speed if you wish.
5. Hit the shutter.
Easy huh? It's only two steps more than using an automatic lens. The body makes it trivial by metering through the lens for us.
Another cool thing is that you get a focus indicator in the viewfinder, so it's not so difficult to focus after all.
And as an additional bonus you can "trap focus" with some lenses. Change the switch to "AF". Now hold down the shutter button and twist the lens. When the image is in focus, the camera takes the photo! This doesn't work on every manual lens, but it's a nice trick when it does.
No other manufacturer provides so much assistance to photographers experimenting with older lenses. Go Pentax!
References: Hin Man has a series of articles with some M42 adapter pictures. Yury has written a similar article on eBay.
(If you appreciate this review series, please donate a few bucks using the PayPal logo in the sidebar.)