Gather the ingredients.
Cook spaghetti or linguine in boiling salted water following package directions. Drain.
Meanwhile, in a small skillet over medium heat, lightly brown the ham in 2 teaspoons of olive oil or butter.
Meanwhile, for pesto, combine in a food processor the peas, basil, Parmesan cheese, garlic, and walnuts, if using.
Run the food processor, adding olive oil a little at a time, until the mixture is finely chopped.
Taste and add salt and pepper, as needed.
Toss the diced ham and pesto with the hot pasta.
Serve with more Parmesan cheese.