Boil spaghetti in salted water as per package instructions until al dente. Reserve a cup of pasta water before you drain the pasta.
While the spaghetti is boiling, heat a tablespoon of olive oil in a pan and add mushrooms. Saute on medium high heat for a few minutes till golden brown on all sides.
In the same pan, add the remaining olive oil and garlic. On a low heat, cook the garlic for a few minutes till a light golden brown.
Add chilli flakes and the reserved pasta water, half teaspoon salt and let this cook and reduce till the sauce emulsifies (about 2-3 minutes).
Add the cooked spaghetti, mushrooms, parsley and toss well till the sauce coats the pasta.
Top with grated parmesan and serve.
