Cook the spaghetti or linguine according to package instructions in a large pot of salted boiling water until al dente. Drain and set aside, reserving 1/2 cup of pasta water.
In a large skillet over medium heat, melt 2 tablespoons of butter. Add the sliced mushrooms and sauté for about 5 minutes until they are browned and tender. Remove the mushrooms from the skillet and set aside.
In the same skillet, add the remaining 2 tablespoons of butter. Add the minced garlic and red pepper flakes (if using) and sauté for about 1 minute until fragrant.
Add the shrimp to the skillet and cook for 2-3 minutes on each side until they turn pink and opaque. Season with salt and pepper.
Pour in the chicken broth and bring to a simmer. Allow it to reduce slightly for about 2 minutes.
Stir in the heavy cream and Parmesan cheese, mixing well until the cheese is melted and the sauce is creamy. If the sauce is too thick, add a little reserved pasta water to reach desired consistency.
Add the cooked pasta and sautéed mushrooms back into the skillet. Toss everything together until the pasta is well coated with the sauce.
Remove from heat and garnish with fresh parsley before serving.