Yeah, that knocking is usually pre-ignition or 'detonation,' often caused by bad fuel or an overheated engine.
The primary fix is fuel-related. Drain the tank and refill with fresh, high-octane fuel mixed at the precise 50:1 ratio. Old, stale, or low-octane gas burns unpredictably and causes that pinging knock. Also, check that you're not running the saw with a dull chain or forcing it through wood too hard—that overloads and overheats the engine.
IF THAT DIDN'T WORK: The carburetor might be set too lean (not enough fuel in the mix), causing the engine to run hot and detonate. Adjusting the high-speed (H) jet requires a tachometer and know-how. If the noise persists with fresh fuel and proper technique, carbon buildup in the combustion chamber could be raising compression and causing knock.
HEADS UP: Continuous operation with that knocking sound can seriously damage the piston and cylinder. If fresh fuel doesn't solve it immediately, stop using it and get the carburetor adjusted by a pro.